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_api }} |
| 16 | {{- $envAll := . }} |
| 17 | |
| 18 | {{- $mounts_senlin_api := .Values.pod.mounts.senlin_api.senlin_api }} |
| 19 | {{- $mounts_senlin_api_init := .Values.pod.mounts.senlin_api.init_container }} |
| 20 | |
| 21 | {{- $serviceAccountName := "senlin-api" }} |
| 22 | {{ tuple $envAll "api" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} |
| 23 | --- |
| 24 | apiVersion: apps/v1 |
| 25 | kind: Deployment |
| 26 | metadata: |
| 27 | name: senlin-api |
| 28 | annotations: |
| 29 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} |
| 30 | labels: |
| 31 | {{ tuple $envAll "senlin" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} |
| 32 | spec: |
| 33 | replicas: {{ .Values.pod.replicas.api }} |
| 34 | selector: |
| 35 | matchLabels: |
| 36 | {{ tuple $envAll "senlin" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} |
| 37 | {{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }} |
| 38 | template: |
| 39 | metadata: |
| 40 | labels: |
| 41 | {{ tuple $envAll "senlin" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} |
| 42 | annotations: |
| 43 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }} |
| 44 | configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} |
| 45 | configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} |
| 46 | spec: |
| 47 | serviceAccountName: {{ $serviceAccountName }} |
| 48 | affinity: |
| 49 | {{ tuple $envAll "senlin" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} |
| 50 | nodeSelector: |
| 51 | {{ .Values.labels.api.node_selector_key }}: {{ .Values.labels.api.node_selector_value }} |
| 52 | terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.api.timeout | default "30" }} |
| 53 | initContainers: |
| 54 | {{ tuple $envAll "api" $mounts_senlin_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} |
| 55 | containers: |
| 56 | - name: senlin-api |
| 57 | {{ tuple $envAll "senlin_api" | include "helm-toolkit.snippets.image" | indent 10 }} |
| 58 | {{ tuple $envAll $envAll.Values.pod.resources.api | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} |
| 59 | securityContext: |
| 60 | runAsUser: {{ .Values.pod.user.senlin.uid }} |
| 61 | command: |
| 62 | - /tmp/senlin-api.sh |
| 63 | - start |
| 64 | lifecycle: |
| 65 | preStop: |
| 66 | exec: |
| 67 | command: |
| 68 | - /tmp/senlin-api.sh |
| 69 | - stop |
| 70 | ports: |
| 71 | - name: s-api |
| 72 | containerPort: {{ tuple "clustering" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} |
| 73 | readinessProbe: |
| 74 | httpGet: |
| 75 | scheme: HTTP |
| 76 | path: / |
| 77 | port: {{ tuple "clustering" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} |
Oleksandr Kozachenko | 42cd761 | 2023-10-20 15:36:38 +0200 | [diff] [blame] | 78 | initialDelaySeconds: 5 |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 79 | periodSeconds: 10 |
| 80 | volumeMounts: |
| 81 | - name: pod-tmp |
| 82 | mountPath: /tmp |
| 83 | - name: senlin-bin |
| 84 | mountPath: /tmp/senlin-api.sh |
| 85 | subPath: senlin-api.sh |
| 86 | readOnly: true |
| 87 | - name: pod-etc-senlin |
| 88 | mountPath: /etc/senlin |
| 89 | - name: pod-var-cache-senlin |
| 90 | mountPath: /var/cache/senlin |
| 91 | - name: senlin-etc |
Oleksandr Kozachenko | 42cd761 | 2023-10-20 15:36:38 +0200 | [diff] [blame] | 92 | mountPath: /etc/senlin/senlin-api-uwsgi.ini |
| 93 | subPath: senlin-api-uwsgi.ini |
| 94 | readOnly: true |
| 95 | - name: senlin-etc |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 96 | mountPath: /etc/senlin/senlin.conf |
| 97 | subPath: senlin.conf |
| 98 | readOnly: true |
| 99 | {{- if .Values.conf.senlin.DEFAULT.log_config_append }} |
| 100 | - name: senlin-etc |
| 101 | mountPath: {{ .Values.conf.senlin.DEFAULT.log_config_append }} |
| 102 | subPath: {{ base .Values.conf.senlin.DEFAULT.log_config_append }} |
| 103 | readOnly: true |
| 104 | {{- end }} |
| 105 | - name: senlin-etc |
| 106 | mountPath: /etc/senlin/api-paste.ini |
| 107 | subPath: api-paste.ini |
| 108 | readOnly: true |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 109 | - name: senlin-etc |
| 110 | mountPath: /etc/senlin/policy.yaml |
| 111 | subPath: policy.yaml |
| 112 | readOnly: true |
| 113 | {{ if $mounts_senlin_api.volumeMounts }}{{ toYaml $mounts_senlin_api.volumeMounts | indent 12 }}{{ end }} |
| 114 | volumes: |
| 115 | - name: pod-tmp |
| 116 | emptyDir: {} |
| 117 | - name: pod-etc-senlin |
| 118 | emptyDir: {} |
| 119 | - name: pod-var-cache-senlin |
| 120 | emptyDir: {} |
| 121 | - name: senlin-bin |
| 122 | configMap: |
| 123 | name: senlin-bin |
| 124 | defaultMode: 0555 |
| 125 | - name: senlin-etc |
| 126 | secret: |
| 127 | secretName: senlin-etc |
| 128 | defaultMode: 0444 |
| 129 | {{ if $mounts_senlin_api.volumes }}{{ toYaml $mounts_senlin_api.volumes | indent 8 }}{{ end }} |
| 130 | {{- end }} |