diff --git a/galaxy/templates/configmap-cvmfs-fix.yaml b/galaxy/templates/configmap-cvmfs-fix.yaml new file mode 100644 index 00000000..d5d4c129 --- /dev/null +++ b/galaxy/templates/configmap-cvmfs-fix.yaml @@ -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." diff --git a/galaxy/templates/hook-cvmfs-fix.yaml b/galaxy/templates/hook-cvmfs-fix.yaml new file mode 100644 index 00000000..12ab3cbd --- /dev/null +++ b/galaxy/templates/hook-cvmfs-fix.yaml @@ -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" diff --git a/galaxy/templates/rbac-job.yaml b/galaxy/templates/rbac-job.yaml index 7095a309..f1180267 100644 --- a/galaxy/templates/rbac-job.yaml +++ b/galaxy/templates/rbac-job.yaml @@ -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"]