diff --git a/glance/templates/configmap-bin.yaml b/glance/templates/configmap-bin.yaml index 753fbd9f9a..b5d90d5f2a 100644 --- a/glance/templates/configmap-bin.yaml +++ b/glance/templates/configmap-bin.yaml @@ -17,6 +17,8 @@ kind: ConfigMap metadata: name: glance-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/glance/templates/configmap-etc.yaml b/glance/templates/configmap-etc.yaml index 87716f18ad..2999cd472b 100644 --- a/glance/templates/configmap-etc.yaml +++ b/glance/templates/configmap-etc.yaml @@ -67,6 +67,18 @@ kind: ConfigMap metadata: name: glance-etc data: + rally_tests.yaml: |+ +{{ if .Values.conf.rally_tests.override -}} +{{ .Values.conf.rally_tests.override | indent 4 }} +{{- else -}} +{{- if .Values.conf.rally_tests.prefix -}} +{{ .Values.conf.rally_tests.prefix | indent 4 }} +{{- end }} +{{ tuple "etc/_rally_tests.yaml.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} +{{- end }} +{{- if .Values.conf.rally_tests.append -}} +{{ .Values.conf.rally_tests.append | indent 4 }} +{{- end }} ceph.conf: |+ {{ if .Values.conf.ceph.override -}} {{ .Values.conf.ceph.override | indent 4 }} diff --git a/glance/templates/etc/_rally_tests.yaml.tpl b/glance/templates/etc/_rally_tests.yaml.tpl new file mode 100644 index 0000000000..23fc7bb17f --- /dev/null +++ b/glance/templates/etc/_rally_tests.yaml.tpl @@ -0,0 +1,33 @@ +--- +GlanceImages.create_and_delete_image: +- args: + container_format: {{ .Values.conf.rally_tests.images.container_format }} + disk_format: {{ .Values.conf.rally_tests.images.disk_format }} + image_location: {{ .Values.conf.rally_tests.images.image_location }} + context: + users: + tenants: 1 + users_per_tenant: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 +GlanceImages.create_and_list_image: +- args: + container_format: {{ .Values.conf.rally_tests.images.container_format }} + disk_format: {{ .Values.conf.rally_tests.images.disk_format }} + image_location: {{ .Values.conf.rally_tests.images.image_location }} + context: + users: + tenants: 1 + users_per_tenant: 1 + runner: + concurrency: 1 + times: 1 + type: constant + sla: + failure_rate: + max: 0 diff --git a/glance/templates/pod-rally-test.yaml b/glance/templates/pod-rally-test.yaml new file mode 100644 index 0000000000..0792487406 --- /dev/null +++ b/glance/templates/pod-rally-test.yaml @@ -0,0 +1,75 @@ +# 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 "glance-env-keystone-admin" }} +{{- $dependencies := .Values.dependencies.tests }} +{{- $mounts_glance_tests := .Values.mounts.glance_tests.glance_tests }} +{{- $mounts_glance_tests_init := .Values.mounts.glance_tests.init_container }} + +apiVersion: v1 +kind: Pod +metadata: + name: "{{.Release.Name}}-rally-test" + annotations: + "helm.sh/hook": test-success + pod.beta.kubernetes.io/init-containers: '[ +{{ tuple $envAll $dependencies $mounts_glance_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 10 }} + ]' +spec: + restartPolicy: Never + 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: glance-etc + mountPath: /etc/rally/rally_tests.yaml + subPath: rally_tests.yaml + readOnly: true + - name: glance-bin + mountPath: /tmp/rally-test.sh + subPath: rally-test.sh + readOnly: true + - name: rally-db + mountPath: /var/lib/rally +{{ if $mounts_glance_tests.volumeMounts }}{{ toYaml $mounts_glance_tests.volumeMounts | indent 8 }}{{ end }} + volumes: + - name: glance-etc + configMap: + name: glance-etc + - name: glance-bin + configMap: + name: glance-bin + - name: rally-db + emptyDir: {} +{{ if $mounts_glance_tests.volumes }}{{ toYaml $mounts_glance_tests.volumes | indent 4 }}{{ end }} diff --git a/glance/values.yaml b/glance/values.yaml index 41b3aa31c8..265ff065b3 100644 --- a/glance/values.yaml +++ b/glance/values.yaml @@ -29,6 +29,7 @@ labels: node_selector_value: enabled images: + test: docker.io/kolla/ubuntu-binary-rally:4.0.0 db_init: docker.io/kolla/ubuntu-source-glance-api:3.0.3 db_sync: docker.io/kolla/ubuntu-source-glance-api:3.0.3 ks_user: docker.io/kolla/ubuntu-source-kolla-toolbox:3.0.3 @@ -84,6 +85,13 @@ keystone: conf: + rally_tests: + override: + append: + images: + image_location: http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img + disk_format: qcow2 + container_format: bare ceph: monitors: [] keyring: null @@ -213,6 +221,13 @@ resources: requests: memory: "128Mi" cpu: "500m" + tests: + limits: + memory: "128Mi" + cpu: "500m" + requests: + memory: "128Mi" + cpu: "500m" dependencies: db_init: @@ -259,6 +274,11 @@ dependencies: - keystone-api - mariadb - glance-api + tests: + service: + - keystone-api + - glance-api + - glance-registry # typically overriden by environmental # values, but should include all endpoints @@ -330,3 +350,6 @@ mounts: glance_registry: init_container: null glance_registry: + glance_tests: + init_container: null + glance_tests: diff --git a/tools/gate/basic_launch.sh b/tools/gate/basic_launch.sh index f1eb9e09ea..8beb8e09d4 100755 --- a/tools/gate/basic_launch.sh +++ b/tools/gate/basic_launch.sh @@ -30,6 +30,10 @@ helm install local/keystone --name=keystone --namespace=openstack kube_wait_for_pods openstack 240 helm_test_deployment keystone +helm install local/glance --name=glance --namespace=openstack --values=${WORK_DIR}/tools/overrides/mvp/glance.yaml +kube_wait_for_pods openstack 240 +helm_test_deployment glance + # NOTE(portdirect): Temp workaround until module loading is supported by # OpenStack-Helm in Fedora if [ "x$HOST_OS" == "xfedora" ]; then @@ -37,7 +41,6 @@ if [ "x$HOST_OS" == "xfedora" ]; then sudo modprobe gre sudo modprobe vxlan fi -helm install local/glance --name=glance --namespace=openstack --values=${WORK_DIR}/tools/overrides/mvp/glance.yaml helm install local/nova --name=nova --namespace=openstack --values=${WORK_DIR}/tools/overrides/mvp/nova.yaml --set=conf.nova.libvirt.nova.conf.virt_type=qemu helm install local/neutron --name=neutron --namespace=openstack --values=${WORK_DIR}/tools/overrides/mvp/neutron.yaml kube_wait_for_pods openstack 600