blob: 4513053bb784b507919c9efd0c0888193f05e75d [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_helm_test }}
16{{- $envAll := . }}
17
18{{- $mounts_tests := .Values.pod.mounts.horizon_tests.horizon_tests }}
19{{- $mounts_tests_init := .Values.pod.mounts.horizon_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 "horizon" "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" "horizon-test" "containerNames" (list "init" "horizon-test") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 4 }}
34spec:
35{{ dict "envAll" $envAll "application" "test" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 2 }}
36 restartPolicy: Never
Dong Ma6a260ac2025-02-10 13:14:30 +000037{{ with .Values.pod.priorityClassName.horizon_tests }}
38 priorityClassName: {{ . }}
39{{ end }}
40{{ with .Values.pod.runtimeClassName.horizon_tests }}
41 runtimeClassName: {{ . }}
42{{ end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050043 serviceAccountName: {{ $serviceAccountName }}
44{{ if $envAll.Values.pod.tolerations.horizon.enabled }}
Oleksandr Kozachenkoc0022be2023-05-23 20:36:21 +020045{{ tuple $envAll "horizon" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 2 }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050046{{ end }}
47 nodeSelector:
48 {{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
49 initContainers:
50{{ tuple $envAll "tests" $mounts_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
51 containers:
52 - name: horizon-test
53{{ tuple $envAll "test" | include "helm-toolkit.snippets.image" | indent 6 }}
54{{ tuple $envAll $envAll.Values.pod.resources.jobs.tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
55{{ dict "envAll" $envAll "application" "test" "container" "horizon_test" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 6 }}
56 command:
57 - /tmp/selenium-test.py
58 env:
59{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" .Values.manifests.certificates }}
60{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
61{{- end }}
62 - name: HORIZON_URI
63 value: {{ tuple "dashboard" "public" "web" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" }}
64 volumeMounts:
65 - name: pod-tmp
66 mountPath: /tmp
67 - name: horizon-bin
68 mountPath: /tmp/selenium-test.py
69 subPath: selenium-test.py
70 readOnly: true
71{{- dict "enabled" $envAll.Values.manifests.certificates "name" .Values.secrets.tls.dashboard.dashboard.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }}
72{{ if $mounts_tests.volumeMounts }}{{ toYaml $mounts_tests.volumeMounts | indent 8 }}{{ end }}
73 volumes:
74 - name: pod-tmp
75 emptyDir: {}
76 - name: horizon-bin
77 configMap:
78 name: horizon-bin
79 defaultMode: 0555
80{{- dict "enabled" $envAll.Values.manifests.certificates "name" .Values.secrets.tls.dashboard.dashboard.internal | include "helm-toolkit.snippets.tls_volume" | indent 4 }}
81{{ if $mounts_tests.volumes }}{{ toYaml $mounts_tests.volumes | indent 4 }}{{ end }}
82{{- end }}