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.deployment_engine }} |
| 16 | {{- $envAll := . }} |
| 17 | |
| 18 | {{- $mounts_senlin_engine := .Values.pod.mounts.senlin_engine.senlin_engine }} |
| 19 | {{- $mounts_senlin_engine_init := .Values.pod.mounts.senlin_engine.init_container }} |
| 20 | |
| 21 | {{- $serviceAccountName := "senlin-engine" }} |
| 22 | {{ tuple $envAll "engine" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} |
| 23 | --- |
| 24 | apiVersion: apps/v1 |
| 25 | kind: Deployment |
| 26 | metadata: |
| 27 | name: senlin-engine |
| 28 | annotations: |
| 29 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} |
| 30 | labels: |
| 31 | {{ tuple $envAll "senlin" "engine" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} |
| 32 | spec: |
| 33 | replicas: {{ .Values.pod.replicas.engine }} |
| 34 | selector: |
| 35 | matchLabels: |
| 36 | {{ tuple $envAll "senlin" "engine" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} |
| 37 | template: |
| 38 | metadata: |
| 39 | labels: |
| 40 | {{ tuple $envAll "senlin" "engine" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} |
| 41 | annotations: |
| 42 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }} |
| 43 | configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} |
| 44 | configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} |
| 45 | spec: |
| 46 | serviceAccountName: {{ $serviceAccountName }} |
| 47 | affinity: |
| 48 | {{ tuple $envAll "senlin" "engine" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} |
| 49 | nodeSelector: |
| 50 | {{ .Values.labels.engine.node_selector_key }}: {{ .Values.labels.engine.node_selector_value }} |
| 51 | initContainers: |
| 52 | {{ tuple $envAll "engine" $mounts_senlin_engine_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} |
| 53 | containers: |
| 54 | - name: senlin-engine |
| 55 | {{ tuple $envAll "senlin_engine" | include "helm-toolkit.snippets.image" | indent 10 }} |
| 56 | {{ tuple $envAll $envAll.Values.pod.resources.engine | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} |
| 57 | securityContext: |
| 58 | runAsUser: {{ .Values.pod.user.senlin.uid }} |
| 59 | command: |
| 60 | - /tmp/senlin-engine.sh |
| 61 | volumeMounts: |
| 62 | - name: pod-tmp |
| 63 | mountPath: /tmp |
| 64 | - name: senlin-bin |
| 65 | mountPath: /tmp/senlin-engine.sh |
| 66 | subPath: senlin-engine.sh |
| 67 | readOnly: true |
| 68 | - name: pod-etc-senlin |
| 69 | mountPath: /etc/senlin |
| 70 | - name: senlin-etc |
| 71 | mountPath: /etc/senlin/senlin.conf |
| 72 | subPath: senlin.conf |
| 73 | readOnly: true |
| 74 | {{- if .Values.conf.senlin.DEFAULT.log_config_append }} |
| 75 | - name: senlin-etc |
| 76 | mountPath: {{ .Values.conf.senlin.DEFAULT.log_config_append }} |
| 77 | subPath: {{ base .Values.conf.senlin.DEFAULT.log_config_append }} |
| 78 | readOnly: true |
| 79 | {{- end }} |
| 80 | - name: senlin-etc |
| 81 | mountPath: /etc/senlin/policy.yaml |
| 82 | subPath: policy.yaml |
| 83 | readOnly: true |
| 84 | {{ if $mounts_senlin_engine.volumeMounts }}{{ toYaml $mounts_senlin_engine.volumeMounts | indent 12 }}{{ end }} |
| 85 | volumes: |
| 86 | - name: pod-tmp |
| 87 | emptyDir: {} |
| 88 | - name: pod-etc-senlin |
| 89 | emptyDir: {} |
| 90 | - name: senlin-bin |
| 91 | configMap: |
| 92 | name: senlin-bin |
| 93 | defaultMode: 0555 |
| 94 | - name: senlin-etc |
| 95 | secret: |
| 96 | secretName: senlin-etc |
| 97 | defaultMode: 0444 |
| 98 | {{ if $mounts_senlin_engine.volumes }}{{ toYaml $mounts_senlin_engine.volumes | indent 8 }}{{ end }} |
| 99 | {{- end }} |