blob: 9eb4967f8cbd0ad4962b8fd8dd05d2d764fc0af7 [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_magnum_api := .Values.pod.mounts.magnum_api.magnum_api }}
19{{- $mounts_magnum_api_init := .Values.pod.mounts.magnum_api.init_container }}
20
21{{- $serviceAccountName := "magnum-api" }}
22{{ tuple $envAll "api" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
23---
24apiVersion: apps/v1
25kind: Deployment
26metadata:
27 name: magnum-api
28 annotations:
29 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
30 labels:
31{{ tuple $envAll "magnum" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
32spec:
33 replicas: {{ .Values.pod.replicas.api }}
34 selector:
35 matchLabels:
36{{ tuple $envAll "magnum" "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 "magnum" "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 "magnum" "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_magnum_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
55 containers:
56 - name: magnum-api
57{{ tuple $envAll "magnum_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.magnum.uid }}
61 command:
62 - /tmp/magnum-api.sh
63 - start
64 lifecycle:
65 preStop:
66 exec:
67 command:
68 - /tmp/magnum-api.sh
69 - stop
70 ports:
71 - name: m-api
72 containerPort: {{ tuple "container-infra" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
73 readinessProbe:
74 httpGet:
75 scheme: HTTP
76 path: /
77 port: {{ tuple "container-infra" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
Oleksandr Kozachenko878891e2023-10-04 17:36:30 +020078 initialDelaySeconds: 5
Mohammed Naserf3f59a72023-01-15 21:02:04 -050079 periodSeconds: 10
80 volumeMounts:
81 - name: pod-tmp
82 mountPath: /tmp
83 - name: magnum-bin
84 mountPath: /tmp/magnum-api.sh
85 subPath: magnum-api.sh
86 readOnly: true
87 - name: pod-etc-magnum
88 mountPath: /etc/magnum
89 - name: pod-var-cache-magnum
90 mountPath: /var/cache/magnum
91 - name: magnum-etc
92 mountPath: /etc/magnum/magnum.conf
93 subPath: magnum.conf
94 readOnly: true
Oleksandr Kozachenko878891e2023-10-04 17:36:30 +020095 - name: magnum-etc
96 mountPath: /etc/magnum/magnum-api-uwsgi.ini
97 subPath: magnum-api-uwsgi.ini
98 readOnly: true
Mohammed Naserf3f59a72023-01-15 21:02:04 -050099 {{- if .Values.conf.magnum.DEFAULT.log_config_append }}
100 - name: magnum-etc
101 mountPath: {{ .Values.conf.magnum.DEFAULT.log_config_append }}
102 subPath: {{ base .Values.conf.magnum.DEFAULT.log_config_append }}
103 readOnly: true
104 {{- end }}
105 - name: magnum-etc
106 mountPath: /etc/magnum/api-paste.ini
107 subPath: api-paste.ini
108 readOnly: true
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500109 - name: magnum-etc
110 mountPath: /etc/magnum/policy.yaml
111 subPath: policy.yaml
112 readOnly: true
113 - name: magnum-lock-path
114 mountPath: {{ .Values.conf.magnum.oslo_concurrency.lock_path }}
115{{ if $mounts_magnum_api.volumeMounts }}{{ toYaml $mounts_magnum_api.volumeMounts | indent 12 }}{{ end }}
116 volumes:
117 - name: pod-tmp
118 emptyDir: {}
119 - name: pod-etc-magnum
120 emptyDir: {}
121 - name: pod-var-cache-magnum
122 emptyDir: {}
123 - name: magnum-bin
124 configMap:
125 name: magnum-bin
126 defaultMode: 0555
127 - name: magnum-etc
128 secret:
129 secretName: magnum-etc
130 defaultMode: 0444
131 - name: magnum-lock-path
132 emptyDir: {}
133{{ if $mounts_magnum_api.volumes }}{{ toYaml $mounts_magnum_api.volumes | indent 8 }}{{ end }}
134{{- end }}