blob: e44bdcf835168c60011f5cfc6e36359be21ed25d [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_rally_test }}
16{{- $envAll := . }}
17
18{{- $mounts_tests := .Values.pod.mounts.cinder_tests.cinder_tests }}
19{{- $mounts_tests_init := .Values.pod.mounts.cinder_tests.init_container }}
20
21{{- $serviceAccountName := print $envAll.Release.Name "-test" }}
22{{ tuple $envAll "tests" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
23---
24apiVersion: v1
25kind: Pod
26metadata:
27 name: {{ print $envAll.Release.Name "-test" }}
28 labels:
29{{ tuple $envAll "cinder" "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" }}
33{{ dict "envAll" $envAll "podName" "cinder-test" "containerNames" (list "init" "cinder-test" "cinder-test-ks-user") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 4 }}
34spec:
35 restartPolicy: Never
36{{ if $envAll.Values.pod.tolerations.cinder.enabled }}
37{{ tuple $envAll "cinder" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 2 }}
38{{ end }}
39 nodeSelector:
40 {{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
Mohammed Naser26eb9e02025-02-05 16:40:34 -050041{{ with .Values.pod.priorityClassName.cinder_tests }}
42 priorityClassName: {{ . }}
43{{ end }}
44{{ with .Values.pod.runtimeClassName.cinder_tests }}
45 runtimeClassName: {{ . }}
46{{ end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050047 serviceAccountName: {{ $serviceAccountName }}
48 initContainers:
49{{ tuple $envAll "tests" $mounts_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
50 - name: cinder-test-ks-user
51{{ tuple $envAll "ks_user" | include "helm-toolkit.snippets.image" | indent 6 }}
52{{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_user | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
53 command:
54 - /tmp/ks-user.sh
55 volumeMounts:
56 - name: pod-tmp
57 mountPath: /tmp
58 - name: cinder-bin
59 mountPath: /tmp/ks-user.sh
60 subPath: ks-user.sh
61 readOnly: true
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010062{{ dict "enabled" .Values.manifests.certificates "name" $envAll.Values.secrets.tls.volume.api.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050063 env:
64{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" .Values.manifests.certificates }}
65{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
66{{- end }}
67 - name: SERVICE_OS_SERVICE_NAME
68 value: "test"
69{{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }}
70{{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }}
71{{- end }}
72 - name: SERVICE_OS_ROLE
73 value: {{ .Values.endpoints.identity.auth.test.role | quote }}
74 containers:
75 - name: cinder-test
76{{ tuple $envAll "test" | include "helm-toolkit.snippets.image" | indent 6 }}
77{{ tuple $envAll $envAll.Values.pod.resources.jobs.tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
78 env:
79{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" .Values.manifests.certificates }}
80{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
81{{- end }}
82{{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }}
83{{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }}
84{{- end }}
85 - name: RALLY_ENV_NAME
86 value: {{.Release.Name}}
87 command:
88 - /tmp/rally-test.sh
89 volumeMounts:
90 - name: pod-tmp
91 mountPath: /tmp
92 - name: cinder-etc
93 mountPath: /etc/rally/rally_tests.yaml
94 subPath: rally_tests.yaml
95 readOnly: true
96 - name: cinder-bin
97 mountPath: /tmp/rally-test.sh
98 subPath: rally-test.sh
99 readOnly: true
100 - name: rally-db
101 mountPath: /var/lib/rally
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +0100102{{ dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.volume.api.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500103{{ if $mounts_tests.volumeMounts }}{{ toYaml $mounts_tests.volumeMounts | indent 8 }}{{ end }}
104 volumes:
105 - name: pod-tmp
106 emptyDir: {}
107 - name: cinder-etc
108 secret:
109 secretName: cinder-etc
110 defaultMode: 0444
111 - name: cinder-bin
112 configMap:
113 name: cinder-bin
114 defaultMode: 0555
115 - name: rally-db
116 emptyDir: {}
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +0100117{{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.volume.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 4 }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -0500118{{ if $mounts_tests.volumes }}{{ toYaml $mounts_tests.volumes | indent 4 }}{{ end }}
119{{- end }}