pre-install-job.yaml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. apiVersion: batch/v1
  2. kind: Job
  3. metadata:
  4. name: pre-install-{{ template "kibana.fullname" . }}
  5. labels: {{ include "kibana.labels" . | nindent 4 }}
  6. annotations:
  7. "helm.sh/hook": pre-install,pre-upgrade
  8. "helm.sh/hook-delete-policy": hook-succeeded
  9. {{- if .Values.annotations }}
  10. {{- range $key, $value := .Values.annotations }}
  11. {{ $key }}: {{ $value | quote }}
  12. {{- end }}
  13. {{- end }}
  14. spec:
  15. backoffLimit: 20
  16. template:
  17. spec:
  18. restartPolicy: Never
  19. containers:
  20. - name: create-kibana-token
  21. image: "{{ .Values.image }}:{{ .Values.imageTag }}"
  22. imagePullPolicy: "{{ .Values.imagePullPolicy }}"
  23. command: ["{{ template "kibana.home_dir" . }}/node/bin/node"]
  24. args:
  25. - {{ template "kibana.home_dir" . }}/helm-scripts/manage-es-token.js
  26. - create
  27. env:
  28. - name: "ELASTICSEARCH_USERNAME"
  29. valueFrom:
  30. secretKeyRef:
  31. name: {{ .Values.elasticsearchCredentialSecret }}
  32. key: username
  33. - name: "ELASTICSEARCH_PASSWORD"
  34. valueFrom:
  35. secretKeyRef:
  36. name: {{ .Values.elasticsearchCredentialSecret }}
  37. key: password
  38. - name: ELASTICSEARCH_SSL_CERTIFICATEAUTHORITIES
  39. value: "{{ template "kibana.home_dir" . }}/config/certs/{{ .Values.elasticsearchCertificateAuthoritiesFile }}"
  40. volumeMounts:
  41. - name: elasticsearch-certs
  42. mountPath: {{ template "kibana.home_dir" . }}/config/certs
  43. readOnly: true
  44. - name: kibana-helm-scripts
  45. mountPath: {{ template "kibana.home_dir" . }}/helm-scripts
  46. serviceAccount: pre-install-{{ template "kibana.fullname" . }}
  47. volumes:
  48. - name: elasticsearch-certs
  49. secret:
  50. secretName: {{ .Values.elasticsearchCertificateSecret }}
  51. - name: kibana-helm-scripts
  52. configMap:
  53. name: {{ template "kibana.fullname" . }}-helm-scripts
  54. defaultMode: 0755