blob: 6c192eb836b110bd9c774efc3ca807c3af21da50 [file] [log] [blame]
Mohammed Naserf3f59a72023-01-15 21:02:04 -05001{{/*
2Licensed under the Apache License, Version 2.0 (the "License");
3you may not use this file except in compliance with the License.
4You may obtain a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8Unless required by applicable law or agreed to in writing, software
9distributed under the License is distributed on an "AS IS" BASIS,
10WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11See the License for the specific language governing permissions and
12limitations 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---
24apiVersion: apps/v1
25kind: Deployment
26metadata:
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 }}
32spec:
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 Kozachenko42cd7612023-10-20 15:36:38 +020078 initialDelaySeconds: 5
Mohammed Naserf3f59a72023-01-15 21:02:04 -050079 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 Kozachenko42cd7612023-10-20 15:36:38 +020092 mountPath: /etc/senlin/senlin-api-uwsgi.ini
93 subPath: senlin-api-uwsgi.ini
94 readOnly: true
95 - name: senlin-etc
Mohammed Naserf3f59a72023-01-15 21:02:04 -050096 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 Naserf3f59a72023-01-15 21:02:04 -0500109 - 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 }}