blob: b90b84e8c68d0b19c048eaf555d11b7cb043f2f7 [file] [log] [blame]
Mohammed Naserf3f59a72023-01-15 21:02:04 -05001{{/*
2Licensed under the Apache License, Version 2.0 (the "License");
3you may not use this file except in compliance with the License.
4You may obtain a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8Unless required by applicable law or agreed to in writing, software
9distributed under the License is distributed on an "AS IS" BASIS,
10WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11See the License for the specific language governing permissions and
12limitations under the License.
13*/}}
14
15{{- if .Values.manifests.cron_job_cell_setup }}
16{{- $envAll := . }}
17
18{{- $serviceAccountName := "nova-cell-setup-cron" }}
19{{ tuple $envAll "cell_setup" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
20---
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010021apiVersion: batch/v1
Mohammed Naserf3f59a72023-01-15 21:02:04 -050022kind: CronJob
23metadata:
24 name: nova-cell-setup
25 annotations:
26 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
27spec:
28 schedule: {{ .Values.jobs.cell_setup.cron | quote }}
29 successfulJobsHistoryLimit: {{ .Values.jobs.cell_setup.history.success }}
30 failedJobsHistoryLimit: {{ .Values.jobs.cell_setup.history.failed }}
31 {{- if .Values.jobs.cell_setup.starting_deadline }}
32 startingDeadlineSeconds: {{ .Values.jobs.cell_setup.starting_deadline }}
33 {{- end }}
34 concurrencyPolicy: Forbid
35 jobTemplate:
36 metadata:
37 labels:
38{{ tuple $envAll "nova" "cell-setup" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
39 spec:
40 template:
41 metadata:
42 labels:
43{{ tuple $envAll "nova" "cell-setup" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 12 }}
44 spec:
45 serviceAccountName: {{ $serviceAccountName }}
46{{ dict "envAll" $envAll "application" "cell_setup" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 10 }}
47 restartPolicy: OnFailure
48 nodeSelector:
49 {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }}
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010050{{ if $envAll.Values.pod.tolerations.nova.enabled }}
51{{ tuple $envAll "nova" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 10 }}
52{{ end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050053 initContainers:
54{{ tuple $envAll "cell_setup" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 12 }}
55 containers:
56 - name: nova-cell-setup
57{{ tuple $envAll "nova_cell_setup" | include "helm-toolkit.snippets.image" | indent 14 }}
58{{ tuple $envAll $envAll.Values.pod.resources.jobs.cell_setup | include "helm-toolkit.snippets.kubernetes_resources" | indent 14 }}
59{{ dict "envAll" $envAll "application" "cell_setup" "container" "nova_cell_setup" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 14 }}
60 command:
61 - /tmp/cell-setup.sh
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010062{{- if or .Values.manifests.certificates .Values.tls.identity }}
63 env:
64 - name: REQUESTS_CA_BUNDLE
65 value: "/etc/nova/certs/ca.crt"
66{{- end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050067 volumeMounts:
68 - name: pod-tmp
69 mountPath: /tmp
70 - name: nova-bin
71 mountPath: /tmp/cell-setup.sh
72 subPath: cell-setup.sh
73 readOnly: true
74 - name: etcnova
75 mountPath: /etc/nova
76 - name: nova-etc
77 mountPath: /etc/nova/nova.conf
78 subPath: nova.conf
79 readOnly: true
80 {{- if .Values.conf.nova.DEFAULT.log_config_append }}
81 - name: nova-etc
82 mountPath: {{ .Values.conf.nova.DEFAULT.log_config_append }}
83 subPath: {{ base .Values.conf.nova.DEFAULT.log_config_append }}
84 readOnly: true
85 {{- end }}
86 - name: nova-etc
87 mountPath: /etc/nova/policy.yaml
88 subPath: policy.yaml
89 readOnly: true
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010090{{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.compute.osapi.internal "path" "/etc/nova/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 16 }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050091{{- dict "enabled" .Values.manifests.certificates "name" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal "path" "/etc/mysql/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 16 }}
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010092
Mohammed Naserf3f59a72023-01-15 21:02:04 -050093 volumes:
94 - name: pod-tmp
95 emptyDir: {}
96 - name: etcnova
97 emptyDir: {}
98 - name: nova-etc
99 secret:
100 secretName: nova-etc
101 defaultMode: 0444
102 - name: nova-bin
103 configMap:
104 name: nova-bin
105 defaultMode: 0555
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +0100106{{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.compute.osapi.internal | include "helm-toolkit.snippets.tls_volume" | indent 12 }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500107{{- dict "enabled" .Values.manifests.certificates "name" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 12 }}
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +0100108
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500109{{- end }}