blob: ac6c636e3c3ae975af7bb12db139de542a3288dc [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
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000015{{- if (.Values.global).subchart_release_name }}
16{{- $_ := set . "deployment_name" .Chart.Name }}
17{{- else }}
18{{- $_ := set . "deployment_name" .Release.Name }}
19{{- end }}
20
Mohammed Naserf3f59a72023-01-15 21:02:04 -050021{{- if .Values.manifests.pod_rally_test }}
22{{- $envAll := . }}
23
24{{- $mounts_tests := .Values.pod.mounts.heat_tests.heat_tests }}
25{{- $mounts_tests_init := .Values.pod.mounts.heat_tests.init_container }}
26
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000027{{- $serviceAccountName := print $envAll.deployment_name "-test" }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050028{{ tuple $envAll "tests" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
29---
30apiVersion: v1
31kind: Pod
32metadata:
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000033 name: {{ print $envAll.deployment_name "-test" }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050034 labels:
35{{ tuple $envAll "heat" "test" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
36 annotations:
37 "helm.sh/hook": test-success
38 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
39spec:
40 nodeSelector:
41 {{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000042{{ if $envAll.Values.pod.tolerations.heat.enabled }}
43{{ tuple $envAll "heat" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 2 }}
44{{ end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050045 restartPolicy: Never
46 serviceAccountName: {{ $serviceAccountName }}
47 initContainers:
48{{ tuple $envAll "tests" $mounts_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000049 - name: {{ .deployment_name }}-test-ks-user
Mohammed Naserf3f59a72023-01-15 21:02:04 -050050{{ tuple $envAll "ks_user" | include "helm-toolkit.snippets.image" | indent 6 }}
51{{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_user | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
52 command:
53 - /tmp/ks-user.sh
54 volumeMounts:
55 - name: pod-tmp
56 mountPath: /tmp
57 - name: heat-bin
58 mountPath: /tmp/ks-user.sh
59 subPath: ks-user.sh
60 readOnly: true
61{{- dict "enabled" .Values.manifests.certificates "name" $envAll.Values.secrets.tls.orchestration.api.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }}
62 env:
63{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" .Values.manifests.certificates }}
64{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
65{{- end }}
66 - name: SERVICE_OS_SERVICE_NAME
67 value: "test"
68{{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }}
69{{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }}
70{{- end }}
71 - name: SERVICE_OS_ROLE
72 value: {{ .Values.endpoints.identity.auth.test.role | quote }}
73 containers:
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000074 - name: {{ .deployment_name }}-test
Mohammed Naserf3f59a72023-01-15 21:02:04 -050075{{ tuple $envAll "test" | include "helm-toolkit.snippets.image" | indent 6 }}
76{{ tuple $envAll $envAll.Values.pod.resources.jobs.tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
77 env:
78{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" .Values.manifests.certificates }}
79{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
80{{- end }}
81{{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }}
82{{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }}
83{{- end }}
84 - name: RALLY_ENV_NAME
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000085 value: {{.deployment_name}}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050086 command:
87 - /tmp/rally-test.sh
88 volumeMounts:
89 - name: pod-tmp
90 mountPath: /tmp
91 - name: heat-etc
92 mountPath: /etc/rally/rally_tests.yaml
93 subPath: rally_tests.yaml
94 readOnly: true
95 - name: heat-bin
96 mountPath: /tmp/rally-test.sh
97 subPath: rally-test.sh
98 readOnly: true
99 - name: rally-db
100 mountPath: /var/lib/rally
101 {{- range $key, $value := $envAll.Values.conf.rally_tests.templates }}
102 - name: heat-etc
103 mountPath: {{ $value.name }}
104 subPath: {{ printf "test_template_%d" $key }}
105 readOnly: true
106 {{- end }}
107{{- dict "enabled" .Values.manifests.certificates "name" $envAll.Values.secrets.tls.orchestration.api.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }}
108{{ if $mounts_tests.volumeMounts }}{{ toYaml $mounts_tests.volumeMounts | indent 8 }}{{ end }}
109 volumes:
110 - name: pod-tmp
111 emptyDir: {}
112 - name: heat-etc
113 secret:
114 secretName: heat-etc
115 defaultMode: 0444
116 - name: heat-bin
117 configMap:
118 name: heat-bin
119 defaultMode: 0555
120 - name: rally-db
121 emptyDir: {}
122{{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.secrets.tls.orchestration.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 4 }}
123{{ if $mounts_tests.volumes }}{{ toYaml $mounts_tests.volumes | indent 4 }}{{ end }}
124{{- end }}