Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 1 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 2 | # you may not use this file except in compliance with the License. |
| 3 | # You may obtain a copy of the License at |
| 4 | # |
| 5 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | # |
| 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 | {{- if .Values.manifests.job_bootstrap }} |
| 13 | |
| 14 | {{- $envAll := . }} |
| 15 | {{- if .Values.bootstrap.enabled }} |
| 16 | {{- $mounts_designate_bootstrap := .Values.pod.mounts.designate_bootstrap.designate_bootstrap }} |
| 17 | {{- $mounts_designate_bootstrap_init := .Values.pod.mounts.designate_bootstrap.init_container }} |
| 18 | --- |
| 19 | apiVersion: batch/v1 |
| 20 | kind: Job |
| 21 | metadata: |
| 22 | name: designate-bootstrap |
| 23 | spec: |
| 24 | template: |
| 25 | metadata: |
| 26 | labels: |
| 27 | {{ tuple $envAll "designate" "bootstrap" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} |
| 28 | spec: |
| 29 | restartPolicy: OnFailure |
| 30 | nodeSelector: |
| 31 | {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} |
| 32 | initContainers: |
| 33 | {{ tuple $envAll "bootstrap" $mounts_designate_bootstrap_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} |
| 34 | containers: |
| 35 | - name: designate-bootstrap |
| 36 | image: {{ .Values.images.tags.bootstrap }} |
| 37 | imagePullPolicy: {{ .Values.images.pull_policy }} |
| 38 | {{ tuple $envAll $envAll.Values.pod.resources.jobs.bootstrap | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} |
| 39 | env: |
| 40 | {{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin }} |
| 41 | {{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 12 }} |
| 42 | {{- end }} |
| 43 | command: |
| 44 | - /tmp/bootstrap.sh |
| 45 | volumeMounts: |
| 46 | - name: designate-bin |
| 47 | mountPath: /tmp/bootstrap.sh |
| 48 | subPath: bootstrap.sh |
| 49 | readOnly: true |
| 50 | {{ if $mounts_designate_bootstrap.volumeMounts }}{{ toYaml $mounts_designate_bootstrap.volumeMounts | indent 10 }}{{ end }} |
| 51 | volumes: |
| 52 | - name: designate-bin |
| 53 | configMap: |
| 54 | name: designate-bin |
| 55 | defaultMode: 0555 |
| 56 | {{ if $mounts_designate_bootstrap.volumes }}{{ toYaml $mounts_designate_bootstrap.volumes | indent 6 }}{{ end }} |
| 57 | {{- end }} |
| 58 | {{- end }} |