Merge "Mistral: Add helm test"

This commit is contained in:
Zuul 2018-05-04 16:10:37 +00:00 committed by Gerrit Code Review
commit d4577d1459
6 changed files with 209 additions and 2 deletions

View File

@ -16,6 +16,7 @@ limitations under the License.
{{- if .Values.manifests.configmap_bin }}
{{- $envAll := . }}
{{- $rallyTests := .Values.conf.rally_tests }}
---
apiVersion: v1
kind: ConfigMap
@ -26,6 +27,8 @@ data:
bootstrap.sh: |
{{ tuple "bin/_bootstrap.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- end }}
rally-test.sh: |
{{ tuple $rallyTests | include "helm-toolkit.scripts.rally_test" | indent 4 }}
db-init.py: |
{{- include "helm-toolkit.scripts.db_init" . | indent 4 }}
db-sync.sh: |

View File

@ -69,8 +69,14 @@ kind: ConfigMap
metadata:
name: mistral-etc
data:
rally_tests.yaml: |
{{ toYaml .Values.conf.rally_tests.tests | indent 4 }}
mistral.conf: |
{{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.mistral | indent 4 }}
policy.json: |
{{ toJson .Values.conf.policy | indent 4 }}
{{- range $key, $value := $envAll.Values.conf.rally_tests.templates }}
{{ printf "test_template_%d" $key }}: |
{{ $value.template | indent 4 }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,108 @@
{{/*
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.
*/}}
{{- if .Values.manifests.pod_rally_test }}
{{- $envAll := . }}
{{- $dependencies := .Values.dependencies.static.tests }}
{{- $mounts_tests := .Values.pod.mounts.mistral_tests.mistral_tests }}
{{- $mounts_tests_init := .Values.pod.mounts.mistral_tests.init_container }}
{{- $serviceAccountName := print $envAll.Release.Name "-test" }}
{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
apiVersion: v1
kind: Pod
metadata:
name: {{ print $envAll.Release.Name "-test" }}
annotations:
"helm.sh/hook": test-success
spec:
nodeSelector:
{{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
restartPolicy: Never
serviceAccountName: {{ $serviceAccountName }}
initContainers:
{{ tuple $envAll $dependencies $mounts_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
- name: {{ .Release.Name }}-test-ks-user
image: {{ .Values.images.tags.ks_user }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_user | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
command:
- /tmp/ks-user.sh
volumeMounts:
- name: mistral-bin
mountPath: /tmp/ks-user.sh
subPath: ks-user.sh
readOnly: true
env:
{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin }}
{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
{{- end }}
- name: SERVICE_OS_SERVICE_NAME
value: "test"
{{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }}
{{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }}
{{- end }}
- name: SERVICE_OS_ROLE
value: {{ .Values.endpoints.identity.auth.test.role | quote }}
containers:
- name: {{ .Release.Name }}-test
image: {{ .Values.images.tags.test }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
env:
{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin }}
{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
{{- end }}
{{- with $env := dict "ksUserSecret" .Values.secrets.identity.test }}
{{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }}
{{- end }}
- name: RALLY_ENV_NAME
value: {{.Release.Name}}
command:
- /tmp/rally-test.sh
volumeMounts:
- name: mistral-etc
mountPath: /etc/rally/rally_tests.yaml
subPath: rally_tests.yaml
readOnly: true
- name: mistral-bin
mountPath: /tmp/rally-test.sh
subPath: rally-test.sh
readOnly: true
- name: rally-db
mountPath: /var/lib/rally
{{- range $key, $value := $envAll.Values.conf.rally_tests.templates }}
- name: mistral-etc
mountPath: {{ $value.name }}
subPath: {{ printf "test_template_%d" $key }}
readOnly: true
{{- end }}
{{ if $mounts_tests.volumeMounts }}{{ toYaml $mounts_tests.volumeMounts | indent 8 }}{{ end }}
volumes:
- name: mistral-etc
configMap:
name: mistral-etc
defaultMode: 0444
- name: mistral-bin
configMap:
name: mistral-bin
defaultMode: 0555
- name: rally-db
emptyDir: {}
{{ if $mounts_tests.volumes }}{{ toYaml $mounts_tests.volumes | indent 4 }}{{ end }}
{{- end }}

View File

@ -16,7 +16,7 @@ limitations under the License.
{{- if .Values.manifests.secret_keystone }}
{{- $envAll := . }}
{{- range $key1, $userClass := tuple "admin" "mistral" }}
{{- range $key1, $userClass := tuple "admin" "mistral" "test" }}
{{- $secretName := index $envAll.Values.secrets.identity $userClass }}
---
apiVersion: v1

View File

@ -33,11 +33,15 @@ labels:
job:
node_selector_key: openstack-control-plane
node_selector_value: enabled
test:
node_selector_key: openstack-control-plane
node_selector_value: enabled
release_group: null
images:
tags:
test: docker.io/kolla/ubuntu-source-rally:4.0.0
bootstrap: docker.io/openstackhelm/heat:newton
dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1
db_init: docker.io/openstackhelm/heat:newton
@ -146,12 +150,19 @@ dependencies:
services:
- service: oslo_messaging
endpoint: internal
tests:
services:
- endpoint: internal
service: identity
- endpoint: internal
service: workflowv2
# Names of secrets used by bootstrap and environmental checks
secrets:
identity:
admin: mistral-keystone-admin
mistral: mistral-keystone-user
test: mistral-keystone-test
oslo_db:
admin: mistral-db-admin
mistral: mistral-db-user
@ -182,6 +193,14 @@ endpoints:
project_name: service
user_domain_name: default
project_domain_name: default
test:
role: admin
region_name: RegionOne
username: test
password: password
project_name: test
user_domain_name: default
project_domain_name: default
hosts:
default: keystone-api
public: keystone
@ -264,6 +283,72 @@ endpoints:
default: 11211
conf:
rally_tests:
run_tempest: false
tests:
MistralWorkbooks.create_workbook:
- args:
definition: /tmp/rally-jobs/mistral_wb.yaml
do_delete: true
runner:
concurrency: 1
times: 1
type: constant
sla:
failure_rate:
max: 0
MistralExecutions.create_execution_from_workbook:
- args:
definition: /tmp/rally-jobs/mistral_wb.yaml
do_delete: true
params: /tmp/rally-jobs/mistral_params.json
wf_input: /tmp/rally-jobs/mistral_input.json
workflow_name: wf1
runner:
concurrency: 1
times: 1
type: constant
sla:
failure_rate:
max: 0
MistralWorkbooks.list_workbooks:
- runner:
concurrency: 1
times: 1
type: constant
sla:
failure_rate:
max: 0
MistralExecutions.list_executions:
- runner:
concurrency: 1
times: 1
type: constant
sla:
failure_rate:
max: 0
templates:
- name: /tmp/rally-jobs/mistral_wb.yaml
template: |
version: "2.0"
name: wb
workflows:
wf1:
type: direct
input:
- input1: input1
- some_json_input: {}
tasks:
hello:
action: std.echo output="Hello"
publish:
result: $
- name: /tmp/rally-jobs/mistral_input.json
template: |
{"input1": "value1", "some_json_input": {"a": "b"}}
- name: /tmp/rally-jobs/mistral_params.json
template: |
{"env": {"env_param": "env_param_value"}}
policy:
admin_only: is_admin:True
admin_or_owner: is_admin:True or project_id:%(project_id)s
@ -359,6 +444,9 @@ pod:
mistral_bootstrap:
init_container: null
mistral_bootstrap:
mistral_tests:
init_container: null
mistral_tests:
replicas:
api: 1
engine: 1
@ -488,6 +576,7 @@ manifests:
job_ks_user: true
job_rabbit_init: true
pdb_api: true
pod_rally_test: true
secret_db: true
secret_keystone: true
secret_rabbitmq: true

View File

@ -28,6 +28,7 @@ helm upgrade --install mistral ./mistral \
#NOTE: Wait for deploy
./tools/deployment/common/wait-for-pods.sh openstack
#NOTE: Validate Deployment info
#NOTE: Validate Deployment
export OS_CLOUD=openstack_helm
openstack service list
helm test mistral