blob: 720a4bac2007ec4c43de452022b4681bea747c2d [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:
Dong Ma7fa5c2a2025-02-10 15:37:34 +000047{{ with .Values.pod.priorityClassName.magnum_api }}
48 priorityClassName: {{ . }}
49{{ end }}
50{{ with .Values.pod.runtimeClassName.magnum_api }}
51 runtimeClassName: {{ . }}
52{{ end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050053 serviceAccountName: {{ $serviceAccountName }}
54 affinity:
55{{ tuple $envAll "magnum" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
56 nodeSelector:
57 {{ .Values.labels.api.node_selector_key }}: {{ .Values.labels.api.node_selector_value }}
58 terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.api.timeout | default "30" }}
59 initContainers:
60{{ tuple $envAll "api" $mounts_magnum_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
61 containers:
62 - name: magnum-api
63{{ tuple $envAll "magnum_api" | include "helm-toolkit.snippets.image" | indent 10 }}
64{{ tuple $envAll $envAll.Values.pod.resources.api | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
65 securityContext:
66 runAsUser: {{ .Values.pod.user.magnum.uid }}
67 command:
68 - /tmp/magnum-api.sh
69 - start
70 lifecycle:
71 preStop:
72 exec:
73 command:
74 - /tmp/magnum-api.sh
75 - stop
76 ports:
77 - name: m-api
78 containerPort: {{ tuple "container-infra" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
79 readinessProbe:
80 httpGet:
81 scheme: HTTP
82 path: /
83 port: {{ tuple "container-infra" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
Oleksandr Kozachenko878891e2023-10-04 17:36:30 +020084 initialDelaySeconds: 5
Mohammed Naserf3f59a72023-01-15 21:02:04 -050085 periodSeconds: 10
86 volumeMounts:
87 - name: pod-tmp
88 mountPath: /tmp
89 - name: magnum-bin
90 mountPath: /tmp/magnum-api.sh
91 subPath: magnum-api.sh
92 readOnly: true
93 - name: pod-etc-magnum
94 mountPath: /etc/magnum
95 - name: pod-var-cache-magnum
96 mountPath: /var/cache/magnum
97 - name: magnum-etc
98 mountPath: /etc/magnum/magnum.conf
99 subPath: magnum.conf
100 readOnly: true
Oleksandr Kozachenko878891e2023-10-04 17:36:30 +0200101 - name: magnum-etc
102 mountPath: /etc/magnum/magnum-api-uwsgi.ini
103 subPath: magnum-api-uwsgi.ini
104 readOnly: true
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500105 {{- if .Values.conf.magnum.DEFAULT.log_config_append }}
106 - name: magnum-etc
107 mountPath: {{ .Values.conf.magnum.DEFAULT.log_config_append }}
108 subPath: {{ base .Values.conf.magnum.DEFAULT.log_config_append }}
109 readOnly: true
110 {{- end }}
111 - name: magnum-etc
112 mountPath: /etc/magnum/api-paste.ini
113 subPath: api-paste.ini
114 readOnly: true
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500115 - name: magnum-etc
116 mountPath: /etc/magnum/policy.yaml
117 subPath: policy.yaml
118 readOnly: true
119 - name: magnum-lock-path
120 mountPath: {{ .Values.conf.magnum.oslo_concurrency.lock_path }}
121{{ if $mounts_magnum_api.volumeMounts }}{{ toYaml $mounts_magnum_api.volumeMounts | indent 12 }}{{ end }}
122 volumes:
123 - name: pod-tmp
124 emptyDir: {}
125 - name: pod-etc-magnum
126 emptyDir: {}
127 - name: pod-var-cache-magnum
128 emptyDir: {}
129 - name: magnum-bin
130 configMap:
131 name: magnum-bin
132 defaultMode: 0555
133 - name: magnum-etc
134 secret:
135 secretName: magnum-etc
136 defaultMode: 0444
137 - name: magnum-lock-path
138 emptyDir: {}
139{{ if $mounts_magnum_api.volumes }}{{ toYaml $mounts_magnum_api.volumes | indent 8 }}{{ end }}
140{{- end }}