blob: 3ed52cde4aff91cdf3eb9c6df751d4a9d7f75f72 [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 }}
41 serviceAccountName: {{ $serviceAccountName }}
42 initContainers:
43{{ tuple $envAll "tests" $mounts_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
44 - name: cinder-test-ks-user
45{{ tuple $envAll "ks_user" | include "helm-toolkit.snippets.image" | indent 6 }}
46{{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_user | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
47 command:
48 - /tmp/ks-user.sh
49 volumeMounts:
50 - name: pod-tmp
51 mountPath: /tmp
52 - name: cinder-bin
53 mountPath: /tmp/ks-user.sh
54 subPath: ks-user.sh
55 readOnly: true
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010056{{ 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 -050057 env:
58{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" .Values.manifests.certificates }}
59{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
60{{- end }}
61 - name: SERVICE_OS_SERVICE_NAME
62 value: "test"
63{{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }}
64{{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }}
65{{- end }}
66 - name: SERVICE_OS_ROLE
67 value: {{ .Values.endpoints.identity.auth.test.role | quote }}
68 containers:
69 - name: cinder-test
70{{ tuple $envAll "test" | include "helm-toolkit.snippets.image" | indent 6 }}
71{{ tuple $envAll $envAll.Values.pod.resources.jobs.tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
72 env:
73{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" .Values.manifests.certificates }}
74{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
75{{- end }}
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: RALLY_ENV_NAME
80 value: {{.Release.Name}}
81 command:
82 - /tmp/rally-test.sh
83 volumeMounts:
84 - name: pod-tmp
85 mountPath: /tmp
86 - name: cinder-etc
87 mountPath: /etc/rally/rally_tests.yaml
88 subPath: rally_tests.yaml
89 readOnly: true
90 - name: cinder-bin
91 mountPath: /tmp/rally-test.sh
92 subPath: rally-test.sh
93 readOnly: true
94 - name: rally-db
95 mountPath: /var/lib/rally
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010096{{ 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 -050097{{ if $mounts_tests.volumeMounts }}{{ toYaml $mounts_tests.volumeMounts | indent 8 }}{{ end }}
98 volumes:
99 - name: pod-tmp
100 emptyDir: {}
101 - name: cinder-etc
102 secret:
103 secretName: cinder-etc
104 defaultMode: 0444
105 - name: cinder-bin
106 configMap:
107 name: cinder-bin
108 defaultMode: 0555
109 - name: rally-db
110 emptyDir: {}
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +0100111{{- 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 -0500112{{ if $mounts_tests.volumes }}{{ toYaml $mounts_tests.volumes | indent 4 }}{{ end }}
113{{- end }}