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.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.neutron_tests.neutron_tests }} |
| 25 | {{- $mounts_tests_init := .Values.pod.mounts.neutron_tests.init_container }} |
| 26 | |
| 27 | {{- $serviceAccountName := print .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 .deployment_name "-test" }} |
| 34 | annotations: |
| 35 | "helm.sh/hook": test-success |
| 36 | {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} |
| 37 | labels: |
| 38 | {{ tuple $envAll "neutron" "test" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} |
| 39 | {{ dict "envAll" $envAll "podName" "neutron-test" "containerNames" (list "init" "neutron-test" "neutron-test-ks-user") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 4 }} |
| 40 | spec: |
| 41 | nodeSelector: |
| 42 | {{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }} |
| 43 | {{ if $envAll.Values.pod.tolerations.neutron.enabled }} |
| 44 | {{ tuple $envAll "neutron" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 2 }} |
| 45 | {{ end }} |
| 46 | restartPolicy: Never |
Dong Ma | e5bd5a3 | 2025-02-11 11:03:48 +0000 | [diff] [blame] | 47 | {{ with .Values.pod.priorityClassName.neutron_tests }} |
| 48 | priorityClassName: {{ . }} |
| 49 | {{ end }} |
| 50 | {{ with .Values.pod.runtimeClassName.neutron_tests }} |
| 51 | runtimeClassName: {{ . }} |
| 52 | {{ end }} |
Mohammed Naser | f3f59a7 | 2023-01-15 21:02:04 -0500 | [diff] [blame] | 53 | serviceAccountName: {{ $serviceAccountName }} |
| 54 | initContainers: |
| 55 | {{ tuple $envAll "tests" $mounts_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }} |
| 56 | - name: neutron-test-ks-user |
| 57 | {{ tuple $envAll "ks_user" | include "helm-toolkit.snippets.image" | indent 6 }} |
| 58 | {{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_user | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }} |
| 59 | command: |
| 60 | - /tmp/ks-user.sh |
| 61 | volumeMounts: |
| 62 | - name: pod-tmp |
| 63 | mountPath: /tmp |
| 64 | - name: neutron-bin |
| 65 | mountPath: /tmp/ks-user.sh |
| 66 | subPath: ks-user.sh |
| 67 | readOnly: true |
| 68 | {{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.network.server.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }} |
| 69 | env: |
| 70 | {{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" .Values.manifests.certificates }} |
| 71 | {{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }} |
| 72 | {{- end }} |
| 73 | - name: SERVICE_OS_SERVICE_NAME |
| 74 | value: "test" |
| 75 | {{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }} |
| 76 | {{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }} |
| 77 | {{- end }} |
| 78 | - name: SERVICE_OS_ROLE |
| 79 | value: {{ .Values.endpoints.identity.auth.test.role | quote }} |
| 80 | {{ if $envAll.Values.conf.rally_tests.force_project_purge }} |
| 81 | - name: {{ .deployment_name }}-reset |
| 82 | {{ tuple $envAll "purge_test" | include "helm-toolkit.snippets.image" | indent 6 }} |
| 83 | env: |
| 84 | {{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" .Values.manifests.certificates }} |
| 85 | {{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }} |
| 86 | {{- end }} |
| 87 | {{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }} |
| 88 | {{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }} |
| 89 | {{- end }} |
| 90 | - name: OS_TEST_PROJECT_NAME |
| 91 | value: {{ .Values.endpoints.identity.auth.test.project_name }} |
| 92 | - name: OS_TEST_PROJECT_DOMAIN_NAME |
| 93 | value: {{ .Values.endpoints.identity.auth.test.domain_name }} |
| 94 | - name: NETWORK_QUOTA |
| 95 | value: {{ (first (index .Values.conf.rally_tests.tests "NeutronNetworks.create_and_delete_networks")).context.quotas.neutron.network | quote }} |
| 96 | - name: PORT_QUOTA |
| 97 | value: {{ (first (index .Values.conf.rally_tests.tests "NeutronNetworks.create_and_delete_ports")).context.quotas.neutron.port | quote }} |
| 98 | - name: ROUTER_QUOTA |
| 99 | value: {{ (first (index .Values.conf.rally_tests.tests "NeutronNetworks.create_and_delete_routers")).context.quotas.neutron.router | quote }} |
| 100 | - name: SUBNET_QUOTA |
| 101 | value: {{ (first (index .Values.conf.rally_tests.tests "NeutronNetworks.create_and_delete_subnets")).context.quotas.neutron.subnet | quote }} |
| 102 | - name: SEC_GROUP_QUOTA |
| 103 | value: {{ (first (index .Values.conf.rally_tests.tests "NeutronSecurityGroup.create_and_list_security_groups")).context.quotas.neutron.security_group | quote }} |
| 104 | command: |
| 105 | - /tmp/neutron-test-force-cleanup.sh |
| 106 | volumeMounts: |
| 107 | - name: neutron-bin |
| 108 | mountPath: /tmp/neutron-test-force-cleanup.sh |
| 109 | subPath: neutron-test-force-cleanup.sh |
| 110 | readOnly: true |
| 111 | - name: pod-tmp |
| 112 | mountPath: /tmp/pod-tmp |
| 113 | {{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.network.server.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }} |
| 114 | {{ end }} |
| 115 | containers: |
| 116 | - name: neutron-test |
| 117 | {{ tuple $envAll "test" | include "helm-toolkit.snippets.image" | indent 6 }} |
| 118 | {{ tuple $envAll $envAll.Values.pod.resources.jobs.tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }} |
| 119 | env: |
| 120 | {{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" .Values.manifests.certificates }} |
| 121 | {{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }} |
| 122 | {{- end }} |
| 123 | {{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }} |
| 124 | {{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }} |
| 125 | {{- end }} |
| 126 | - name: RALLY_ENV_NAME |
| 127 | value: {{.Release.Name}} |
| 128 | command: |
| 129 | - /tmp/rally-test.sh |
| 130 | volumeMounts: |
| 131 | - name: pod-tmp |
| 132 | mountPath: /tmp |
| 133 | - name: neutron-etc |
| 134 | mountPath: /etc/rally/rally_tests.yaml |
| 135 | subPath: rally_tests.yaml |
| 136 | readOnly: true |
| 137 | - name: neutron-bin |
| 138 | mountPath: /tmp/rally-test.sh |
| 139 | subPath: rally-test.sh |
| 140 | readOnly: true |
| 141 | - name: rally-db |
| 142 | mountPath: /var/lib/rally |
| 143 | {{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.network.server.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }} |
| 144 | {{ if $mounts_tests.volumeMounts }}{{ toYaml $mounts_tests.volumeMounts | indent 8 }}{{ end }} |
| 145 | volumes: |
| 146 | - name: pod-tmp |
| 147 | emptyDir: {} |
| 148 | - name: neutron-etc |
| 149 | secret: |
| 150 | secretName: neutron-etc |
| 151 | defaultMode: 0444 |
| 152 | - name: neutron-bin |
| 153 | configMap: |
| 154 | name: neutron-bin |
| 155 | defaultMode: 0555 |
| 156 | - name: rally-db |
| 157 | emptyDir: {} |
| 158 | {{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.network.server.internal | include "helm-toolkit.snippets.tls_volume" | indent 4 }} |
| 159 | {{ if $mounts_tests.volumes }}{{ toYaml $mounts_tests.volumes | indent 4 }}{{ end }} |
| 160 | {{- end }} |