blob: 23840ce4aa795439547f5fbe842ed2b61458190f [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:
Dong Mabb1ef1f2025-02-11 16:47:00 +000045{{ with .Values.pod.priorityClassName.nova_cell_setup }}
46 priorityClassName: {{ . }}
47{{ end }}
48{{ with .Values.pod.runtimeClassName.nova_cell_setup }}
49 runtimeClassName: {{ . }}
50{{ end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050051 serviceAccountName: {{ $serviceAccountName }}
52{{ dict "envAll" $envAll "application" "cell_setup" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 10 }}
53 restartPolicy: OnFailure
54 nodeSelector:
55 {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }}
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010056{{ if $envAll.Values.pod.tolerations.nova.enabled }}
57{{ tuple $envAll "nova" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 10 }}
58{{ end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050059 initContainers:
60{{ tuple $envAll "cell_setup" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 12 }}
61 containers:
62 - name: nova-cell-setup
63{{ tuple $envAll "nova_cell_setup" | include "helm-toolkit.snippets.image" | indent 14 }}
64{{ tuple $envAll $envAll.Values.pod.resources.jobs.cell_setup | include "helm-toolkit.snippets.kubernetes_resources" | indent 14 }}
65{{ dict "envAll" $envAll "application" "cell_setup" "container" "nova_cell_setup" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 14 }}
66 command:
67 - /tmp/cell-setup.sh
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010068{{- if or .Values.manifests.certificates .Values.tls.identity }}
69 env:
70 - name: REQUESTS_CA_BUNDLE
71 value: "/etc/nova/certs/ca.crt"
72{{- end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050073 volumeMounts:
74 - name: pod-tmp
75 mountPath: /tmp
76 - name: nova-bin
77 mountPath: /tmp/cell-setup.sh
78 subPath: cell-setup.sh
79 readOnly: true
80 - name: etcnova
81 mountPath: /etc/nova
82 - name: nova-etc
83 mountPath: /etc/nova/nova.conf
84 subPath: nova.conf
85 readOnly: true
86 {{- if .Values.conf.nova.DEFAULT.log_config_append }}
87 - name: nova-etc
88 mountPath: {{ .Values.conf.nova.DEFAULT.log_config_append }}
89 subPath: {{ base .Values.conf.nova.DEFAULT.log_config_append }}
90 readOnly: true
91 {{- end }}
92 - name: nova-etc
93 mountPath: /etc/nova/policy.yaml
94 subPath: policy.yaml
95 readOnly: true
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010096{{- 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 -050097{{- 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 +010098
Mohammed Naserf3f59a72023-01-15 21:02:04 -050099 volumes:
100 - name: pod-tmp
101 emptyDir: {}
102 - name: etcnova
103 emptyDir: {}
104 - name: nova-etc
105 secret:
106 secretName: nova-etc
107 defaultMode: 0444
108 - name: nova-bin
109 configMap:
110 name: nova-bin
111 defaultMode: 0555
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +0100112{{- 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 -0500113{{- 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 +0100114
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500115{{- end }}