blob: 940989bb2885e42a29f470eb9c7d895a938b0b1f [file] [log] [blame]
okozachenko120361008f72023-03-23 21:21:09 +11001{{/*
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.manila_tests.manila_tests }}
25{{- $mounts_tests_init := .Values.pod.mounts.manila_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.deployment_name "-test" }}
34 labels:
35{{ tuple $envAll "manila" "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" }}
39{{ dict "envAll" $envAll "podName" "manila-test" "containerNames" (list "init" "manila-test" "manila-test-ks-user") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 4 }}
40spec:
41 restartPolicy: Never
42{{ dict "envAll" $envAll "application" "test" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 2 }}
43 nodeSelector:
44 {{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
Dong Maf1596772025-02-11 05:18:42 +000045{{ with .Values.pod.priorityClassName.manila_tests }}
46 priorityClassName: {{ . }}
47{{ end }}
48{{ with .Values.pod.runtimeClassName.manila_tests }}
49 runtimeClassName: {{ . }}
50{{ end }}
okozachenko120361008f72023-03-23 21:21:09 +110051 serviceAccountName: {{ $serviceAccountName }}
52 initContainers:
53{{ tuple $envAll "tests" $mounts_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
54 - name: manila-test-ks-user
55{{ tuple $envAll "ks_user" | include "helm-toolkit.snippets.image" | indent 6 }}
56{{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_user | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
57{{ dict "envAll" $envAll "application" "test" "container" "manila_test_ks_user" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 6 }}
58 command:
59 - /tmp/ks-user.sh
60 volumeMounts:
61 - name: pod-tmp
62 mountPath: /tmp
63 - name: manila-bin
64 mountPath: /tmp/ks-user.sh
65 subPath: ks-user.sh
66 readOnly: true
67{{- if and .Values.manifests.certificates .Values.secrets.tls.share.api.internal }}
68{{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.share.api.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }}
69{{- end }}
70 env:
Dong Maf1596772025-02-11 05:18:42 +000071{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" (and .Values.manifests.certificates .Values.secrets.tls.share.api.internal) }}
72{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
okozachenko120361008f72023-03-23 21:21:09 +110073{{- end }}
74 - name: SERVICE_OS_SERVICE_NAME
75 value: "test"
Dong Maf1596772025-02-11 05:18:42 +000076{{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }}
77{{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }}
okozachenko120361008f72023-03-23 21:21:09 +110078{{- end }}
79 - name: SERVICE_OS_ROLE
Dong Maf1596772025-02-11 05:18:42 +000080 value: {{ .Values.endpoints.identity.auth.test.role | quote }}
okozachenko120361008f72023-03-23 21:21:09 +110081 containers:
82 - name: manila-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" "manila_test" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 6}}
86 env:
Dong Maf1596772025-02-11 05:18:42 +000087{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" (and .Values.manifests.certificates .Values.secrets.tls.share.api.internal) }}
88{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
okozachenko120361008f72023-03-23 21:21:09 +110089{{- end }}
Dong Maf1596772025-02-11 05:18:42 +000090{{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }}
91{{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }}
okozachenko120361008f72023-03-23 21:21:09 +110092{{- end }}
93 - name: RALLY_ENV_NAME
94 value: {{.deployment_name}}
95 command:
96 - /tmp/rally-test.sh
97 volumeMounts:
98 - name: pod-tmp
99 mountPath: /tmp
100 - name: manila-etc
101 mountPath: /etc/rally/rally_tests.yaml
102 subPath: rally_tests.yaml
103 readOnly: true
104 - name: manila-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{{- if and .Values.manifests.certificates .Values.secrets.tls.share.api.internal }}
113{{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.share.api.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }}
114{{- end }}
115{{ if $mounts_tests.volumeMounts }}{{ toYaml $mounts_tests.volumeMounts | indent 8 }}{{ end }}
116 volumes:
117 - name: pod-tmp
118 emptyDir: {}
119 - name: manila-etc
120 secret:
121 secretName: manila-etc
122 defaultMode: 0444
123 - name: manila-bin
124 configMap:
125 name: manila-bin
126 defaultMode: 0555
127 - name: rally-db
128 emptyDir: {}
129 - name: rally-work
130 emptyDir: {}
131{{- if and .Values.manifests.certificates .Values.secrets.tls.share.api.internal }}
132{{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.share.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 4 }}
133{{- end }}
134{{ if $mounts_tests.volumes }}{{ toYaml $mounts_tests.volumes | indent 4 }}{{ end }}
135{{- end }}