blob: f41435640dc770956a0a8c70d5940758a5dc8b41 [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:
36 serviceAccountName: {{ $serviceAccountName }}
37{{ dict "envAll" $envAll "application" "test" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 2 }}
38 nodeSelector:
39 {{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
40{{ if $envAll.Values.pod.tolerations.barbican.enabled }}
41{{ tuple $envAll "barbican" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 2 }}
42{{ end }}
43 restartPolicy: Never
44 initContainers:
45{{ tuple $envAll "tests" $mounts_barbican_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
46 containers:
47 - name: barbican-test
48{{ tuple $envAll "scripted_test" | include "helm-toolkit.snippets.image" | indent 6 }}
49{{ dict "envAll" $envAll "application" "test" "container" "barbican_test" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 6 }}
50 env:
51{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin }}
52{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
53{{- end }}
54 command:
55 - /tmp/barbican-test.sh
56 volumeMounts:
57 - name: pod-tmp
58 mountPath: /tmp
59 - name: barbican-bin
60 mountPath: /tmp/barbican-test.sh
61 subPath: barbican-test.sh
62 readOnly: true
63{{ if $mounts_barbican_tests.volumeMounts }}{{ toYaml $mounts_barbican_tests.volumeMounts | indent 8 }}{{ end }}
64 volumes:
65 - name: pod-tmp
66 emptyDir: {}
67 - name: barbican-bin
68 configMap:
69 name: barbican-bin
70 defaultMode: 0555
71{{ if $mounts_barbican_tests.volumes }}{{ toYaml $mounts_barbican_tests.volumes | indent 4 }}{{ end }}
72{{- end }}