blob: c5153043136e935f71165c0174b825de766bb799 [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_service_cleaner }}
16{{- $envAll := . }}
17
18{{- $serviceAccountName := "nova-service-cleaner" }}
19{{ tuple $envAll "service_cleaner" $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-service-cleaner
25 annotations:
26 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
27spec:
28 schedule: {{ .Values.jobs.service_cleaner.cron | quote }}
29 successfulJobsHistoryLimit: {{ .Values.jobs.service_cleaner.history.success }}
30 failedJobsHistoryLimit: {{ .Values.jobs.service_cleaner.history.failed }}
31 {{- if .Values.jobs.service_cleaner.starting_deadline }}
32 startingDeadlineSeconds: {{ .Values.jobs.service_cleaner.starting_deadline }}
33 {{- end }}
34 concurrencyPolicy: Forbid
35 jobTemplate:
36 metadata:
37 labels:
38{{ tuple $envAll "nova" "service-cleaner" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
39 spec:
40 template:
41 metadata:
42 labels:
43{{ tuple $envAll "nova" "service-cleaner" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 12 }}
44 spec:
Dong Mabb1ef1f2025-02-11 16:47:00 +000045{{ with .Values.pod.priorityClassName.nova_service_cleaner }}
46 priorityClassName: {{ . }}
47{{ end }}
48{{ with .Values.pod.runtimeClassName.nova_service_cleaner }}
49 runtimeClassName: {{ . }}
50{{ end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050051 serviceAccountName: {{ $serviceAccountName }}
52{{ dict "envAll" $envAll "application" "service_cleaner" | 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 "service_cleaner" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 12 }}
61 containers:
62 - name: nova-service-cleaner
63{{ tuple $envAll "nova_service_cleaner" | include "helm-toolkit.snippets.image" | indent 14 }}
64{{ tuple $envAll $envAll.Values.pod.resources.jobs.service_cleaner | include "helm-toolkit.snippets.kubernetes_resources" | indent 14 }}
65{{ dict "envAll" $envAll "application" "service_cleaner" "container" "nova_service_cleaner" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 14 }}
66 env:
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010067{{- with $env := dict "ksUserSecret" $envAll.Values.secrets.identity.nova "useCA" (or .Values.manifests.certificates .Values.tls.identity) }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050068{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 14 }}
69{{- end }}
70 command:
71 - /tmp/nova-service-cleaner.sh
72 volumeMounts:
73 - name: pod-tmp
74 mountPath: /tmp
75 - name: nova-bin
76 mountPath: /tmp/nova-service-cleaner.sh
77 subPath: nova-service-cleaner.sh
78 readOnly: true
79 - name: etcnova
80 mountPath: /etc/nova
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010081{{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.compute.osapi.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 16 }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050082 volumes:
83 - name: pod-tmp
84 emptyDir: {}
85 - name: etcnova
86 emptyDir: {}
87 - name: nova-etc
88 secret:
89 secretName: nova-etc
90 defaultMode: 0444
91 - name: nova-bin
92 configMap:
93 name: nova-bin
94 defaultMode: 0555
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010095{{- 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 -050096{{- end }}