diff --git a/infrastructure/longhorn/hotfix-7183.yaml b/infrastructure/longhorn/hotfix-7183.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1e6a96c9830e68d107a6baad9c13c767d4d1d373 --- /dev/null +++ b/infrastructure/longhorn/hotfix-7183.yaml @@ -0,0 +1,70 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: longhorn-hotfix-7183 +spec: + jobTemplate: + spec: + template: + spec: + serviceAccountName: longhorn-hotfix-7183 + containers: + - image: docker.io/bitnami/kubectl:1.28 + name: longhorn-hotfix + resources: + requests: + cpu: 10m + memory: 128Mi + limits: + cpu: "1" + memory: 256Mi + command: + - /bin/bash + args: + - -c + - | + for i in $(kubectl get lhsm -n longhorn-system --no-headers -o custom-columns=NAME:metadata.name); do + if kubectl get pods --no-headers -n longhorn-system "share-manager-$i" | grep -v Running; then + kubectl patch lhsm -n longhorn-system --type=merge --subresource status --patch 'status: {state: error}' $i + fi + done + restartPolicy: OnFailure + schedule: '*/5 * * * *' +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: longhorn-hotfix-7183 +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: longhorn-hotfix-7183 +rules: +- apiGroups: + - "" + resources: + - pods + verbs: + - get +- apiGroups: + - "longhorn.io" + resources: + - sharemanagers + - sharemanagers/status + verbs: + - patch + - get + - list +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: longhorn-hotfix-7183 +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: longhorn-hotfix-7183 +subjects: +- kind: ServiceAccount + name: longhorn-hotfix-7183