blob: 659d4b50586b11e6f7bf80e397d5f839c8c65117 [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
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010015{{- 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.nova_tests.nova_tests }}
25{{- $mounts_tests_init := .Values.pod.mounts.nova_tests.init_container }}
26
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010027{{- $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:
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010033 name: {{ print $envAll.deployment_name "-test" }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050034 labels:
35{{ tuple $envAll "nova" "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" "nova-test" "containerNames" (list "init" "nova-test" "nova-test-ks-user") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 4 }}
40spec:
41 nodeSelector:
42 {{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010043{{ if $envAll.Values.pod.tolerations.nova.enabled }}
44{{ tuple $envAll "nova" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 2 }}
45{{ end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050046 restartPolicy: Never
Dong Mabb1ef1f2025-02-11 16:47:00 +000047{{ with .Values.pod.priorityClassName.nova_tests }}
48 priorityClassName: {{ . }}
49{{ end }}
50{{ with .Values.pod.runtimeClassName.nova_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: nova-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 command:
60 - /tmp/ks-user.sh
61 volumeMounts:
62 - name: pod-tmp
63 mountPath: /tmp
64 - name: nova-bin
65 mountPath: /tmp/ks-user.sh
66 subPath: ks-user.sh
67 readOnly: true
68{{ dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.compute.osapi.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }}
69 env:
70{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" .Values.manifests.certificates }}
71{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
72{{- end }}
73 - name: SERVICE_OS_SERVICE_NAME
74 value: "test"
75{{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }}
76{{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }}
77{{- end }}
78 - name: SERVICE_OS_ROLE
79 value: {{ .Values.endpoints.identity.auth.test.role | quote }}
80 containers:
81 - name: nova-test
82{{ tuple $envAll "test" | include "helm-toolkit.snippets.image" | indent 6 }}
83{{ tuple $envAll $envAll.Values.pod.resources.jobs.tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
84 env:
85{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" .Values.manifests.certificates}}
86{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
87{{- end }}
88{{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }}
89{{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }}
90{{- end }}
91 - name: RALLY_ENV_NAME
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010092 value: {{.deployment_name}}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050093 command:
94 - /tmp/rally-test.sh
95 volumeMounts:
96 - name: pod-tmp
97 mountPath: /tmp
98 - name: nova-etc
99 mountPath: /etc/rally/rally_tests.yaml
100 subPath: rally_tests.yaml
101 readOnly: true
102 - name: nova-bin
103 mountPath: /tmp/rally-test.sh
104 subPath: rally-test.sh
105 readOnly: true
106 - name: rally-db
107 mountPath: /var/lib/rally
108{{ dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.compute.osapi.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }}
109{{ if $mounts_tests.volumeMounts }}{{ toYaml $mounts_tests.volumeMounts | indent 8 }}{{ end }}
110 volumes:
111 - name: pod-tmp
112 emptyDir: {}
113 - name: nova-etc
114 secret:
115 secretName: nova-etc
116 defaultMode: 0444
117 - name: nova-bin
118 configMap:
119 name: nova-bin
120 defaultMode: 0555
121 - name: rally-db
122 emptyDir: {}
123{{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.compute.osapi.internal | include "helm-toolkit.snippets.tls_volume" | indent 4 }}
124{{ if $mounts_tests.volumes }}{{ toYaml $mounts_tests.volumes | indent 4 }}{{ end }}
125{{- end }}