blob: 1e5cbbacc612193472df437d87b0da27635674c5 [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_barbican_api := .Values.pod.mounts.barbican_api.barbican_api }}
19{{- $mounts_barbican_api_init := .Values.pod.mounts.barbican_api.init_container }}
20
21{{- $serviceAccountName := "barbican-api" }}
22{{ tuple $envAll "api" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
23---
24apiVersion: apps/v1
25kind: Deployment
26metadata:
27 name: barbican-api
28 annotations:
29 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
30 labels:
31{{ tuple $envAll "barbican" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
32spec:
33 replicas: {{ .Values.pod.replicas.api }}
34 selector:
35 matchLabels:
36{{ tuple $envAll "barbican" "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 "barbican" "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" }}
Rico Linf19da962024-04-20 03:13:27 +080046{{ tuple "barbican_api" . | include "helm-toolkit.snippets.custom_pod_annotations" | indent 8 }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050047{{ dict "envAll" $envAll "podName" "barbican-api" "containerNames" (list "init" "barbican-api") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
48 spec:
49{{ dict "envAll" $envAll "application" "barbican" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
Dong Ma1da7eca2025-02-10 06:32:12 +000050{{ with .Values.pod.priorityClassName.barbican_api }}
51 priorityClassName: {{ . }}
52{{ end }}
53{{ with .Values.pod.runtimeClassName.barbican_api }}
54 runtimeClassName: {{ . }}
55{{ end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050056 serviceAccountName: {{ $serviceAccountName }}
57 affinity:
58{{ tuple $envAll "barbican" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
59 nodeSelector:
60 {{ .Values.labels.api.node_selector_key }}: {{ .Values.labels.api.node_selector_value }}
61{{ if $envAll.Values.pod.tolerations.barbican.enabled }}
62{{ tuple $envAll "barbican" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }}
63{{ end }}
64 initContainers:
65{{ tuple $envAll "api" $mounts_barbican_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
66 containers:
67 - name: barbican-api
68{{ tuple $envAll "barbican_api" | include "helm-toolkit.snippets.image" | indent 10 }}
69{{ tuple $envAll $envAll.Values.pod.resources.api | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
70{{ dict "envAll" $envAll "application" "barbican" "container" "barbican_api" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
71 command:
72 - /tmp/barbican.sh
73 - start
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010074 env:
75{{- if or .Values.manifests.certificates .Values.tls.identity }}
76 - name: REQUESTS_CA_BUNDLE
77 value: "/etc/barbican/certs/ca.crt"
78{{- end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050079 lifecycle:
80 preStop:
81 exec:
82 command:
83 - /tmp/barbican.sh
84 - stop
85 ports:
86 - name: b-api
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010087 containerPort: {{ tuple "key_manager" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050088 readinessProbe:
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010089 httpGet:
90 scheme: HTTP
91 path: /
92 port: {{ tuple "key_manager" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050093 volumeMounts:
94 - name: pod-tmp
95 mountPath: /tmp
96 - name: etcbarbican
97 mountPath: /etc/barbican
98 - name: barbican-etc
Rico Lin36e65de2024-04-22 00:08:06 +080099 mountPath: /etc/barbican/barbican-api-uwsgi.ini
100 subPath: barbican-api-uwsgi.ini
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500101 readOnly: true
102 - name: barbican-etc
103 mountPath: /etc/barbican/barbican.conf
104 subPath: barbican.conf
105 readOnly: true
106 {{- if .Values.conf.barbican.DEFAULT.log_config_append }}
107 - name: barbican-etc
108 mountPath: {{ .Values.conf.barbican.DEFAULT.log_config_append }}
109 subPath: {{ base .Values.conf.barbican.DEFAULT.log_config_append }}
110 readOnly: true
111 {{- end }}
112 - name: barbican-etc
113 mountPath: /etc/barbican/api_audit_map.conf
114 subPath: api_audit_map.conf
115 readOnly: true
116 - name: barbican-etc
117 mountPath: /etc/barbican/barbican-api-paste.ini
118 subPath: barbican-api-paste.ini
119 readOnly: true
120 - name: barbican-etc
121 mountPath: /etc/barbican/policy.yaml
122 subPath: policy.yaml
123 readOnly: true
124 - name: barbican-bin
125 mountPath: /tmp/barbican.sh
126 subPath: barbican.sh
127 readOnly: true
Rico Linf19da962024-04-20 03:13:27 +0800128{{- dict "enabled" .Values.tls.oslo_db "name" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal "path" "/etc/mysql/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }}
129{{- dict "enabled" .Values.tls.identity "name" .Values.secrets.tls.key_manager.api.internal "path" "/etc/barbican/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }}
130{{- dict "enabled" $envAll.Values.tls.oslo_messaging "name" $envAll.Values.endpoints.oslo_messaging.auth.admin.secret.tls.internal "path" "/etc/rabbitmq/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }}
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +0100131
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500132{{ if $mounts_barbican_api.volumeMounts }}{{ toYaml $mounts_barbican_api.volumeMounts | indent 12 }}{{ end }}
133 volumes:
134 - name: pod-tmp
135 emptyDir: {}
136 - name: etcbarbican
137 emptyDir: {}
138 - name: barbican-etc
139 secret:
140 secretName: barbican-etc
141 defaultMode: 0444
142 - name: barbican-bin
143 configMap:
144 name: barbican-bin
145 defaultMode: 0555
Rico Linf19da962024-04-20 03:13:27 +0800146{{- dict "enabled" .Values.tls.oslo_db "name" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
147{{- dict "enabled" .Values.tls.identity "name" .Values.secrets.tls.key_manager.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
148{{- dict "enabled" $envAll.Values.tls.oslo_messaging "name" $envAll.Values.endpoints.oslo_messaging.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +0100149
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500150{{ if $mounts_barbican_api.volumes }}{{ toYaml $mounts_barbican_api.volumes | indent 8 }}{{ end }}
151{{- end }}