blob: 32674b6afef277b75212ea554f27ccb3dca45398 [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_engine_cleaner }}
16{{- $envAll := . }}
17
18{{- $mounts_heat_engine_cleaner := .Values.pod.mounts.heat_engine_cleaner.heat_engine_cleaner }}
19{{- $mounts_heat_engine_cleaner_init := .Values.pod.mounts.heat_engine_cleaner.init_container }}
20
21{{- $serviceAccountName := "heat-engine-cleaner" }}
22{{ tuple $envAll "engine_cleaner" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
23---
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000024apiVersion: batch/v1
Mohammed Naserf3f59a72023-01-15 21:02:04 -050025kind: CronJob
26metadata:
27 name: heat-engine-cleaner
28 annotations:
29 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
30spec:
31 schedule: {{ .Values.jobs.engine_cleaner.cron | quote }}
32 successfulJobsHistoryLimit: {{ .Values.jobs.engine_cleaner.history.success }}
33 failedJobsHistoryLimit: {{ .Values.jobs.engine_cleaner.history.failed }}
34 {{- if .Values.jobs.engine_cleaner.starting_deadline }}
35 startingDeadlineSeconds: {{ .Values.jobs.engine_cleaner.starting_deadline }}
36 {{- end }}
37 concurrencyPolicy: Forbid
38 jobTemplate:
39 metadata:
40 labels:
41{{ tuple $envAll "heat" "engine-cleaner" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
42 annotations:
43{{ dict "envAll" $envAll "podName" "heat-engine-cleaner" "containerNames" (list "heat-engine-cleaner" "init" ) | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
44 spec:
45 template:
46 metadata:
47 labels:
48{{ tuple $envAll "heat" "engine-cleaner" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 12 }}
49 annotations:
50{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 12 }}
51 configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
52 configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
53{{ dict "envAll" $envAll "podName" "heat-engine-cleaner" "containerNames" (list "heat-engine-cleaner" "init" ) | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
54 spec:
Dong Ma4189c2b2025-02-10 11:24:08 +000055{{ with .Values.pod.priorityClassName.heat_engine_cleaner }}
56 priorityClassName: {{ . }}
57{{ end }}
58{{ with .Values.pod.runtimeClassName.heat_engine_cleaner }}
59 runtimeClassName: {{ . }}
60{{ end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050061 serviceAccountName: {{ $serviceAccountName }}
62{{ dict "envAll" $envAll "application" "engine_cleaner" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 10 }}
63 restartPolicy: OnFailure
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000064{{ if $envAll.Values.pod.tolerations.heat.enabled }}
65{{ tuple $envAll "heat" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 10 }}
66{{ end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050067 nodeSelector:
68 {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }}
69 initContainers:
70{{ tuple $envAll "engine_cleaner" $mounts_heat_engine_cleaner_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 12 }}
71 containers:
72 - name: heat-engine-cleaner
73{{ tuple $envAll "heat_engine_cleaner" | include "helm-toolkit.snippets.image" | indent 14 }}
74{{ tuple $envAll $envAll.Values.pod.resources.jobs.engine_cleaner | include "helm-toolkit.snippets.kubernetes_resources" | indent 14 }}
75{{ dict "envAll" $envAll "application" "engine_cleaner" "container" "heat_engine_cleaner" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 14 }}
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000076{{- if or .Values.manifests.certificates .Values.tls.identity }}
77 env:
78 - name: REQUESTS_CA_BUNDLE
79 value: "/etc/heat/certs/ca.crt"
80{{- end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050081 command:
82 - /tmp/heat-engine-cleaner.sh
83 volumeMounts:
84 - name: pod-tmp
85 mountPath: /tmp
86 - name: heat-bin
87 mountPath: /tmp/heat-engine-cleaner.sh
88 subPath: heat-engine-cleaner.sh
89 readOnly: true
90 - name: etcheat
91 mountPath: /etc/heat
92 - name: heat-etc
93 mountPath: /etc/heat/heat.conf
94 subPath: heat.conf
95 readOnly: true
96 {{ if .Values.conf.heat.DEFAULT.log_config_append }}
97 - name: heat-etc
98 mountPath: {{ .Values.conf.heat.DEFAULT.log_config_append }}
99 subPath: {{ base .Values.conf.heat.DEFAULT.log_config_append }}
100 readOnly: true
101 {{ end }}
Mohammed Naserbcdd25c2023-01-18 03:38:47 +0000102{{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.orchestration.api.internal "path" "/etc/heat/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 14 }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500103{{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_db.auth.admin.secret.tls.internal "path" "/etc/mysql/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 14 }}
104{{ if $mounts_heat_engine_cleaner.volumeMounts }}{{ toYaml $mounts_heat_engine_cleaner.volumeMounts | indent 14 }}{{ end }}
105 volumes:
106 - name: pod-tmp
107 emptyDir: {}
108 - name: etcheat
109 emptyDir: {}
110 - name: heat-etc
111 secret:
112 secretName: heat-etc
113 defaultMode: 0444
Mohammed Naserbcdd25c2023-01-18 03:38:47 +0000114{{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.orchestration.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 12 }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500115{{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 12 }}
116 - name: heat-bin
117 configMap:
118 name: heat-bin
119 defaultMode: 0555
120{{ if $mounts_heat_engine_cleaner.volumes }}{{ toYaml $mounts_heat_engine_cleaner.volumes | indent 12 }}{{ end }}
121{{- end }}