Mohammed Naser | dd9bbd1 | 2023-01-18 02:52:43 +0000 | [diff] [blame] | 1 | {{/* |
| 2 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | you may not use this file except in compliance with the License. |
| 4 | You may obtain a copy of the License at |
| 5 | |
| 6 | http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | |
| 8 | Unless required by applicable law or agreed to in writing, software |
| 9 | distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | See the License for the specific language governing permissions and |
| 12 | limitations 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 | --- |
| 22 | apiVersion: batch/v1 |
| 23 | kind: Job |
| 24 | metadata: |
| 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 |
| 29 | spec: |
| 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 Kozachenko | a10d785 | 2023-02-02 22:01:16 +0100 | [diff] [blame] | 64 | {{- if or .Values.manifests.certificates .Values.tls.identity }} |
| 65 | - name: REQUESTS_CA_BUNDLE |
| 66 | value: "/etc/tempest/certs/ca.crt" |
| 67 | {{- end }} |
Mohammed Naser | dd9bbd1 | 2023-01-18 02:52:43 +0000 | [diff] [blame] | 68 | {{- 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 Naser | 1220717 | 2024-02-05 18:49:35 -0500 | [diff] [blame] | 100 | - name: stestr |
| 101 | mountPath: /.stestr |
Mohammed Naser | dd9bbd1 | 2023-01-18 02:52:43 +0000 | [diff] [blame] | 102 | - name: tempest-reports |
| 103 | mountPath: /var/lib/tempest/data |
Oleksandr Kozachenko | a10d785 | 2023-02-02 22:01:16 +0100 | [diff] [blame] | 104 | {{- 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 Naser | dd9bbd1 | 2023-01-18 02:52:43 +0000 | [diff] [blame] | 105 | 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 Naser | 1220717 | 2024-02-05 18:49:35 -0500 | [diff] [blame] | 118 | - name: stestr |
| 119 | hostPath: |
| 120 | path: /tmp/stestr |
Mohammed Naser | dd9bbd1 | 2023-01-18 02:52:43 +0000 | [diff] [blame] | 121 | - name: tempest-reports |
| 122 | {{- if not .Values.pvc.enabled }} |
| 123 | emptyDir: {} |
| 124 | {{- else }} |
| 125 | persistentVolumeClaim: |
| 126 | claimName: {{ .Values.pvc.name }} |
| 127 | {{- end }} |
Oleksandr Kozachenko | a10d785 | 2023-02-02 22:01:16 +0100 | [diff] [blame] | 128 | {{- 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 Naser | dd9bbd1 | 2023-01-18 02:52:43 +0000 | [diff] [blame] | 129 | {{- end }} |