post-install-cmds.yaml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. {{- /*
  2. Copyright 2020 Crown Copyright
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */ -}}
  13. {{- if .Values.postInstallCommands }}
  14. apiVersion: v1
  15. kind: Pod
  16. metadata:
  17. name: {{ template "hdfs.fullname" . }}-post-install-cmds
  18. annotations:
  19. helm.sh/hook: post-install,post-upgrade
  20. helm.sh/hook-delete-policy: hook-succeeded
  21. helm.sh/hook-weight: "10"
  22. labels:
  23. {{- include "hdfs.labels" . | nindent 4 }}
  24. app.kubernetes.io/component: hook
  25. spec:
  26. restartPolicy: OnFailure
  27. containers:
  28. - name: cmds
  29. image: {{ .Values.shell.repository }}:{{ .Values.shell.tag }}
  30. imagePullPolicy: {{ .Values.shell.imagePullPolicy }}
  31. command: ["/bin/bash", "-c", "until hadoop fs -ls / >/dev/null 2>&1 || [ $(( ATTEMPTS++ )) -gt 300 ]; do echo \"$(date) - Waiting for HDFS instance to be ready...\" && sleep 10; done && {{ join " && " .Values.postInstallCommands}}"]
  32. env:
  33. - name: HADOOP_CONF_DIR
  34. value: {{ .Values.config.path }}
  35. volumeMounts:
  36. - name: config
  37. mountPath: {{ .Values.config.path }}
  38. readOnly: true
  39. volumes:
  40. - name: config
  41. configMap:
  42. name: {{ template "hdfs.fullname" . }}
  43. optional: false
  44. {{- with .Values.shell.imagePullSecrets }}
  45. imagePullSecrets:
  46. {{- range . }}
  47. - name: {{ . }}
  48. {{- end }}
  49. {{- end }}
  50. {{- end }}