blob: da02d33bd5c0b64730691049fd4293ff4f7fff0d [file] [log] [blame]
Mohammed Naserf3f59a72023-01-15 21:02:04 -05001{{/*
2Copyright 2019 Intel Corporation.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
17{{- if .Values.manifests.deployment }}
18{{- $envAll := . }}
19
20{{- $mounts_placement := .Values.pod.mounts.placement.placement }}
21{{- $mounts_placement_init := .Values.pod.mounts.placement.init_container }}
22
23{{- $serviceAccountName := "placement-api" }}
24{{ tuple $envAll "api" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
25---
26apiVersion: apps/v1
27kind: Deployment
28metadata:
29 name: placement-api
30 annotations:
31 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
32 labels:
33{{ tuple $envAll "placement" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
34spec:
35 replicas: {{ .Values.pod.replicas.api }}
36 selector:
37 matchLabels:
38{{ tuple $envAll "placement" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
39{{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }}
40 template:
41 metadata:
42 labels:
43{{ tuple $envAll "placement" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
44 annotations:
45{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
46 configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
47 configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
48{{ dict "envAll" $envAll "podName" "placement-api" "containerNames" (list "placement-api" "init") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
49 spec:
Dong Mae11498d2025-02-12 03:36:18 +000050{{ with .Values.pod.priorityClassName.placement }}
51 priorityClassName: {{ . }}
52{{ end }}
53{{ with .Values.pod.runtimeClassName.placement }}
54 runtimeClassName: {{ . }}
55{{ end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050056 serviceAccountName: {{ $serviceAccountName }}
57{{ dict "envAll" $envAll "application" "placement" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
58 affinity:
59{{ tuple $envAll "placement" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
60 nodeSelector:
61 {{ .Values.labels.api.node_selector_key }}: {{ .Values.labels.api.node_selector_value }}
62{{ if $envAll.Values.pod.tolerations.placement.enabled }}
63{{ tuple $envAll "placement" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }}
64{{ end }}
65 terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.api.timeout | default "30" }}
66 initContainers:
67{{ tuple $envAll "api" $mounts_placement_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
68 containers:
69 - name: placement-api
70{{ tuple $envAll "placement" | include "helm-toolkit.snippets.image" | indent 10 }}
71{{ tuple $envAll $envAll.Values.pod.resources.api | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
72{{ dict "envAll" $envAll "application" "placement" "container" "placement_api" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000073{{- if or .Values.manifests.certificates .Values.tls.identity }}
74 env:
75 - name: REQUESTS_CA_BUNDLE
76 value: "/etc/placement/certs/ca.crt"
77{{- end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050078 command:
79 - /tmp/placement-api.sh
80 - start
81 lifecycle:
82 preStop:
83 exec:
84 command:
85 - /tmp/placement-api.sh
86 - stop
87 ports:
88 - name: p-api
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000089 containerPort: {{ tuple "placement" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050090 readinessProbe:
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000091 httpGet:
92 scheme: {{ tuple "placement" "service" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" | upper }}
93 path: /
94 port: {{ tuple "placement" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
Oleksandr Kozachenko57dcd1e2023-10-04 17:34:56 +020095 initialDelaySeconds: 5
Mohammed Naserf3f59a72023-01-15 21:02:04 -050096 periodSeconds: 10
97 livenessProbe:
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000098 httpGet:
99 scheme: {{ tuple "placement" "service" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" | upper }}
100 path: /
101 port: {{ tuple "placement" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
Oleksandr Kozachenko57dcd1e2023-10-04 17:34:56 +0200102 initialDelaySeconds: 5
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500103 periodSeconds: 10
104 volumeMounts:
105 - name: pod-tmp
106 mountPath: /tmp
107 - name: wsgi-placement
108 mountPath: /var/www/cgi-bin/placement
109 - name: placement-bin
110 mountPath: /tmp/placement-api.sh
111 subPath: placement-api.sh
112 readOnly: true
113 - name: placement-etc
114 mountPath: /etc/placement/placement.conf
115 subPath: placement.conf
116 readOnly: true
Oleksandr Kozachenko57dcd1e2023-10-04 17:34:56 +0200117 - name: placement-etc
118 mountPath: /etc/placement/placement-api-uwsgi.ini
119 subPath: placement-api-uwsgi.ini
120 readOnly: true
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500121 {{- if .Values.conf.placement.DEFAULT.log_config_append }}
122 - name: placement-etc
123 mountPath: {{ .Values.conf.placement.DEFAULT.log_config_append }}
124 subPath: {{ base .Values.conf.placement.DEFAULT.log_config_append }}
125 readOnly: true
126 {{- end }}
127 - name: placement-etc
128 mountPath: /etc/placement/policy.yaml
129 subPath: policy.yaml
130 readOnly: true
131 - name: placement-etc
132 mountPath: /etc/apache2/conf-enabled/wsgi-placement.conf
133 subPath: wsgi-placement.conf
134 readOnly: true
135{{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_db.auth.admin.secret.tls.internal "path" "/etc/mysql/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }}
Mohammed Naserbcdd25c2023-01-18 03:38:47 +0000136{{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.placement.api.internal "path" "/etc/placement/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500137{{ if $mounts_placement.volumeMounts }}{{ toYaml $mounts_placement.volumeMounts | indent 12 }}{{ end }}
138 volumes:
139 - name: pod-tmp
140 emptyDir: {}
141 - name: wsgi-placement
142 emptyDir: {}
143 - name: placement-bin
144 configMap:
145 name: placement-bin
146 defaultMode: 0555
147 - name: placement-etc
148 secret:
149 secretName: placement-etc
150 defaultMode: 0444
151{{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
Mohammed Naserbcdd25c2023-01-18 03:38:47 +0000152{{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.placement.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500153{{ if $mounts_placement.volumes }}{{ toYaml $mounts_placement.volumes | indent 8 }}{{ end }}
154{{- end }}