blob: 1148e8a91905dd218be8f6022d8599425fc56657 [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.global).subchart_release_name }}
16{{- $_ := set . "deployment_name" .Chart.Name }}
17{{- else }}
18{{- $_ := set . "deployment_name" .Release.Name }}
19{{- end }}
20
21{{- if .Values.manifests.pod_rally_test }}
22{{- $envAll := . }}
23
24{{- $mounts_tests := .Values.pod.mounts.glance_tests.glance_tests }}
25{{- $mounts_tests_init := .Values.pod.mounts.glance_tests.init_container }}
26
27{{- $serviceAccountName := print $envAll.deployment_name "-test" }}
28{{ tuple $envAll "tests" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
29---
30apiVersion: v1
31kind: Pod
32metadata:
33 name: {{ print $envAll.Chart.Name "-test" }}
34 labels:
35{{ tuple $envAll "glance" "test" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
36 annotations:
37 "helm.sh/hook": test-success
38{{ dict "envAll" $envAll "podName" "glance-test" "containerNames" (list "init" "glance-test" "glance-test-ks-user") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 4 }}
39spec:
40{{ if $envAll.Values.pod.tolerations.glance.enabled }}
41{{ tuple $envAll "glance" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 2 }}
42{{ end }}
43 nodeSelector:
44 {{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
45{{ dict "envAll" $envAll "application" "test" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 2 }}
46 restartPolicy: Never
Dong Ma1384adc2025-02-10 09:56:42 +000047{{ with .Values.pod.priorityClassName.glance_tests }}
48 priorityClassName: {{ . }}
49{{ end }}
50{{ with .Values.pod.runtimeClassName.glance_tests }}
51 runtimeClassName: {{ . }}
52{{ end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050053 serviceAccountName: {{ $serviceAccountName }}
54 initContainers:
55{{ tuple $envAll "tests" $mounts_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
56 - name: glance-test-ks-user
57{{ tuple $envAll "ks_user" | include "helm-toolkit.snippets.image" | indent 6 }}
58{{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_user | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
59{{ dict "envAll" $envAll "application" "test" "container" "glance_test_ks_user" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 6 }}
60 command:
61 - /tmp/ks-user.sh
62 volumeMounts:
63 - name: pod-tmp
64 mountPath: /tmp
65 - name: glance-bin
66 mountPath: /tmp/ks-user.sh
67 subPath: ks-user.sh
68 readOnly: true
69{{ dict "enabled" .Values.manifests.certificates "name" $envAll.Values.secrets.tls.image.api.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }}
70 env:
71{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" .Values.manifests.certificates }}
72{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
73{{- end }}
74 - name: SERVICE_OS_SERVICE_NAME
75 value: "test"
76{{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }}
77{{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }}
78{{- end }}
79 - name: SERVICE_OS_ROLE
80 value: {{ .Values.endpoints.identity.auth.test.role | quote }}
81 containers:
82 - name: glance-test
83{{ tuple $envAll "test" | include "helm-toolkit.snippets.image" | indent 6 }}
84{{ tuple $envAll $envAll.Values.pod.resources.jobs.tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
85{{ dict "envAll" $envAll "application" "test" "container" "glance_test" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 6 }}
86 env:
87{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" .Values.manifests.certificates }}
88{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
89{{- end }}
90{{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }}
91{{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }}
92{{- end }}
93 - name: RALLY_ENV_NAME
94 value: {{.Chart.Name}}
95 command:
96 - /tmp/rally-test.sh
97 volumeMounts:
98 - name: pod-tmp
99 mountPath: /tmp
100 - name: glance-etc
101 mountPath: /etc/rally/rally_tests.yaml
102 subPath: rally_tests.yaml
103 readOnly: true
104 - name: glance-bin
105 mountPath: /tmp/rally-test.sh
106 subPath: rally-test.sh
107 readOnly: true
108 - name: rally-db
109 mountPath: /var/lib/rally
110 - name: rally-work
111 mountPath: /home/rally/.rally
112{{ dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.image.api.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }}
113{{ if $mounts_tests.volumeMounts }}{{ toYaml $mounts_tests.volumeMounts | indent 8 }}{{ end }}
114 volumes:
115 - name: pod-tmp
116 emptyDir: {}
117 - name: glance-etc
118 secret:
119 secretName: glance-etc
120 defaultMode: 0444
121 - name: glance-bin
122 configMap:
123 name: glance-bin
124 defaultMode: 0555
125 - name: rally-db
126 emptyDir: {}
127 - name: rally-work
128 emptyDir: {}
129{{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.image.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 4 }}
130{{ if $mounts_tests.volumes }}{{ toYaml $mounts_tests.volumes | indent 4 }}{{ end }}
131{{- end }}