blob: fa1c36189795adcabccc14cf735b2b5050e7e039 [file] [log] [blame]
Mohammed Naserdd9bbd12023-01-18 02:52:43 +00001{{/*
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.job_run_tests }}
16
17{{- $envAll := . }}
18
19{{- $serviceAccountName := "tempest-run-tests" }}
20{{ tuple $envAll "run_tests" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
21---
22apiVersion: batch/v1
23kind: Job
24metadata:
25 name: {{ .Release.Name }}-run-tests
26 annotations:
27 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
28 helm.sh/hook: post-install,post-upgrade
29spec:
30 backoffLimit: {{ .Values.jobs.run_tests.backoffLimit }}
31 template:
32 metadata:
33 labels:
34{{ tuple $envAll "tempest" "run-tests" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
35 spec:
36 serviceAccountName: {{ $serviceAccountName }}
37 restartPolicy: {{ .Values.jobs.run_tests.restartPolicy }}
38 nodeSelector:
39 {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }}
40 initContainers:
41{{ tuple $envAll "run_tests" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
42 - name: tempest-run-tests-init
43{{ tuple $envAll "tempest_run_tests" | include "helm-toolkit.snippets.image" | indent 10 }}
44{{ tuple $envAll $envAll.Values.pod.resources.jobs.run_tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
45 securityContext:
46 runAsUser: 0
47 command:
48 - chown
49 - -R
50 - "root:"
51 - /var/lib/tempest/data
52 volumeMounts:
53 - name: pod-tmp
54 mountPath: /tmp
55 - name: tempest-reports
56 mountPath: /var/lib/tempest/data
57 containers:
58 - name: tempest-run-tests
59{{ tuple $envAll "tempest_run_tests" | include "helm-toolkit.snippets.image" | indent 10 }}
60{{ tuple $envAll $envAll.Values.pod.resources.jobs.run_tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
61 command:
62 - /tmp/run-tests.sh
63 env:
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010064{{- if or .Values.manifests.certificates .Values.tls.identity }}
65 - name: REQUESTS_CA_BUNDLE
66 value: "/etc/tempest/certs/ca.crt"
67{{- end }}
Mohammed Naserdd9bbd12023-01-18 02:52:43 +000068{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin }}
69{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 12 }}
70{{- end }}
71 volumeMounts:
72 - name: pod-tmp
73 mountPath: /tmp
74 - name: tempest-bin
75 mountPath: /tmp/run-tests.sh
76 subPath: run-tests.sh
77 readOnly: true
78 - name: etctempest
79 mountPath: /etc/tempest
80 - name: tempest-etc
81 mountPath: /etc/tempest/tempest.conf
82 subPath: tempest.conf
83 readOnly: true
84 - name: tempest-etc
85 mountPath: /etc/tempest/logging.conf
86 subPath: logging.conf
87 readOnly: true
88{{ if not (empty .Values.conf.blacklist) }}
89 - name: tempest-etc
90 mountPath: /etc/tempest/test-blacklist
91 subPath: test-blacklist
92 readOnly: true
93{{- end }}
94{{ if not (empty .Values.conf.whitelist) }}
95 - name: tempest-etc
96 mountPath: /etc/tempest/test-whitelist
97 subPath: test-whitelist
98 readOnly: true
99{{- end }}
Mohammed Naser12207172024-02-05 18:49:35 -0500100 - name: stestr
101 mountPath: /.stestr
Mohammed Naserdd9bbd12023-01-18 02:52:43 +0000102 - name: tempest-reports
103 mountPath: /var/lib/tempest/data
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +0100104{{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.identity.api.internal "path" "/etc/tempest/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }}
Mohammed Naserdd9bbd12023-01-18 02:52:43 +0000105 volumes:
106 - name: pod-tmp
107 emptyDir: {}
108 - name: etctempest
109 emptyDir: {}
110 - name: tempest-etc
111 secret:
112 secretName: tempest-etc
113 defaultMode: 0444
114 - name: tempest-bin
115 configMap:
116 name: tempest-bin
117 defaultMode: 0555
Mohammed Naser12207172024-02-05 18:49:35 -0500118 - name: stestr
119 hostPath:
120 path: /tmp/stestr
Mohammed Naserdd9bbd12023-01-18 02:52:43 +0000121 - name: tempest-reports
122 {{- if not .Values.pvc.enabled }}
123 emptyDir: {}
124 {{- else }}
125 persistentVolumeClaim:
126 claimName: {{ .Values.pvc.name }}
127 {{- end }}
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +0100128{{- dict "enabled" (or .Values.manifests.certificates .Values.tls.identity) "name" .Values.secrets.tls.identity.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
Mohammed Naserdd9bbd12023-01-18 02:52:43 +0000129{{- end }}