okozachenko1203 | 61008f7 | 2023-03-23 21:21:09 +1100 | [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.global).subchart_release_name }} |
| 16 | {{- $_ := set . "deployment_name" .Chart.Name }} |
| 17 | {{- else }} |
| 18 | {{- $_ := set . "deployment_name" .Release.Name }} |
| 19 | {{- end }} |
| 20 | |
| 21 | {{- if .Values.manifests.pod_rally_test }} |
| 22 | {{- $envAll := . }} |
| 23 | |
| 24 | {{- $mounts_tests := .Values.pod.mounts.manila_tests.manila_tests }} |
| 25 | {{- $mounts_tests_init := .Values.pod.mounts.manila_tests.init_container }} |
| 26 | |
| 27 | {{- $serviceAccountName := print $envAll.deployment_name "-test" }} |
| 28 | {{ tuple $envAll "tests" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} |
| 29 | --- |
| 30 | apiVersion: v1 |
| 31 | kind: Pod |
| 32 | metadata: |
| 33 | name: {{ print $envAll.deployment_name "-test" }} |
| 34 | labels: |
| 35 | {{ tuple $envAll "manila" "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" "manila-test" "containerNames" (list "init" "manila-test" "manila-test-ks-user") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 4 }} |
| 40 | spec: |
| 41 | restartPolicy: Never |
| 42 | {{ dict "envAll" $envAll "application" "test" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 2 }} |
| 43 | nodeSelector: |
| 44 | {{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }} |
Dong Ma | f159677 | 2025-02-11 05:18:42 +0000 | [diff] [blame] | 45 | {{ with .Values.pod.priorityClassName.manila_tests }} |
| 46 | priorityClassName: {{ . }} |
| 47 | {{ end }} |
| 48 | {{ with .Values.pod.runtimeClassName.manila_tests }} |
| 49 | runtimeClassName: {{ . }} |
| 50 | {{ end }} |
okozachenko1203 | 61008f7 | 2023-03-23 21:21:09 +1100 | [diff] [blame] | 51 | serviceAccountName: {{ $serviceAccountName }} |
| 52 | initContainers: |
| 53 | {{ tuple $envAll "tests" $mounts_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }} |
| 54 | - name: manila-test-ks-user |
| 55 | {{ tuple $envAll "ks_user" | include "helm-toolkit.snippets.image" | indent 6 }} |
| 56 | {{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_user | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }} |
| 57 | {{ dict "envAll" $envAll "application" "test" "container" "manila_test_ks_user" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 6 }} |
| 58 | command: |
| 59 | - /tmp/ks-user.sh |
| 60 | volumeMounts: |
| 61 | - name: pod-tmp |
| 62 | mountPath: /tmp |
| 63 | - name: manila-bin |
| 64 | mountPath: /tmp/ks-user.sh |
| 65 | subPath: ks-user.sh |
| 66 | readOnly: true |
| 67 | {{- if and .Values.manifests.certificates .Values.secrets.tls.share.api.internal }} |
| 68 | {{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.share.api.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }} |
| 69 | {{- end }} |
| 70 | env: |
Dong Ma | f159677 | 2025-02-11 05:18:42 +0000 | [diff] [blame] | 71 | {{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" (and .Values.manifests.certificates .Values.secrets.tls.share.api.internal) }} |
| 72 | {{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }} |
okozachenko1203 | 61008f7 | 2023-03-23 21:21:09 +1100 | [diff] [blame] | 73 | {{- end }} |
| 74 | - name: SERVICE_OS_SERVICE_NAME |
| 75 | value: "test" |
Dong Ma | f159677 | 2025-02-11 05:18:42 +0000 | [diff] [blame] | 76 | {{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }} |
| 77 | {{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }} |
okozachenko1203 | 61008f7 | 2023-03-23 21:21:09 +1100 | [diff] [blame] | 78 | {{- end }} |
| 79 | - name: SERVICE_OS_ROLE |
Dong Ma | f159677 | 2025-02-11 05:18:42 +0000 | [diff] [blame] | 80 | value: {{ .Values.endpoints.identity.auth.test.role | quote }} |
okozachenko1203 | 61008f7 | 2023-03-23 21:21:09 +1100 | [diff] [blame] | 81 | containers: |
| 82 | - name: manila-test |
| 83 | {{ tuple $envAll "test" | include "helm-toolkit.snippets.image" | indent 6 }} |
| 84 | {{ tuple $envAll $envAll.Values.pod.resources.jobs.tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }} |
| 85 | {{ dict "envAll" $envAll "application" "test" "container" "manila_test" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 6}} |
| 86 | env: |
Dong Ma | f159677 | 2025-02-11 05:18:42 +0000 | [diff] [blame] | 87 | {{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" (and .Values.manifests.certificates .Values.secrets.tls.share.api.internal) }} |
| 88 | {{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }} |
okozachenko1203 | 61008f7 | 2023-03-23 21:21:09 +1100 | [diff] [blame] | 89 | {{- end }} |
Dong Ma | f159677 | 2025-02-11 05:18:42 +0000 | [diff] [blame] | 90 | {{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }} |
| 91 | {{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }} |
okozachenko1203 | 61008f7 | 2023-03-23 21:21:09 +1100 | [diff] [blame] | 92 | {{- end }} |
| 93 | - name: RALLY_ENV_NAME |
| 94 | value: {{.deployment_name}} |
| 95 | command: |
| 96 | - /tmp/rally-test.sh |
| 97 | volumeMounts: |
| 98 | - name: pod-tmp |
| 99 | mountPath: /tmp |
| 100 | - name: manila-etc |
| 101 | mountPath: /etc/rally/rally_tests.yaml |
| 102 | subPath: rally_tests.yaml |
| 103 | readOnly: true |
| 104 | - name: manila-bin |
| 105 | mountPath: /tmp/rally-test.sh |
| 106 | subPath: rally-test.sh |
| 107 | readOnly: true |
| 108 | - name: rally-db |
| 109 | mountPath: /var/lib/rally |
| 110 | - name: rally-work |
| 111 | mountPath: /home/rally/.rally |
| 112 | {{- if and .Values.manifests.certificates .Values.secrets.tls.share.api.internal }} |
| 113 | {{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.share.api.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }} |
| 114 | {{- end }} |
| 115 | {{ if $mounts_tests.volumeMounts }}{{ toYaml $mounts_tests.volumeMounts | indent 8 }}{{ end }} |
| 116 | volumes: |
| 117 | - name: pod-tmp |
| 118 | emptyDir: {} |
| 119 | - name: manila-etc |
| 120 | secret: |
| 121 | secretName: manila-etc |
| 122 | defaultMode: 0444 |
| 123 | - name: manila-bin |
| 124 | configMap: |
| 125 | name: manila-bin |
| 126 | defaultMode: 0555 |
| 127 | - name: rally-db |
| 128 | emptyDir: {} |
| 129 | - name: rally-work |
| 130 | emptyDir: {} |
| 131 | {{- if and .Values.manifests.certificates .Values.secrets.tls.share.api.internal }} |
| 132 | {{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.share.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 4 }} |
| 133 | {{- end }} |
| 134 | {{ if $mounts_tests.volumes }}{{ toYaml $mounts_tests.volumes | indent 4 }}{{ end }} |
| 135 | {{- end }} |