Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [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.pod_test }} |
| 16 | {{- $envAll := . }} |
| 17 | {{- $dependencies := .Values.dependencies.static.tests }} |
| 18 | |
| 19 | {{- $mounts_barbican_tests := .Values.pod.mounts.barbican_tests.barbican_tests }} |
| 20 | {{- $mounts_barbican_tests_init := .Values.pod.mounts.barbican_tests.init_container }} |
| 21 | |
| 22 | {{- $serviceAccountName := print .Release.Name "-test" }} |
| 23 | {{ tuple $envAll "tests" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} |
| 24 | --- |
| 25 | apiVersion: v1 |
| 26 | kind: Pod |
| 27 | metadata: |
| 28 | name: "{{.Release.Name}}-test" |
| 29 | labels: |
| 30 | {{ tuple $envAll "barbican" "test" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} |
| 31 | annotations: |
| 32 | "helm.sh/hook": test-success |
| 33 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} |
| 34 | {{ dict "envAll" $envAll "podName" "barbican-test" "containerNames" (list "init" "barbican-test") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 4 }} |
| 35 | spec: |
Dong Ma | 1da7eca | 2025-02-10 06:32:12 +0000 | [diff] [blame] | 36 | {{ with .Values.pod.priorityClassName.barbican_tests }} |
| 37 | priorityClassName: {{ . }} |
| 38 | {{ end }} |
| 39 | {{ with .Values.pod.runtimeClassName.barbican_tests }} |
| 40 | runtimeClassName: {{ . }} |
| 41 | {{ end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 42 | serviceAccountName: {{ $serviceAccountName }} |
| 43 | {{ dict "envAll" $envAll "application" "test" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 2 }} |
| 44 | nodeSelector: |
| 45 | {{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }} |
| 46 | {{ if $envAll.Values.pod.tolerations.barbican.enabled }} |
| 47 | {{ tuple $envAll "barbican" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 2 }} |
| 48 | {{ end }} |
| 49 | restartPolicy: Never |
| 50 | initContainers: |
| 51 | {{ tuple $envAll "tests" $mounts_barbican_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }} |
| 52 | containers: |
| 53 | - name: barbican-test |
| 54 | {{ tuple $envAll "scripted_test" | include "helm-toolkit.snippets.image" | indent 6 }} |
| 55 | {{ dict "envAll" $envAll "application" "test" "container" "barbican_test" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 6 }} |
| 56 | env: |
| 57 | {{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin }} |
| 58 | {{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }} |
| 59 | {{- end }} |
| 60 | command: |
| 61 | - /tmp/barbican-test.sh |
| 62 | volumeMounts: |
| 63 | - name: pod-tmp |
| 64 | mountPath: /tmp |
| 65 | - name: barbican-bin |
| 66 | mountPath: /tmp/barbican-test.sh |
| 67 | subPath: barbican-test.sh |
| 68 | readOnly: true |
| 69 | {{ if $mounts_barbican_tests.volumeMounts }}{{ toYaml $mounts_barbican_tests.volumeMounts | indent 8 }}{{ end }} |
| 70 | volumes: |
| 71 | - name: pod-tmp |
| 72 | emptyDir: {} |
| 73 | - name: barbican-bin |
| 74 | configMap: |
| 75 | name: barbican-bin |
| 76 | defaultMode: 0555 |
| 77 | {{ if $mounts_barbican_tests.volumes }}{{ toYaml $mounts_barbican_tests.volumes | indent 4 }}{{ end }} |
| 78 | {{- end }} |