Skip to content
Snippets Groups Projects
Verified Commit b230eb31 authored by Sheogorath's avatar Sheogorath :european_castle:
Browse files

fix(longhorn): Workaround for share-manager problems

parent 74b1db3d
No related branches found
No related tags found
No related merge requests found
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment