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.job_db_sync }} |
| 16 | {{- $envAll := . }} |
| 17 | |
| 18 | {{- $mounts_horizon_db_sync := .Values.pod.mounts.horizon_db_sync.horizon_db_sync }} |
| 19 | {{- $mounts_horizon_db_sync_init := .Values.pod.mounts.horizon_db_sync.init_container }} |
| 20 | |
| 21 | {{- $serviceAccountName := "horizon-db-sync" }} |
| 22 | {{ tuple $envAll "db_sync" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} |
| 23 | --- |
| 24 | apiVersion: batch/v1 |
| 25 | kind: Job |
| 26 | metadata: |
| 27 | name: horizon-db-sync |
| 28 | labels: |
| 29 | {{ tuple $envAll "horizon" "db-sync" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} |
| 30 | annotations: |
| 31 | {{- if .Values.helm3_hook }} |
| 32 | helm.sh/hook: post-install,post-upgrade |
| 33 | helm.sh/hook-weight: "-4" |
| 34 | {{- end }} |
| 35 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} |
| 36 | spec: |
| 37 | template: |
| 38 | metadata: |
| 39 | labels: |
| 40 | {{ tuple $envAll "horizon" "db-sync" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} |
| 41 | annotations: |
| 42 | {{ dict "envAll" $envAll "podName" "horizon-db-sync" "containerNames" (list "horizon-db-sync" "init" ) | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} |
| 43 | spec: |
Dong Ma | 6be0a48 | 2025-02-10 13:14:30 +0000 | [diff] [blame] | 44 | {{ with .Values.pod.priorityClassName.db_sync }} |
| 45 | priorityClassName: {{ . }} |
| 46 | {{ end }} |
| 47 | {{ with .Values.pod.runtimeClassName.db_sync }} |
| 48 | runtimeClassName: {{ . }} |
| 49 | {{ end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 50 | serviceAccountName: {{ $serviceAccountName }} |
| 51 | {{ dict "envAll" $envAll "application" "db_sync" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} |
| 52 | restartPolicy: OnFailure |
| 53 | nodeSelector: |
| 54 | {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} |
| 55 | {{ if $envAll.Values.pod.tolerations.horizon.enabled }} |
| 56 | {{ tuple $envAll "horizon" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }} |
| 57 | {{ end }} |
| 58 | initContainers: |
| 59 | {{ tuple $envAll "db_sync" $mounts_horizon_db_sync_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} |
| 60 | containers: |
| 61 | - name: horizon-db-sync |
| 62 | {{ tuple $envAll "horizon_db_sync" | include "helm-toolkit.snippets.image" | indent 10 }} |
| 63 | {{ tuple $envAll $envAll.Values.pod.resources.jobs.db_sync | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} |
| 64 | {{ dict "envAll" $envAll "application" "db_sync" "container" "horizon_db_sync" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} |
| 65 | command: |
| 66 | - /tmp/db-sync.sh |
| 67 | volumeMounts: |
| 68 | - name: horizon-etc |
| 69 | mountPath: /etc/openstack-dashboard/local_settings |
| 70 | subPath: local_settings |
| 71 | readOnly: true |
| 72 | - name: horizon-bin |
| 73 | mountPath: /tmp/db-sync.sh |
| 74 | subPath: db-sync.sh |
| 75 | readOnly: true |
| 76 | - name: horizon-bin |
| 77 | mountPath: /tmp/manage.py |
| 78 | subPath: manage.py |
| 79 | readOnly: true |
| 80 | {{- 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 10 }} |
| 81 | {{ if $mounts_horizon_db_sync.volumeMounts }}{{ toYaml $mounts_horizon_db_sync.volumeMounts | indent 10 }}{{ end }} |
| 82 | volumes: |
| 83 | - name: horizon-etc |
| 84 | secret: |
| 85 | secretName: horizon-etc |
| 86 | defaultMode: 0444 |
| 87 | - name: horizon-bin |
| 88 | configMap: |
| 89 | name: horizon-bin |
| 90 | defaultMode: 0555 |
| 91 | {{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 6 }} |
| 92 | {{ if $mounts_horizon_db_sync.volumes }}{{ toYaml $mounts_horizon_db_sync.volumes | indent 6 }}{{ end }} |
| 93 | {{- end }} |