diff --git a/cinder/templates/configmap-bin.yaml b/cinder/templates/configmap-bin.yaml index 338239e269..8fc08c24f8 100644 --- a/cinder/templates/configmap-bin.yaml +++ b/cinder/templates/configmap-bin.yaml @@ -17,6 +17,8 @@ kind: ConfigMap metadata: name: cinder-bin data: + rally-test.sh: | +{{- include "helm-toolkit.scripts.rally_test" . | indent 4 }} db-init.py: | {{- include "helm-toolkit.scripts.db_init" . | indent 4 }} db-sync.sh: | diff --git a/cinder/templates/configmap-etc.yaml b/cinder/templates/configmap-etc.yaml index f817c45bae..c0caa2d187 100644 --- a/cinder/templates/configmap-etc.yaml +++ b/cinder/templates/configmap-etc.yaml @@ -44,6 +44,8 @@ kind: ConfigMap metadata: name: cinder-etc data: + rally_tests.yaml: |+ +{{ tuple "etc/_rally_tests.yaml.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} cinder.conf: |+ {{ if .Values.conf.cinder.override -}} {{ .Values.conf.cinder.override | indent 4 }} diff --git a/cinder/templates/etc/_rally_tests.yaml.tpl b/cinder/templates/etc/_rally_tests.yaml.tpl new file mode 100644 index 0000000000..e18fe1a021 --- /dev/null +++ b/cinder/templates/etc/_rally_tests.yaml.tpl @@ -0,0 +1,30 @@ +--- +CinderVolumes.create_and_delete_volume: +- args: + size: 1 + runner: + type: "constant" + times: 1 + concurrency: 1 + context: + users: + tenants: 1 + users_per_tenant: 1 + sla: + failure_rate: + max: 0 +- args: + size: + min: 1 + max: 5 + runner: + type: "constant" + times: 1 + concurrency: 1 + context: + users: + tenants: 1 + users_per_tenant: 1 + sla: + failure_rate: + max: 0 diff --git a/cinder/templates/pod-rally-test.yaml b/cinder/templates/pod-rally-test.yaml new file mode 100644 index 0000000000..22b5648687 --- /dev/null +++ b/cinder/templates/pod-rally-test.yaml @@ -0,0 +1,74 @@ +# Copyright 2017 The Openstack-Helm Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +{{- $envAll := . }} +{{- $ksAdminSecret := .Values.keystone.admin_secret | default "cinder-env-keystone-admin" }} +{{- $dependencies := .Values.dependencies.tests }} +{{- $mounts_cinder_tests := .Values.mounts.cinder_tests.cinder_tests }} +{{- $mounts_cinder_tests_init := .Values.mounts.cinder_tests.init_container }} + +apiVersion: v1 +kind: Pod +metadata: + name: "{{.Release.Name}}-rally-test" + annotations: + "helm.sh/hook": test-success +spec: + restartPolicy: Never + initContainers: +{{ tuple $envAll $dependencies $mounts_cinder_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }} + containers: + - name: {{.Release.Name}}-token-issue-test + image: {{ .Values.images.test }} + imagePullPolicy: {{ .Values.images.pull_policy }} + {{- if .Values.resources.enabled }} + resources: + limits: + cpu: {{ .Values.resources.tests.limits.cpu | quote }} + memory: {{ .Values.resources.tests.limits.memory | quote }} + requests: + cpu: {{ .Values.resources.tests.requests.cpu | quote }} + memory: {{ .Values.resources.tests.requests.memory | quote }} + {{- end }} + env: +{{- with $env := dict "ksUserSecret" $ksAdminSecret }} +{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }} +{{- end }} + - name: RALLY_ENV_NAME + value: {{.Release.Name}} + command: + - bash + - /tmp/rally-test.sh + volumeMounts: + - name: cinder-etc + mountPath: /etc/rally/rally_tests.yaml + subPath: rally_tests.yaml + readOnly: true + - name: cinder-bin + mountPath: /tmp/rally-test.sh + subPath: rally-test.sh + readOnly: true + - name: rally-db + mountPath: /var/lib/rally +{{ if $mounts_cinder_tests.volumeMounts }}{{ toYaml $mounts_cinder_tests.volumeMounts | indent 8 }}{{ end }} + volumes: + - name: cinder-etc + configMap: + name: cinder-etc + - name: cinder-bin + configMap: + name: cinder-bin + - name: rally-db + emptyDir: {} +{{ if $mounts_cinder_tests.volumes }}{{ toYaml $mounts_cinder_tests.volumes | indent 4 }}{{ end }} diff --git a/cinder/values.yaml b/cinder/values.yaml index 433cea4be7..fc285cae8e 100644 --- a/cinder/values.yaml +++ b/cinder/values.yaml @@ -30,6 +30,7 @@ labels: node_selector_value: enabled images: + test: docker.io/kolla/ubuntu-binary-rally:4.0.0 db_init: docker.io/kolla/ubuntu-source-cinder-api:3.0.3 db_sync: docker.io/kolla/ubuntu-source-cinder-api:3.0.3 ks_user: docker.io/kolla/ubuntu-source-kolla-toolbox:3.0.3 @@ -152,6 +153,9 @@ conf: rbd_store_chunk_size: 4 rados_connect_timeout: -1 rbd_user: "admin" + rally_tests: + override: + append: dependencies: db_init: @@ -224,6 +228,12 @@ dependencies: endpoint: internal - service: volume endpoint: internal + tests: + services: + - service: identity + endpoint: internal + - service: volume + endpoint: internal # We use a different layout of the endpoints here to account for versioning # this swaps the service name and type, and should be rolled out to other @@ -377,6 +387,13 @@ resources: limits: memory: "1024Mi" cpu: "2000m" + tests: + limits: + memory: "128Mi" + cpu: "500m" + requests: + memory: "128Mi" + cpu: "500m" mounts: cinder_api: @@ -391,3 +408,6 @@ mounts: cinder_backup: init_container: null cinder_backup: + cinder_tests: + init_container: null + cinder_tests: diff --git a/tools/gate/basic_launch.sh b/tools/gate/basic_launch.sh index 3a721bd19b..320eef8619 100755 --- a/tools/gate/basic_launch.sh +++ b/tools/gate/basic_launch.sh @@ -99,5 +99,6 @@ fi helm_test_deployment keystone 600 helm_test_deployment glance 600 +helm_test_deployment cinder 600 helm_test_deployment neutron 600 helm_test_deployment nova 600