blob: 783d328b842168fdbc5a842b5f86259b48bcbad9 [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.pod_test }}
16{{- $envAll := . }}
17{{- $dependencies := .Values.dependencies.static.tests }}
18
19{{- $mounts_barbican_tests := .Values.pod.mounts.barbican_tests.barbican_tests }}
20{{- $mounts_barbican_tests_init := .Values.pod.mounts.barbican_tests.init_container }}
21
22{{- $serviceAccountName := print .Release.Name "-test" }}
23{{ tuple $envAll "tests" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
24---
25apiVersion: v1
26kind: Pod
27metadata:
28 name: "{{.Release.Name}}-test"
29 labels:
30{{ tuple $envAll "barbican" "test" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
31 annotations:
32 "helm.sh/hook": test-success
33 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
34{{ dict "envAll" $envAll "podName" "barbican-test" "containerNames" (list "init" "barbican-test") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 4 }}
35spec:
Dong Ma1da7eca2025-02-10 06:32:12 +000036{{ with .Values.pod.priorityClassName.barbican_tests }}
37 priorityClassName: {{ . }}
38{{ end }}
39{{ with .Values.pod.runtimeClassName.barbican_tests }}
40 runtimeClassName: {{ . }}
41{{ end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050042 serviceAccountName: {{ $serviceAccountName }}
43{{ dict "envAll" $envAll "application" "test" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 2 }}
44 nodeSelector:
45 {{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
46{{ if $envAll.Values.pod.tolerations.barbican.enabled }}
47{{ tuple $envAll "barbican" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 2 }}
48{{ end }}
49 restartPolicy: Never
50 initContainers:
51{{ tuple $envAll "tests" $mounts_barbican_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
52 containers:
53 - name: barbican-test
54{{ tuple $envAll "scripted_test" | include "helm-toolkit.snippets.image" | indent 6 }}
55{{ dict "envAll" $envAll "application" "test" "container" "barbican_test" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 6 }}
56 env:
57{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin }}
58{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
59{{- end }}
60 command:
61 - /tmp/barbican-test.sh
62 volumeMounts:
63 - name: pod-tmp
64 mountPath: /tmp
65 - name: barbican-bin
66 mountPath: /tmp/barbican-test.sh
67 subPath: barbican-test.sh
68 readOnly: true
69{{ if $mounts_barbican_tests.volumeMounts }}{{ toYaml $mounts_barbican_tests.volumeMounts | indent 8 }}{{ end }}
70 volumes:
71 - name: pod-tmp
72 emptyDir: {}
73 - name: barbican-bin
74 configMap:
75 name: barbican-bin
76 defaultMode: 0555
77{{ if $mounts_barbican_tests.volumes }}{{ toYaml $mounts_barbican_tests.volumes | indent 4 }}{{ end }}
78{{- end }}