blob: 05a65cfd860a700eb01c7204af3c231f01bdba79 [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
18{{- $mounts_senlin_tests := .Values.pod.mounts.senlin_tests.senlin_tests }}
19{{- $mounts_senlin_tests_init := .Values.pod.mounts.senlin_tests.init_container }}
20
21{{- $serviceAccountName := print .Release.Name "-test" }}
22{{ tuple $envAll "tests" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
23---
24apiVersion: v1
25kind: Pod
26metadata:
27 name: "{{.Release.Name}}-test"
28 labels:
29{{ tuple $envAll "senlin" "test" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
30 annotations:
31 "helm.sh/hook": test-success
32 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
33spec:
34 serviceAccountName: {{ $serviceAccountName }}
35 nodeSelector:
36 {{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
37 restartPolicy: Never
38 initContainers:
39{{ tuple $envAll "tests" $mounts_senlin_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
40 containers:
41 - name: {{.Release.Name}}-senlin-test
42{{ tuple $envAll "scripted_test" | include "helm-toolkit.snippets.image" | indent 6 }}
43 env:
44{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin }}
45{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
46{{- end }}
47 command:
48 - /tmp/senlin-test.sh
49 volumeMounts:
50 - name: pod-tmp
51 mountPath: /tmp
52 - name: senlin-bin
53 mountPath: /tmp/senlin-test.sh
54 subPath: senlin-test.sh
55 readOnly: true
56{{ if $mounts_senlin_tests.volumeMounts }}{{ toYaml $mounts_senlin_tests.volumeMounts | indent 8 }}{{ end }}
57 volumes:
58 - name: pod-tmp
59 emptyDir: {}
60 - name: senlin-bin
61 configMap:
62 name: senlin-bin
63 defaultMode: 0555
64{{ if $mounts_senlin_tests.volumes }}{{ toYaml $mounts_senlin_tests.volumes | indent 4 }}{{ end }}
65{{- end }}