Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 1 | {{/* |
| 2 | Copyright 2019 Samsung Electronics Co., Ltd. |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */}} |
| 16 | |
| 17 | {{- if .Values.manifests.deployment_worker }} |
| 18 | {{- $envAll := . }} |
| 19 | |
| 20 | {{- $mounts_octavia_worker := .Values.pod.mounts.octavia_worker.octavia_worker }} |
| 21 | {{- $mounts_octavia_worker_init := .Values.pod.mounts.octavia_worker.init_container }} |
| 22 | |
| 23 | {{- $serviceAccountName := "octavia-worker" }} |
| 24 | {{ tuple $envAll "worker" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} |
| 25 | --- |
| 26 | apiVersion: apps/v1 |
| 27 | kind: Deployment |
| 28 | metadata: |
| 29 | name: octavia-worker |
| 30 | annotations: |
| 31 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} |
| 32 | labels: |
| 33 | {{ tuple $envAll "octavia" "worker" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} |
| 34 | spec: |
| 35 | replicas: {{ .Values.pod.replicas.worker }} |
| 36 | selector: |
| 37 | matchLabels: |
| 38 | {{ tuple $envAll "octavia" "worker" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} |
| 39 | {{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }} |
| 40 | template: |
| 41 | metadata: |
| 42 | labels: |
| 43 | {{ tuple $envAll "octavia" "worker" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} |
| 44 | annotations: |
| 45 | configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} |
| 46 | configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} |
| 47 | spec: |
| 48 | serviceAccountName: {{ $serviceAccountName }} |
| 49 | dnsPolicy: ClusterFirstWithHostNet |
| 50 | hostNetwork: true |
| 51 | affinity: |
| 52 | {{ tuple $envAll "octavia" "worker" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} |
| 53 | nodeSelector: |
| 54 | {{ .Values.labels.worker.node_selector_key }}: {{ .Values.labels.worker.node_selector_value }} |
| 55 | initContainers: |
| 56 | {{ tuple $envAll "worker" $mounts_octavia_worker_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} |
| 57 | containers: |
| 58 | - name: octavia-worker |
| 59 | {{ tuple $envAll "octavia_worker" | include "helm-toolkit.snippets.image" | indent 10 }} |
| 60 | {{ tuple $envAll $envAll.Values.pod.resources.worker | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} |
| 61 | securityContext: |
| 62 | runAsUser: {{ .Values.pod.user.octavia.uid }} |
| 63 | command: |
| 64 | - /tmp/octavia-worker.sh |
| 65 | - start |
| 66 | lifecycle: |
| 67 | preStop: |
| 68 | exec: |
| 69 | command: |
| 70 | - /tmp/octavia-worker.sh |
| 71 | - stop |
| 72 | volumeMounts: |
| 73 | - name: pod-etc-octavia |
| 74 | mountPath: /etc/octavia |
| 75 | - name: octavia-bin |
| 76 | mountPath: /tmp/octavia-worker.sh |
| 77 | subPath: octavia-worker.sh |
| 78 | readOnly: true |
| 79 | - name: octavia-etc |
| 80 | mountPath: /etc/octavia/octavia.conf |
| 81 | subPath: octavia.conf |
| 82 | readOnly: true |
| 83 | {{- if .Values.conf.octavia.DEFAULT.log_config_append }} |
| 84 | - name: octavia-etc |
| 85 | mountPath: {{ .Values.conf.octavia.DEFAULT.log_config_append }} |
| 86 | subPath: {{ base .Values.conf.octavia.DEFAULT.log_config_append }} |
| 87 | readOnly: true |
| 88 | {{- end }} |
| 89 | {{ if $mounts_octavia_worker.volumeMounts }}{{ toYaml $mounts_octavia_worker.volumeMounts | indent 12 }}{{ end }} |
| 90 | volumes: |
| 91 | - name: pod-etc-octavia |
| 92 | emptyDir: {} |
| 93 | - name: octavia-bin |
| 94 | configMap: |
| 95 | name: octavia-bin |
| 96 | defaultMode: 0555 |
| 97 | - name: octavia-etc |
| 98 | secret: |
| 99 | secretName: octavia-etc |
| 100 | defaultMode: 0444 |
| 101 | {{ if $mounts_octavia_worker.volumes }}{{ toYaml $mounts_octavia_worker.volumes | indent 8 }}{{ end }} |
| 102 | {{- end }} |