Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 1 | {{/* |
| 2 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | you may not use this file except in compliance with the License. |
| 4 | You may obtain a copy of the License at |
| 5 | |
| 6 | http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | |
| 8 | Unless required by applicable law or agreed to in writing, software |
| 9 | distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | See the License for the specific language governing permissions and |
| 12 | limitations 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 Kozachenko | a10d785 | 2023-02-02 22:01:16 +0100 | [diff] [blame] | 21 | apiVersion: batch/v1 |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 22 | kind: CronJob |
| 23 | metadata: |
| 24 | name: nova-cell-setup |
| 25 | annotations: |
| 26 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} |
| 27 | spec: |
| 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 Ma | bb1ef1f | 2025-02-11 16:47:00 +0000 | [diff] [blame] | 45 | {{ with .Values.pod.priorityClassName.nova_cell_setup }} |
| 46 | priorityClassName: {{ . }} |
| 47 | {{ end }} |
| 48 | {{ with .Values.pod.runtimeClassName.nova_cell_setup }} |
| 49 | runtimeClassName: {{ . }} |
| 50 | {{ end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 51 | 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 Kozachenko | a10d785 | 2023-02-02 22:01:16 +0100 | [diff] [blame] | 56 | {{ if $envAll.Values.pod.tolerations.nova.enabled }} |
| 57 | {{ tuple $envAll "nova" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 10 }} |
| 58 | {{ end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 59 | 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 Kozachenko | a10d785 | 2023-02-02 22:01:16 +0100 | [diff] [blame] | 68 | {{- 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 Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 73 | 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 Kozachenko | a10d785 | 2023-02-02 22:01:16 +0100 | [diff] [blame] | 96 | {{- 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 Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 97 | {{- 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 Kozachenko | a10d785 | 2023-02-02 22:01:16 +0100 | [diff] [blame] | 98 | |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 99 | 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 Kozachenko | a10d785 | 2023-02-02 22:01:16 +0100 | [diff] [blame] | 112 | {{- 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 Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 113 | {{- dict "enabled" .Values.manifests.certificates "name" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 12 }} |
Oleksandr Kozachenko | a10d785 | 2023-02-02 22:01:16 +0100 | [diff] [blame] | 114 | |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 115 | {{- end }} |