Skip to content

Commit

Permalink
Merge pull request #419 from galaxyproject/cvmfs-workaround
Browse files Browse the repository at this point in the history
Add a post-install hook to restart cvmfs csi pods
  • Loading branch information
ksuderman authored Mar 17, 2023
2 parents d5d43d1 + e738422 commit 0e7283f
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
18 changes: 18 additions & 0 deletions galaxy/templates/configmap-cvmfs-fix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-configmap-cvmfs-fix
labels:
{{- include "galaxy.labels" . | nindent 4 }}
data:
cvmfs-fix.sh: |
sleep 10;
status=`kubectl get pods -n {{ .Release.Namespace }} -l 'app=cvmfscsi' -l 'component=nodeplugin' -o custom-columns=STATUS:.status.phase --no-headers | sort | uniq | tr -d '\n'`
while [ "$status" != "Running" ]; do
echo "Waiting on nodeplugin pod to enter 'Running' status. Currently '$status'.";
sleep 1;
status=`kubectl get pods -n {{ .Release.Namespace }} -l 'app=cvmfscsi' -l 'component=nodeplugin' -o custom-columns=STATUS:.status.phase --no-headers | sort | uniq | tr -d '\n'`
done && \
echo "Deleting nodeplugin pods..."
kubectl get pods -n {{ .Release.Namespace }} -l 'app=cvmfscsi' -l 'component=nodeplugin' -o name | xargs kubectl -n {{ .Release.Namespace }} delete && \
echo "Deleted nodeplugin pods."
35 changes: 35 additions & 0 deletions galaxy/templates/hook-cvmfs-fix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: batch/v1
kind: Job
metadata:
name: "{{ .Release.Name }}-post-install-cvmfs-fix-job"
labels:
{{- include "galaxy.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": post-install
"helm.sh/hook-weight": "10"
"helm.sh/hook-delete-policy": hook-succeeded
spec:
ttlSecondsAfterFinished: 120
template:
metadata:
name: "{{ .Release.Name }}-post-install-cvmfs-fix-job"
labels:
{{- include "galaxy.labels" . | nindent 8 }}
spec:
serviceAccountName: {{ include "galaxy.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.securityContext | nindent 8 }}
restartPolicy: Never
containers:
- name: post-install-kubectl
image: bitnami/kubectl
command:
- "sh"
- "/script/cvmfs-fix.sh"
volumeMounts:
- name: kubectl-script
mountPath: "/script"
volumes:
- name: kubectl-script
configMap:
name: "{{ .Release.Name }}-configmap-cvmfs-fix"
2 changes: 1 addition & 1 deletion galaxy/templates/rbac-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
rules:
- apiGroups: [""]
resources: ["pods", "pods/log"]
verbs: ["get", "list", "watch"]
verbs: ["get", "list", "watch", "delete"]
- apiGroups: ["batch", "extensions"]
resources: ["jobs"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
Expand Down

0 comments on commit 0e7283f

Please sign in to comment.