blob: 99e25b65f29fd1d8739dc2a2e844ec5b536da3b0 [file] [log] [blame]
Mohammed Naser298f0272024-07-29 18:43:25 -04001{{/*
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_ironic_api := .Values.pod.mounts.ironic_api.ironic_api }}
19{{- $mounts_ironic_api_init := .Values.pod.mounts.ironic_api.init_container }}
20
21{{- $serviceAccountName := "ironic-api" }}
22{{ tuple $envAll "api" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
23---
24apiVersion: apps/v1
25kind: Deployment
26metadata:
27 name: ironic-api
28 annotations:
29 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
30 labels:
31{{ tuple $envAll "ironic" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
32spec:
33 replicas: {{ .Values.pod.replicas.api }}
34 selector:
35 matchLabels:
36{{ tuple $envAll "ironic" "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 "ironic" "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{{ tuple "ironic_api" . | include "helm-toolkit.snippets.custom_pod_annotations" | indent 8 }}
47 spec:
Dong Ma16a956a2025-02-10 13:28:41 +000048{{ with .Values.pod.priorityClassName.ironic_api }}
49 priorityClassName: {{ . }}
50{{ end }}
51{{ with .Values.pod.runtimeClassName.ironic_api }}
52 runtimeClassName: {{ . }}
53{{ end }}
Mohammed Naser298f0272024-07-29 18:43:25 -040054 serviceAccountName: {{ $serviceAccountName }}
55 affinity:
56{{ tuple $envAll "ironic" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
57 nodeSelector:
58 {{ .Values.labels.api.node_selector_key }}: {{ .Values.labels.api.node_selector_value }}
59{{ if $envAll.Values.pod.tolerations.ironic.enabled }}
60{{ tuple $envAll "ironic" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 10 }}
61{{ end }}
62 terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.api.timeout | default "30" }}
63 initContainers:
64{{ tuple $envAll "api" $mounts_ironic_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
65{{- if and (.Values.bootstrap.object_store.enabled) (.Values.bootstrap.object_store.openstack.enabled) }}
66 - name: ironic-retrive-swift-config
67{{ tuple $envAll "ironic_retrive_swift_config" | include "helm-toolkit.snippets.image" | indent 10 }}
68{{ tuple $envAll $envAll.Values.pod.resources.conductor | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
69 env:
70 - name: OS_SWIFT_API_VERSION
71 value: {{ .Values.conf.ironic.glance.swift_api_version | quote }}
72{{- with $env := dict "ksUserSecret" .Values.secrets.identity.glance }}
73{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 12 }}
74{{- end }}
75 command:
76 - /tmp/retreive-swift-config.sh
77 volumeMounts:
78 - name: pod-tmp
79 mountPath: /tmp
80 - name: ironic-bin
81 mountPath: /tmp/retreive-swift-config.sh
82 subPath: retreive-swift-config.sh
83 readOnly: true
84 - name: pod-shared
85 mountPath: /tmp/pod-shared
86{{- end }}
87{{- if and (.Values.bootstrap.network.enabled) (.Values.bootstrap.network.openstack.enabled) }}
88 - name: ironic-retrive-cleaning-net
89{{ tuple $envAll "ironic_retrive_cleaning_network" | include "helm-toolkit.snippets.image" | indent 10 }}
90{{ tuple $envAll $envAll.Values.pod.resources.conductor | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
91 env:
92{{- with $env := dict "ksUserSecret" .Values.secrets.identity.ironic }}
93{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 12 }}
94{{- end }}
95{{ include "helm-toolkit.utils.to_k8s_env_vars" $envAll.Values.network.pxe | indent 12 }}
96 command:
97 - /tmp/retreive-cleaning-network.sh
98 volumeMounts:
99 - name: pod-tmp
100 mountPath: /tmp
101 - name: ironic-bin
102 mountPath: /tmp/retreive-cleaning-network.sh
103 subPath: retreive-cleaning-network.sh
104 readOnly: true
105 - name: pod-shared
106 mountPath: /tmp/pod-shared
107{{- end }}
108 containers:
109 - name: ironic-api
110{{ tuple $envAll "ironic_api" | include "helm-toolkit.snippets.image" | indent 10 }}
111{{ tuple $envAll $envAll.Values.pod.resources.api | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
112 command:
113 - /tmp/ironic-api.sh
114 - start
115 lifecycle:
116 preStop:
117 exec:
118 command:
119 - /tmp/ironic-api.sh
120 - stop
121 ports:
122 - containerPort: {{ tuple "baremetal" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
123 readinessProbe:
124 httpGet:
125 scheme: {{ tuple "baremetal" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" | upper }}
126 path: /
127 port: {{ tuple "baremetal" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
128 volumeMounts:
129 - name: pod-tmp
130 mountPath: /tmp
131 - name: ironic-bin
132 mountPath: /tmp/ironic-api.sh
133 subPath: ironic-api.sh
134 readOnly: true
135 - name: ironic-etc
136 mountPath: /etc/ironic/ironic.conf
137 subPath: ironic.conf
138 readOnly: true
139 {{- if .Values.conf.ironic.DEFAULT.log_config_append }}
140 - name: ironic-etc
141 mountPath: {{ .Values.conf.ironic.DEFAULT.log_config_append }}
142 subPath: {{ base .Values.conf.ironic.DEFAULT.log_config_append }}
143 readOnly: true
144 {{- end }}
145 - name: ironic-etc
146 mountPath: /etc/ironic/policy.yaml
147 subPath: policy.yaml
148 readOnly: true
149 - name: pod-shared
150 mountPath: /tmp/pod-shared
151{{ if $mounts_ironic_api.volumeMounts }}{{ toYaml $mounts_ironic_api.volumeMounts | indent 12 }}{{ end }}
152 volumes:
153 - name: pod-tmp
154 emptyDir: {}
155 - name: ironic-bin
156 configMap:
157 name: ironic-bin
158 defaultMode: 0555
159 - name: ironic-etc
160 secret:
161 secretName: ironic-etc
162 defaultMode: 0444
163 - name: pod-shared
164 emptyDir: {}
165{{ if $mounts_ironic_api.volumes }}{{ toYaml $mounts_ironic_api.volumes | indent 8 }}{{ end }}
166{{- end }}