blob: 610048cf0566653cabd507434ca32b82953181f9 [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
Dong Ma4189c2b2025-02-10 11:24:08 +000046{{ with .Values.pod.priorityClassName.heat_tests }}
47 priorityClassName: {{ . }}
48{{ end }}
49{{ with .Values.pod.runtimeClassName.heat_tests }}
50 runtimeClassName: {{ . }}
51{{ end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050052 serviceAccountName: {{ $serviceAccountName }}
53 initContainers:
54{{ tuple $envAll "tests" $mounts_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000055 - name: {{ .deployment_name }}-test-ks-user
Mohammed Naserf3f59a72023-01-15 21:02:04 -050056{{ tuple $envAll "ks_user" | include "helm-toolkit.snippets.image" | indent 6 }}
57{{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_user | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
58 command:
59 - /tmp/ks-user.sh
60 volumeMounts:
61 - name: pod-tmp
62 mountPath: /tmp
63 - name: heat-bin
64 mountPath: /tmp/ks-user.sh
65 subPath: ks-user.sh
66 readOnly: true
67{{- dict "enabled" .Values.manifests.certificates "name" $envAll.Values.secrets.tls.orchestration.api.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }}
68 env:
69{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" .Values.manifests.certificates }}
70{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
71{{- end }}
72 - name: SERVICE_OS_SERVICE_NAME
73 value: "test"
74{{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }}
75{{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }}
76{{- end }}
77 - name: SERVICE_OS_ROLE
78 value: {{ .Values.endpoints.identity.auth.test.role | quote }}
79 containers:
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000080 - name: {{ .deployment_name }}-test
Mohammed Naserf3f59a72023-01-15 21:02:04 -050081{{ tuple $envAll "test" | include "helm-toolkit.snippets.image" | indent 6 }}
82{{ tuple $envAll $envAll.Values.pod.resources.jobs.tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
83 env:
84{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" .Values.manifests.certificates }}
85{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
86{{- end }}
87{{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }}
88{{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }}
89{{- end }}
90 - name: RALLY_ENV_NAME
Mohammed Naserbcdd25c2023-01-18 03:38:47 +000091 value: {{.deployment_name}}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050092 command:
93 - /tmp/rally-test.sh
94 volumeMounts:
95 - name: pod-tmp
96 mountPath: /tmp
97 - name: heat-etc
98 mountPath: /etc/rally/rally_tests.yaml
99 subPath: rally_tests.yaml
100 readOnly: true
101 - name: heat-bin
102 mountPath: /tmp/rally-test.sh
103 subPath: rally-test.sh
104 readOnly: true
105 - name: rally-db
106 mountPath: /var/lib/rally
107 {{- range $key, $value := $envAll.Values.conf.rally_tests.templates }}
108 - name: heat-etc
109 mountPath: {{ $value.name }}
110 subPath: {{ printf "test_template_%d" $key }}
111 readOnly: true
112 {{- end }}
113{{- dict "enabled" .Values.manifests.certificates "name" $envAll.Values.secrets.tls.orchestration.api.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }}
114{{ if $mounts_tests.volumeMounts }}{{ toYaml $mounts_tests.volumeMounts | indent 8 }}{{ end }}
115 volumes:
116 - name: pod-tmp
117 emptyDir: {}
118 - name: heat-etc
119 secret:
120 secretName: heat-etc
121 defaultMode: 0444
122 - name: heat-bin
123 configMap:
124 name: heat-bin
125 defaultMode: 0555
126 - name: rally-db
127 emptyDir: {}
128{{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.secrets.tls.orchestration.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 4 }}
129{{ if $mounts_tests.volumes }}{{ toYaml $mounts_tests.volumes | indent 4 }}{{ end }}
130{{- end }}