|
| 1 | +{{- if $.Values.server.config.namespaces.create }} |
| 2 | +{{- $jobName := include "temporal.componentname" (list $ (printf "namespace-%s-%d" $.Chart.Version $.Release.Revision | replace "." "-")) }} |
| 3 | +apiVersion: batch/v1 |
| 4 | +kind: Job |
| 5 | +metadata: |
| 6 | + name: {{ $jobName }} |
| 7 | + labels: |
| 8 | + {{- include "temporal.resourceLabels" (list $ "database" "") | nindent 4 }} |
| 9 | + {{- with $.Values.schema.jobAnnotations }} |
| 10 | + annotations: |
| 11 | + {{- toYaml . | nindent 4 }} |
| 12 | + {{- end }} |
| 13 | +spec: |
| 14 | + backoffLimit: {{ $.Values.schema.backoffLimit }} |
| 15 | + ttlSecondsAfterFinished: {{ $.Values.schema.ttlSecondsAfterFinished }} |
| 16 | + template: |
| 17 | + metadata: |
| 18 | + name: {{ $jobName }} |
| 19 | + labels: |
| 20 | + {{- include "temporal.resourceLabels" (list $ "database" "") | nindent 8 }} |
| 21 | + {{- with $.Values.schema.podLabels }} |
| 22 | + {{- toYaml . | nindent 8 }} |
| 23 | + {{- end }} |
| 24 | + {{- with $.Values.schema.podAnnotations }} |
| 25 | + annotations: |
| 26 | + {{- toYaml . | nindent 8 }} |
| 27 | + {{- end }} |
| 28 | + spec: |
| 29 | + {{ include "temporal.serviceAccount" $ }} |
| 30 | + restartPolicy: OnFailure |
| 31 | + initContainers: |
| 32 | + {{- range $namespace := $.Values.server.config.namespaces.namespace }} |
| 33 | + - name: create-{{ $namespace.name }}-namespace |
| 34 | + image: "{{ $.Values.admintools.image.repository }}:{{ $.Values.admintools.image.tag }}" |
| 35 | + imagePullPolicy: {{ $.Values.admintools.image.pullPolicy }} |
| 36 | + command: ['/bin/sh', '-c'] |
| 37 | + args: ['temporal operator namespace describe -n {{ $namespace.name }} || temporal operator namespace create -n {{ $namespace.name }}{{- if hasKey $namespace "retention" }} --retention {{ $namespace.retention }}{{- end }}'] |
| 38 | + env: |
| 39 | + - name: TEMPORAL_ADDRESS |
| 40 | + {{- if (index $.Values.server "internal-frontend").enabled }} |
| 41 | + value: {{ include "temporal.fullname" $ }}-internal-frontend.{{ $.Release.Namespace }}.svc:{{ (index $.Values.server "internal-frontend").service.port }} |
| 42 | + {{- else if $.Values.server.frontend.ingress.enabled }} |
| 43 | + value: "{{ index $.Values.server.frontend.ingress.hosts 0 }}" |
| 44 | + {{- else }} |
| 45 | + value: "{{ include "temporal.fullname" $ }}-frontend.{{ $.Release.Namespace }}.svc:{{ $.Values.server.frontend.service.port }}" |
| 46 | + {{- end }} |
| 47 | + {{- with $.Values.admintools.additionalEnv }} |
| 48 | + {{- toYaml . | nindent 12 }} |
| 49 | + {{- end }} |
| 50 | + {{- if or $.Values.admintools.additionalEnvSecretName $.Values.admintools.additionalEnvConfigMapName }} |
| 51 | + envFrom: |
| 52 | + {{- with $.Values.admintools.additionalEnvSecretName }} |
| 53 | + - secretRef: |
| 54 | + name: {{ . }} |
| 55 | + {{- end }} |
| 56 | + {{- with $.Values.admintools.additionalEnvConfigMapName }} |
| 57 | + - configMapRef: |
| 58 | + name: {{ . }} |
| 59 | + {{- end }} |
| 60 | + {{- end }} |
| 61 | + {{- with $.Values.admintools.additionalVolumeMounts }} |
| 62 | + volumeMounts: |
| 63 | + {{- toYaml . | nindent 12 }} |
| 64 | + {{- end }} |
| 65 | + {{- with $.Values.schema.resources }} |
| 66 | + resources: |
| 67 | + {{- toYaml . | nindent 12 }} |
| 68 | + {{- end }} |
| 69 | + {{- with $.Values.schema.containerSecurityContext }} |
| 70 | + securityContext: |
| 71 | + {{- toYaml . | nindent 12 }} |
| 72 | + {{- end }} |
| 73 | + {{- end }} |
| 74 | + containers: |
| 75 | + - name: done |
| 76 | + image: "{{ $.Values.admintools.image.repository }}:{{ $.Values.admintools.image.tag }}" |
| 77 | + imagePullPolicy: {{ $.Values.admintools.image.pullPolicy }} |
| 78 | + command: ['sh', '-c', 'echo "Namespace setup completed"'] |
| 79 | + {{- with $.Values.schema.resources }} |
| 80 | + resources: |
| 81 | + {{- toYaml . | nindent 12 }} |
| 82 | + {{- end }} |
| 83 | + {{- with $.Values.schema.containerSecurityContext }} |
| 84 | + securityContext: |
| 85 | + {{- toYaml . | nindent 12 }} |
| 86 | + {{- end }} |
| 87 | + {{- with $.Values.schema.securityContext }} |
| 88 | + securityContext: |
| 89 | + {{- toYaml . | nindent 8 }} |
| 90 | + {{- end }} |
| 91 | + {{- with $.Values.imagePullSecrets }} |
| 92 | + imagePullSecrets: |
| 93 | + {{- toYaml . | nindent 8 }} |
| 94 | + {{- end }} |
| 95 | + {{- with $.Values.admintools.nodeSelector }} |
| 96 | + nodeSelector: |
| 97 | + {{- toYaml . | nindent 8 }} |
| 98 | + {{- end }} |
| 99 | + {{- with $.Values.admintools.tolerations }} |
| 100 | + tolerations: |
| 101 | + {{- toYaml . | nindent 8 }} |
| 102 | + {{- end }} |
| 103 | + {{- with $.Values.admintools.additionalVolumes }} |
| 104 | + volumes: |
| 105 | + {{- toYaml . | nindent 8 }} |
| 106 | + {{- end }} |
| 107 | +{{- end }} |
0 commit comments