pre-install-job.yaml 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. {{- if .Values.appVolumeMounts -}}
  2. {{- if hasKey .Values.appVolumeMounts "export" }}
  3. apiVersion: batch/v1
  4. kind: Job
  5. metadata:
  6. name: "{{ template "common.names.fullname" . }}-preinstall-job"
  7. labels:
  8. app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
  9. app.kubernetes.io/instance: {{ .Release.Name | quote }}
  10. app.kubernetes.io/version: {{ .Chart.AppVersion }}
  11. helm.sh/chart: {{ template "common.names.chart" . }}
  12. annotations:
  13. "helm.sh/hook": pre-install
  14. "helm.sh/hook-delete-policy": hook-succeeded
  15. spec:
  16. template:
  17. metadata:
  18. name: "{{ template "common.names.fullname" . }}-preinstall-hook"
  19. labels:
  20. app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
  21. app.kubernetes.io/instance: {{ .Release.Name | quote }}
  22. helm.sh/chart: {{ template "common.names.chart" . }}
  23. spec:
  24. restartPolicy: Never
  25. containers:
  26. - name: pre-install-job
  27. image: "alpine:latest"
  28. command: ["chown", "-R", "{{ .Values.runAsUser }}:{{ .Values.runAsGroup }}", "{{ .Values.appVolumeMounts.export.mountPath }}"]
  29. volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
  30. volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}
  31. {{- end -}}
  32. {{- end -}}