blob: 3082216d110d7805f097a37ffeb18869a1922d57 [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:
50 serviceAccountName: {{ $serviceAccountName }}
51{{ dict "envAll" $envAll "application" "placement" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
52 affinity:
53{{ tuple $envAll "placement" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
54 nodeSelector:
55 {{ .Values.labels.api.node_selector_key }}: {{ .Values.labels.api.node_selector_value }}
56{{ if $envAll.Values.pod.tolerations.placement.enabled }}
57{{ tuple $envAll "placement" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }}
58{{ end }}
59 terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.api.timeout | default "30" }}
60 initContainers:
61{{ tuple $envAll "api" $mounts_placement_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
62 containers:
63 - name: placement-api
64{{ tuple $envAll "placement" | include "helm-toolkit.snippets.image" | indent 10 }}
65{{ tuple $envAll $envAll.Values.pod.resources.api | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
66{{ 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 +000067{{- if or .Values.manifests.certificates .Values.tls.identity }}
68 env:
69 - name: REQUESTS_CA_BUNDLE
70 value: "/etc/placement/certs/ca.crt"
71{{- end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050072 command:
73 - /tmp/placement-api.sh
74 - start
75 lifecycle:
76 preStop:
77 exec:
78 command:
79 - /tmp/placement-api.sh
80 - stop
81 ports:
82 - name: p-api
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000083 containerPort: {{ tuple "placement" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050084 readinessProbe:
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000085 httpGet:
86 scheme: {{ tuple "placement" "service" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" | upper }}
87 path: /
88 port: {{ tuple "placement" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
Oleksandr Kozachenko57dcd1e2023-10-04 17:34:56 +020089 initialDelaySeconds: 5
Mohammed Naserf3f59a72023-01-15 21:02:04 -050090 periodSeconds: 10
91 livenessProbe:
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000092 httpGet:
93 scheme: {{ tuple "placement" "service" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" | upper }}
94 path: /
95 port: {{ tuple "placement" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
Oleksandr Kozachenko57dcd1e2023-10-04 17:34:56 +020096 initialDelaySeconds: 5
Mohammed Naserf3f59a72023-01-15 21:02:04 -050097 periodSeconds: 10
98 volumeMounts:
99 - name: pod-tmp
100 mountPath: /tmp
101 - name: wsgi-placement
102 mountPath: /var/www/cgi-bin/placement
103 - name: placement-bin
104 mountPath: /tmp/placement-api.sh
105 subPath: placement-api.sh
106 readOnly: true
107 - name: placement-etc
108 mountPath: /etc/placement/placement.conf
109 subPath: placement.conf
110 readOnly: true
Oleksandr Kozachenko57dcd1e2023-10-04 17:34:56 +0200111 - name: placement-etc
112 mountPath: /etc/placement/placement-api-uwsgi.ini
113 subPath: placement-api-uwsgi.ini
114 readOnly: true
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500115 {{- if .Values.conf.placement.DEFAULT.log_config_append }}
116 - name: placement-etc
117 mountPath: {{ .Values.conf.placement.DEFAULT.log_config_append }}
118 subPath: {{ base .Values.conf.placement.DEFAULT.log_config_append }}
119 readOnly: true
120 {{- end }}
121 - name: placement-etc
122 mountPath: /etc/placement/policy.yaml
123 subPath: policy.yaml
124 readOnly: true
125 - name: placement-etc
126 mountPath: /etc/apache2/conf-enabled/wsgi-placement.conf
127 subPath: wsgi-placement.conf
128 readOnly: true
129{{- 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 +0000130{{- 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 -0500131{{ if $mounts_placement.volumeMounts }}{{ toYaml $mounts_placement.volumeMounts | indent 12 }}{{ end }}
132 volumes:
133 - name: pod-tmp
134 emptyDir: {}
135 - name: wsgi-placement
136 emptyDir: {}
137 - name: placement-bin
138 configMap:
139 name: placement-bin
140 defaultMode: 0555
141 - name: placement-etc
142 secret:
143 secretName: placement-etc
144 defaultMode: 0444
145{{- 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 +0000146{{- 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 -0500147{{ if $mounts_placement.volumes }}{{ toYaml $mounts_placement.volumes | indent 8 }}{{ end }}
148{{- end }}