summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeepak Tiwari <dt967u@att.com>2018-11-05 12:07:17 -0600
committerDeepak <deepak.tiwari@aricent.com>2018-12-05 20:39:42 +0000
commitdb16a2a4e46a87a2a09918f0d98e5dfc118877be (patch)
treebe7f1cf9a665944285898b42c34a8c7cb1e16c0f
parent5559878087ee5aae5a354f8d80354fa30782827d (diff)
Add shaker charts and shaker deployment scripts
This is initial draft for adding shaker charts and deployment scripts. Change-Id: I5a9e39fcc79dd711bbb01653ba397bc6d2ed24f3
Notes
Notes (review): Code-Review+2: Steve Wilkerson <wilkers.steve@gmail.com> Code-Review+2: Chris Wedgwood <cw@f00f.org> Workflow+1: Chris Wedgwood <cw@f00f.org> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 06 Dec 2018 20:44:11 +0000 Reviewed-on: https://review.openstack.org/615624 Project: openstack/openstack-helm-addons Branch: refs/heads/master
-rw-r--r--shaker/Chart.yaml25
-rw-r--r--shaker/requirements.yaml18
-rw-r--r--shaker/templates/bin/_run-tests.sh.tpl21
-rw-r--r--shaker/templates/configmap-bin.yaml33
-rw-r--r--shaker/templates/configmap-etc.yaml58
-rw-r--r--shaker/templates/job-image-repo-sync.yaml20
-rw-r--r--shaker/templates/job-ks-user.yaml20
-rw-r--r--shaker/templates/pod-shaker-test.yaml142
-rw-r--r--shaker/templates/pvc-shaker.yaml30
-rw-r--r--shaker/templates/secret-keystone.yaml30
-rw-r--r--shaker/templates/service-shaker.yaml43
-rw-r--r--shaker/values.yaml251
-rwxr-xr-xtools/gate/scripts/090-deploy-shaker.sh288
13 files changed, 979 insertions, 0 deletions
diff --git a/shaker/Chart.yaml b/shaker/Chart.yaml
new file mode 100644
index 0000000..720ca30
--- /dev/null
+++ b/shaker/Chart.yaml
@@ -0,0 +1,25 @@
1# Copyright 2018 The Openstack-Helm Authors.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15apiVersion: v1
16description: OpenStack-Helm Shaker
17name: shaker
18version: 0.1.0
19home: https://pyshaker.readthedocs.io/en/latest/index.html
20icon: https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTlnnEExfz6H9bBFFDxsDm5mVTdKWOt6Hw2_3aJ7hVkNdDdTCrimQ
21sources:
22 - https://git.openstack.org/cgit/openstack/shaker
23 - https://git.openstack.org/cgit/openstack/openstack-helm
24maintainers:
25 - name: OpenStack-Helm Authors
diff --git a/shaker/requirements.yaml b/shaker/requirements.yaml
new file mode 100644
index 0000000..53782e6
--- /dev/null
+++ b/shaker/requirements.yaml
@@ -0,0 +1,18 @@
1# Copyright 2017 The Openstack-Helm Authors.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15dependencies:
16 - name: helm-toolkit
17 repository: http://localhost:8879/charts
18 version: 0.1.0
diff --git a/shaker/templates/bin/_run-tests.sh.tpl b/shaker/templates/bin/_run-tests.sh.tpl
new file mode 100644
index 0000000..ba6881e
--- /dev/null
+++ b/shaker/templates/bin/_run-tests.sh.tpl
@@ -0,0 +1,21 @@
1#!/bin/bash
2
3{{/*
4Copyright 2018 The Openstack-Helm Authors.
5
6Licensed under the Apache License, Version 2.0 (the "License");
7you may not use this file except in compliance with the License.
8You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12Unless required by applicable law or agreed to in writing, software
13distributed under the License is distributed on an "AS IS" BASIS,
14WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15See the License for the specific language governing permissions and
16limitations under the License.
17*/}}
18
19set -ex
20
21{{ .Values.conf.script }}
diff --git a/shaker/templates/configmap-bin.yaml b/shaker/templates/configmap-bin.yaml
new file mode 100644
index 0000000..35773be
--- /dev/null
+++ b/shaker/templates/configmap-bin.yaml
@@ -0,0 +1,33 @@
1{{/*
2Copyright 2018 The Openstack-Helm Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
17{{- if .Values.manifests.configmap_bin }}
18{{- $envAll := . }}
19---
20apiVersion: v1
21kind: ConfigMap
22metadata:
23 name: shaker-bin
24data:
25{{- if .Values.images.local_registry.active }}
26 image-repo-sync.sh: |
27{{- include "helm-toolkit.scripts.image_repo_sync" . | indent 4 }}
28{{- end }}
29 ks-user.sh: |
30{{- include "helm-toolkit.scripts.keystone_user" . | indent 4 }}
31 run-tests.sh: |
32{{ tuple "bin/_run-tests.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
33{{- end }}
diff --git a/shaker/templates/configmap-etc.yaml b/shaker/templates/configmap-etc.yaml
new file mode 100644
index 0000000..49acc34
--- /dev/null
+++ b/shaker/templates/configmap-etc.yaml
@@ -0,0 +1,58 @@
1{{/*
2Copyright 2017 The Openstack-Helm Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
17{{- if .Values.manifests.configmap_etc }}
18{{- $envAll := . }}
19
20{{- if empty .Values.conf.shaker.auth.admin_username -}}
21{{- $_ := set .Values.conf.shaker.auth "admin_username" .Values.endpoints.identity.auth.admin.username -}}
22{{- end -}}
23{{- if empty .Values.conf.shaker.auth.admin_password -}}
24{{- $_ := set .Values.conf.shaker.auth "admin_password" .Values.endpoints.identity.auth.admin.password -}}
25{{- end -}}
26{{- if empty .Values.conf.shaker.auth.admin_project_name -}}
27{{- $_ := set .Values.conf.shaker.auth "admin_project_name" .Values.endpoints.identity.auth.admin.project_name -}}
28{{- end -}}
29{{- if empty .Values.conf.shaker.auth.admin_domain_name -}}
30{{- $_ := set .Values.conf.shaker.auth "admin_domain_name" .Values.endpoints.identity.auth.admin.user_domain_name -}}
31{{- end -}}
32{{- if empty .Values.conf.shaker.auth.admin_domain_scope -}}
33{{- $_ := set .Values.conf.shaker.auth "admin_domain_scope" .Values.endpoints.identity.auth.admin.user_domain_name -}}
34{{- end -}}
35
36{{- if empty .Values.conf.shaker.identity.uri_v3 -}}
37{{- $_ := tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set .Values.conf.shaker.identity "uri_v3" -}}
38{{- end -}}
39
40{{- if empty .Values.conf.shaker.identity.region -}}
41{{- $_ := set .Values.conf.shaker.identity "region" .Values.endpoints.identity.auth.admin.region_name -}}
42{{- end -}}
43
44---
45apiVersion: v1
46kind: Secret
47metadata:
48 name: shaker-etc
49type: Opaque
50data:
51 shaker.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.shaker.shaker | b64enc }}
52{{ if not (empty .Values.conf.basic) }}
53 test-basic: {{ include "shaker.utils.to_regex_file" .Values.conf.basic | b64enc }}
54{{ end }}
55{{ if not (empty .Values.conf.sriov) }}
56 test-sriov: {{ include "shaker.utils.to_regex_file" .Values.conf.sriov | b64enc }}
57{{ end }}
58{{- end }}
diff --git a/shaker/templates/job-image-repo-sync.yaml b/shaker/templates/job-image-repo-sync.yaml
new file mode 100644
index 0000000..8bfc357
--- /dev/null
+++ b/shaker/templates/job-image-repo-sync.yaml
@@ -0,0 +1,20 @@
1{{/*
2Copyright 2017 The Openstack-Helm Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
17{{- if and .Values.manifests.job_image_repo_sync .Values.images.local_registry.active }}
18{{- $imageRepoSyncJob := dict "envAll" . "serviceName" "shaker" -}}
19{{ $imageRepoSyncJob | include "helm-toolkit.manifests.job_image_repo_sync" }}
20{{- end }}
diff --git a/shaker/templates/job-ks-user.yaml b/shaker/templates/job-ks-user.yaml
new file mode 100644
index 0000000..172ac36
--- /dev/null
+++ b/shaker/templates/job-ks-user.yaml
@@ -0,0 +1,20 @@
1{{/*
2Copyright 2018 The Openstack-Helm Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
17{{- if .Values.manifests.job_ks_user }}
18{{- $ksUserJob := dict "envAll" . "serviceName" "shaker" -}}
19{{ $ksUserJob | include "helm-toolkit.manifests.job_ks_user" }}
20{{- end }}
diff --git a/shaker/templates/pod-shaker-test.yaml b/shaker/templates/pod-shaker-test.yaml
new file mode 100644
index 0000000..d2a7d8d
--- /dev/null
+++ b/shaker/templates/pod-shaker-test.yaml
@@ -0,0 +1,142 @@
1{{/*
2Copyright 2018 The Openstack-Helm Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
17{{- if .Values.manifests.pod_shaker_test }}
18{{- $envAll := . }}
19
20{{- $mounts_tests := .Values.pod.mounts.shaker_tests.shaker_tests }}
21{{- $mounts_tests_init := .Values.pod.mounts.shaker_tests.init_container }}
22
23{{- $serviceAccountName := print $envAll.Release.Name "-test" }}
24{{ tuple $envAll "run_tests" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
25---
26apiVersion: v1
27kind: Pod
28metadata:
29 name: {{ print $envAll.Release.Name "-run-tests" }}
30 labels:
31{{ tuple $envAll "shaker" "run-tests" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
32 annotations:
33 "helm.sh/hook": test-success
34spec:
35 nodeSelector:
36 {{ .Values.labels.pod.node_selector_key }}: {{ .Values.labels.pod.node_selector_value }}
37 serviceAccountName: {{ $serviceAccountName }}
38 restartPolicy: OnFailure
39 initContainers:
40{{ tuple $envAll "run_tests" $mounts_tests_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 4 }}
41 - name: {{ .Release.Name }}-test-ks-user
42{{ tuple $envAll "ks_user" | include "helm-toolkit.snippets.image" | indent 6 }}
43{{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_user | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
44 command:
45 - /tmp/ks-user.sh
46 volumeMounts:
47 - name: shaker-bin
48 mountPath: /tmp/ks-user.sh
49 subPath: ks-user.sh
50 readOnly: true
51 env:
52{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin }}
53{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
54{{- end }}
55 - name: SERVICE_OS_SERVICE_NAME
56 value: "shaker"
57{{- with $env := dict "ksUserSecret" .Values.secrets.identity.shaker }}
58{{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }}
59{{- end }}
60 - name: SERVICE_OS_ROLE
61 value: {{ .Values.endpoints.identity.auth.shaker.role | quote }}
62 - name: {{ .Release.Name }}-perms
63{{ tuple $envAll "shaker_run_tests" | include "helm-toolkit.snippets.image" | indent 6 }}
64 securityContext:
65 runAsUser: 0
66 privileged: true
67{{ tuple $envAll $envAll.Values.pod.resources.jobs.run_tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
68 command: ["/bin/sh", "-c"]
69 args:
70 - set -xe;
71 chmod 0777 /opt/shaker/data/;
72 chmod 0777 /opt/shaker-data/;
73 volumeMounts:
74 - name: shaker-reports
75 mountPath: /opt/shaker/data/
76 - name: shaker-data-host
77 mountPath: /opt/shaker-data/
78 containers:
79 - name: {{ .Release.Name }}-run-tests
80{{ tuple $envAll "shaker_run_tests" | include "helm-toolkit.snippets.image" | indent 6 }}
81{{ tuple $envAll $envAll.Values.pod.resources.jobs.run_tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
82 securityContext:
83 runAsUser: {{ .Values.pod.user.shaker.uid }}
84 privileged: false
85 env:
86{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin }}
87{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
88{{- end }}
89{{- with $env := dict "ksUserSecret" .Values.secrets.identity.shaker }}
90{{- include "helm-toolkit.snippets.keystone_user_create_env_vars" $env | indent 8 }}
91{{- end }}
92 - name: SHAKER_ENV_NAME
93 value: {{.Release.Name}}
94 - name: SHAKER_SCENARIO
95 value: {{ .Values.conf.shaker.shaker.DEFAULT.scenario }}
96 - name: SHAKER_SERVER_ENDPOINT
97 value: {{ .Values.conf.shaker.shaker.DEFAULT.server_endpoint }}
98 command:
99 - /tmp/run-tests.sh
100 volumeMounts:
101 - name: shaker-etc
102 mountPath: /etc/shaker/shaker_tests.yaml
103 subPath: shaker_tests.yaml
104 readOnly: true
105 - name: shaker-bin
106 mountPath: /tmp/run-tests.sh
107 subPath: run-tests.sh
108 readOnly: true
109 - name: shaker-db
110 mountPath: /opt/shaker/db/
111 - name: shaker-reports
112 mountPath: /opt/shaker/data/
113 - name: shaker-data-host
114 mountPath: /opt/shaker-data/
115 - name: shaker-etc
116 mountPath: /opt/shaker/shaker.conf
117 subPath: shaker.conf
118 readOnly: true
119{{ if $mounts_tests.volumeMounts }}{{ toYaml $mounts_tests.volumeMounts | indent 8 }}{{ end }}
120 volumes:
121 - name: shaker-etc
122 secret:
123 secretName: shaker-etc
124 defaultMode: 0444
125 - name: shaker-bin
126 configMap:
127 name: shaker-bin
128 defaultMode: 0555
129 - name: shaker-db
130 emptyDir: {}
131 - name: shaker-reports
132 {{- if not .Values.pvc.enabled }}
133 emptyDir: {}
134 {{- else }}
135 persistentVolumeClaim:
136 claimName: {{ .Values.pvc.name }}
137 {{- end }}
138 - name: shaker-data-host
139 hostPath:
140 path: /tmp/shaker-data
141{{ if $mounts_tests.volumes }}{{ toYaml $mounts_tests.volumes | indent 4 }}{{ end }}
142{{- end }}
diff --git a/shaker/templates/pvc-shaker.yaml b/shaker/templates/pvc-shaker.yaml
new file mode 100644
index 0000000..a7f25b7
--- /dev/null
+++ b/shaker/templates/pvc-shaker.yaml
@@ -0,0 +1,30 @@
1# {{/*
2# Copyright 2017 The Openstack-Helm Authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15# */}}
16
17{{- if .Values.pvc.enabled }}
18
19kind: PersistentVolumeClaim
20apiVersion: v1
21metadata:
22 name: {{ .Values.pvc.name }}
23spec:
24 accessModes:
25 - ReadWriteOnce
26 resources:
27 requests:
28 storage: {{ .Values.pvc.requests.storage }}
29 storageClassName: {{ .Values.pvc.storage_class }}
30{{- end }}
diff --git a/shaker/templates/secret-keystone.yaml b/shaker/templates/secret-keystone.yaml
new file mode 100644
index 0000000..63ec633
--- /dev/null
+++ b/shaker/templates/secret-keystone.yaml
@@ -0,0 +1,30 @@
1{{/*
2Copyright 2017 The Openstack-Helm Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
17{{- if .Values.manifests.secret_keystone }}
18{{- $envAll := . }}
19{{- range $key1, $userClass := tuple "admin" "shaker" }}
20{{- $secretName := index $envAll.Values.secrets.identity $userClass }}
21---
22apiVersion: v1
23kind: Secret
24metadata:
25 name: {{ $secretName }}
26type: Opaque
27data:
28{{- tuple $userClass "internal" $envAll | include "helm-toolkit.snippets.keystone_secret_openrc" | indent 2 -}}
29{{- end }}
30{{- end }}
diff --git a/shaker/templates/service-shaker.yaml b/shaker/templates/service-shaker.yaml
new file mode 100644
index 0000000..a01a1d4
--- /dev/null
+++ b/shaker/templates/service-shaker.yaml
@@ -0,0 +1,43 @@
1{{/*
2Copyright 2018 The Openstack-Helm Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
17{{- if .Values.manifests.service_shaker }}
18{{- $envAll := . }}
19---
20apiVersion: v1
21kind: Service
22metadata:
23 name: {{ tuple "shaker" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
24spec:
25 ports:
26 - name: shaker-api
27 protocol: TCP
28 port: {{ tuple "shaker" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
29 {{ if .Values.shaker.controller.node_port.enabled }}
30 nodePort: {{ .Values.shaker.controller.node_port.port }}
31 {{ end }}
32 targetPort: {{ tuple "shaker" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
33 selector:
34{{ tuple $envAll "shaker" "run-tests" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
35 {{ if .Values.shaker.controller.node_port.enabled }}
36 type: NodePort
37 {{ if .Values.shaker.controller.external_policy_local }}
38 externalTrafficPolicy: Local
39 {{ end }}
40 {{ end }}
41 externalIPs:
42 - {{ .Values.shaker.controller.external_ip }}
43{{- end }} \ No newline at end of file
diff --git a/shaker/values.yaml b/shaker/values.yaml
new file mode 100644
index 0000000..2e71150
--- /dev/null
+++ b/shaker/values.yaml
@@ -0,0 +1,251 @@
1# Copyright 2018 The Openstack-Helm Authors.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# Default values for shaker.
16# This is a YAML-formatted file.
17# Declare name/value pairs to be passed into your templates.
18# name: value
19
20labels:
21 job:
22 node_selector_key: openstack-control-plane
23 node_selector_value: enabled
24 pod:
25 node_selector_key: openstack-control-plane
26 node_selector_value: enabled
27
28images:
29 tags:
30 dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1
31 shaker_run_tests: docker.io/performa/shaker:latest
32 ks_user: docker.io/openstackhelm/heat:newton
33 image_repo_sync: docker.io/docker:17.07.0
34 pull_policy: "IfNotPresent"
35 local_registry:
36 active: false
37 exclude:
38 - dep_check
39 - image_repo_sync
40
41pod:
42 user:
43 shaker:
44 uid: 1000
45 resources:
46 enabled: false
47 jobs:
48 ks_user:
49 requests:
50 memory: "128Mi"
51 cpu: "100m"
52 limits:
53 memory: "1024Mi"
54 cpu: "2000m"
55 run_tests:
56 requests:
57 memory: "128Mi"
58 cpu: "100m"
59 limits:
60 memory: "1024Mi"
61 cpu: "2000m"
62 image_repo_sync:
63 requests:
64 memory: "128Mi"
65 cpu: "100m"
66 limits:
67 memory: "1024Mi"
68 cpu: "2000m"
69 mounts:
70 shaker_tests:
71 init_container: null
72 shaker_tests:
73
74shaker:
75 controller:
76 ingress:
77 public: true
78 classes:
79 namespace: "nginx"
80 cluster: "nginx-cluster"
81 annotations:
82 nginx.ingress.kubernetes.io/rewrite-target: /
83 external_policy_local: false
84 node_port:
85 enabled: true
86 port: 31999
87 external_ip: 9.9.9.9
88
89dependencies:
90 dynamic:
91 common:
92 local_image_registry:
93 jobs:
94 - shaker-image-repo-sync
95 services:
96 - endpoint: node
97 service: local_image_registry
98 static:
99 ks_user:
100 services:
101 - service: identity
102 endpoint: internal
103 run_tests:
104 jobs:
105 - shaker-ks-user
106 services:
107 - service: identity
108 endpoint: internal
109 image_repo_sync:
110 services:
111 - endpoint: internal
112 service: local_image_registry
113
114conf:
115 script: |
116 sed -i -E "s/(accommodation\: \[.+)(.+\])/accommodation\: \[pair, compute_nodes: 1\]/" /opt/shaker/shaker/scenarios/openstack/full_l2.yaml
117 export server_endpoint=\`ip a | grep "global eth0" | cut -f6 -d' ' | cut -f1 -d'/'\`
118
119 echo ========== SHAKER CONF PARAMETERS =================
120 cat /opt/shaker/shaker.conf
121 echo =====================================================
122
123 env -i HOME="$HOME" bash -l -c "printenv; shaker --server-endpoint \$server_endpoint:31999 --config-file /opt/shaker/shaker.conf"
124
125 shaker:
126 auth:
127 use_dynamic_credentials: true
128 admin_domain_scope: true
129 shaker_roles: admin, member
130 min_compute_nodes: 1
131 identity:
132 auth_version: v3
133 identity-feature-enabled:
134 api_v2: false
135 api_v3: true
136 shaker:
137 DEFAULT:
138 debug: true
139 cleanup_on_error: true
140 scenario_compute_nodes: 1
141 report: /opt/shaker/data/shaker-result.html
142 output: /opt/shaker/data/shaker-result.json
143 scenario: /opt/shaker/shaker/scenarios/openstack/full_l2.yaml
144 flavor_name: m1.small
145 external_net: public
146 image_name: shaker-image
147 scenario_availability_zone: nova
148 os_username: admin
149 os_password: password
150 os_auth_url: "http://keystone.openstack.svc.cluster.local/v3"
151 os_project_name: admin
152 os_region_name: RegionOne
153 os_identity_api_version: 3
154 os_interface: public
155 validation:
156 connect_method: floating
157 volume:
158 disk_formats: raw
159 backend_name: rbd1
160 storage_protocol: rbd
161 volume-feature-enabled:
162 api_v1: False
163 api_v3: True
164
165pvc:
166 enabled: true
167 name: pvc-shaker
168 requests:
169 storage: 2Gi
170 storage_class: general
171
172secrets:
173 identity:
174 admin: shaker-keystone-admin
175 shaker: shaker-keystone-user
176
177endpoints:
178 cluster_domain_suffix: cluster.local
179 local_image_registry:
180 name: docker-registry
181 namespace: docker-registry
182 hosts:
183 default: localhost
184 internal: docker-registry
185 node: localhost
186 host_fqdn_override:
187 default: null
188 port:
189 registry:
190 node: 5000
191 identity:
192 name: keystone
193 auth:
194 admin:
195 region_name: RegionOne
196 username: admin
197 password: password
198 project_name: admin
199 user_domain_name: default
200 project_domain_name: default
201 shaker:
202 role: admin
203 region_name: RegionOne
204 username: shaker
205 password: password
206 project_name: service
207 user_domain_name: service
208 project_domain_name: service
209 hosts:
210 default: keystone
211 internal: keystone-api
212 host_fqdn_override:
213 default: null
214 path:
215 default: /v3
216 scheme:
217 default: http
218 port:
219 api:
220 default: 80
221 internal: 5000
222 shaker:
223 name: shaker
224 hosts:
225 default: shaker
226 public: shaker
227 host_fqdn_override:
228 default: null
229 # NOTE(portdirect): this chart supports TLS for fqdn over-ridden public
230 # endpoints using the following format:
231 # public:
232 # host: null
233 # tls:
234 # crt: null
235 # key: null
236 path:
237 default: null
238 scheme:
239 default: 'http'
240 port:
241 api:
242 default: 31999
243 public: 80
244manifests:
245 configmap_bin: true
246 configmap_etc: true
247 job_image_repo_sync: true
248 job_ks_user: true
249 pod_shaker_test: true
250 service_shaker: true
251 secret_keystone: true
diff --git a/tools/gate/scripts/090-deploy-shaker.sh b/tools/gate/scripts/090-deploy-shaker.sh
new file mode 100755
index 0000000..1d604c7
--- /dev/null
+++ b/tools/gate/scripts/090-deploy-shaker.sh
@@ -0,0 +1,288 @@
1#!/bin/bash
2
3# Copyright 2018 The Openstack-Helm Authors.
4#
5# Licensed under the Apache License, Version 2.0 (the "License"); you may
6# not use this file except in compliance with the License. You may obtain
7# a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14# License for the specific language governing permissions and limitations
15# under the License.
16
17#-----------------------------------------------------------------------
18# Two ways to invoke this script
19#-----------------------------------------------------------------------
20# 1. Provide a shaker.conf file listing the shaker configuration params
21# which should go as input to shaker
22# 2. Provide the parameters explicitly
23#----------------------------------------------------------------------
24
25# (1):
26# sudo -H -E su -c 'export SHAKER_CONF_HOST="/tmp/shaker.conf"; \
27# export CLONE_SHAKER_SCENARIOS="false"; \
28# export SHAKER_SCENARIOS_REPO="https://git.openstack.org/openstack/shaker"; \
29# export COPY_SHAKER_REPORTS_ON_HOST="false"; \
30# cd $CURR_WORK/openstack-helm-addons; ./tools/gate/scripts/090-shaker.sh ${OSH_EXTRA_HELM_ARGS}' ${username}
31
32# (2):
33# sudo -H -E su -c 'export OSH_EXT_NET_NAME="public"; \
34# export OSH_EXT_SUBNET_NAME="public-subnet"; \
35# export OS_USERNAME="admin"; \
36# export OS_PASSWORD="password"; \
37# export OS_AUTH_URL="http://keystone.openstack.svc.cluster.local/v3"; \
38# export OS_PROJECT_NAME="admin"; \
39# export OS_REGION_NAME="RegionOne"; \
40# export OS_PROJECT_ID=""; \
41# export OS_PROJECT_DOMAIN_NAME="Default"; \
42# export OS_USER_DOMAIN_NAME="Default"; \
43# export OS_IDENTITY_API_VERSION=3; \
44# export EXTERNAL_NETWORK_NAME="public"; \
45# export SCENARIO="/opt/shaker/shaker/scenarios/openstack/full_l2.yaml"; \
46# export AVAILABILITY_ZONE="nova"; \
47# export FLAVOR_ID="shaker-flavor"; \
48# export IMAGE_NAME="shaker-image"; \
49# export SERVER_ENDPOINT_IP=""; \
50# export CLONE_SHAKER_SCENARIOS="false"; \
51# export SHAKER_SCENARIOS_REPO="https://git.openstack.org/openstack/shaker"; \
52# export COPY_SHAKER_REPORTS_ON_HOST="false"; \
53# cd $CURR_WORK/openstack-helm-addons; ./tools/gate/scripts/090-shaker.sh ${OSH_EXTRA_HELM_ARGS}' ${username}
54
55set -xe
56
57: ${OSH_EXT_NET_NAME:="public"}
58: ${OSH_EXT_SUBNET_NAME:="public-subnet"}
59: ${OSH_EXT_SUBNET:="172.24.4.0/24"}
60: ${OSH_BR_EX_ADDR:="172.24.4.1/24"}
61: ${OSH_PRIVATE_SUBNET_POOL:="11.0.0.0/8"}
62: ${OSH_PRIVATE_SUBNET_POOL_NAME:="shared-default-subnetpool"}
63: ${OSH_PRIVATE_SUBNET_POOL_DEF_PREFIX:="24"}
64: ${OSH_VM_KEY_STACK:="heat-vm-key"}
65: ${OSH_PRIVATE_SUBNET:="11.0.0.0/24"}
66
67# Shaker conf params
68: ${OS_USERNAME:="admin"}
69: ${OS_PASSWORD:="password"}
70: ${OS_AUTH_URL:="http://keystone.openstack.svc.cluster.local/v3"}
71: ${OS_PROJECT_NAME:="admin"}
72: ${OS_REGION_NAME:="RegionOne"}
73: ${OS_USER_DOMAIN_NAME:="Default"}
74: ${OS_PROJECT_DOMAIN_NAME:="Default"}
75: ${OS_PROJECT_ID:=""}
76: ${EXTERNAL_NETWORK_NAME:=$OSH_EXT_NET_NAME}
77: ${SCENARIO:="shaker/shaker/scenarios/openstack/full_l2.yaml"}
78: ${AVAILABILITY_ZONE:="nova"}
79: ${OS_IDENTITY_API_VERSION:="3"}
80: ${OS_INTERFACE:="public"}
81
82: ${REPORT_FILE:="shaker-result.html"}
83: ${OUTPUT_FILE:="shaker-result.json"}
84: ${FLAVOR_ID:="shaker-flavor"}
85: ${IMAGE_NAME:="shaker-image"}
86: ${SERVER_ENDPOINT_IP:=""}
87: ${SERVER_ENDPOINT_INTF:="eth0"}
88: ${SHAKER_PORT:=31999}
89: ${COMPUTE_NODES:=1}
90
91: ${EXECUTE_TEST:="true"}
92: ${DEBUG:="true"}
93: ${CLEANUP_ON_ERROR:="true"}
94: ${CLONE_SHAKER_SCENARIOS:="false"}
95: ${SHAKER_SCENARIOS_REPO:="https://git.openstack.org/openstack/shaker"}
96: ${COPY_SHAKER_REPORTS_ON_HOST:="false"}
97: ${SHAKER_CONF_HOST:=""}
98
99# DO NOT CHANGE: Change requires update in shaker charts
100: ${SHAKER_CONF:="/opt/shaker/shaker.conf"}
101: ${SHAKER_DATA:="/opt/shaker/data"}
102: ${SHAKER_DATA_HOSTPATH_MOUNT:="/opt/shaker-data"}
103: ${SHAKER_DATA_HOSTPATH:="/tmp/shaker-data"}
104
105#NOTE: Pull images and lint chart
106: ${OSH_PATH:="../openstack-helm"}
107make -C ${OSH_PATH} pull-images shaker
108
109#NOTE: Deploy command
110if [ ! -z ${SHAKER_CONF_HOST} ] && [ -f ${SHAKER_CONF_HOST} ]; then
111 SERVER_ENDPOINT_IP=`cat ${SHAKER_CONF_HOST} | awk '/server_endpoint/ {print $2}' | cut -f1 -d':'`
112 SHAKER_PORT=`cat ${SHAKER_CONF_HOST} | awk '/server_endpoint/ {print $2}' | cut -f2 -d':'`
113else
114 # Export AUTH variables required by shaker-image-builder utility
115 export OS_USERNAME=${OS_USERNAME}
116 export OS_PASSWORD=${OS_PASSWORD}
117 export OS_AUTH_URL=${OS_AUTH_URL}
118 export OS_PROJECT_NAME=${OS_PROJECT_NAME}
119 export OS_REGION_NAME=${OS_REGION_NAME}
120 export EXTERNAL_NETWORK_NAME=${EXTERNAL_NETWORK_NAME}
121 export OS_PROJECT_ID=${OS_PROJECT_ID}
122
123 if [ $OS_IDENTITY_API_VERSION = "3" ]; then
124 export OS_PROJECT_DOMAIN_NAME=${OS_PROJECT_DOMAIN_NAME}
125 export OS_USER_DOMAIN_NAME=${OS_USER_DOMAIN_NAME}
126 else
127 export OS_PROJECT_DOMAIN_NAME=
128 export OS_USER_DOMAIN_NAME=
129 fi
130
131 export stack_exists=`openstack network list | grep ${OSH_EXT_NET_NAME} | awk '{print $4}'`
132
133 if [ -z $stack_exists ]; then
134 openstack stack create --wait \
135 --parameter network_name=${OSH_EXT_NET_NAME} \
136 --parameter physical_network_name=${OSH_EXT_NET_NAME} \
137 --parameter subnet_name=${OSH_EXT_SUBNET_NAME} \
138 --parameter subnet_cidr=${OSH_EXT_SUBNET} \
139 --parameter subnet_gateway=${OSH_BR_EX_ADDR%/*} \
140 -t ${OSH_PATH}/tools/gate/files/heat-public-net-deployment.yaml \
141 heat-public-net-deployment
142 fi
143
144 default_sec_grp_id=`openstack security group list --project ${OS_PROJECT_NAME} | grep default | awk '{split(\$0,a,"|"); print a[2]}'`
145 for sg in $default_sec_grp_id
146 do
147 icmp=`openstack security group rule list $sg | grep icmp | awk '{split(\$0,a,"|"); print a[2]}'`
148 if [ "${icmp}" = "" ]; then openstack security group rule create --proto icmp $sg; fi
149 shaker=`openstack security group rule list $sg | grep tcp | grep ${SHAKER_PORT} | awk '{split(\$0,a,"|"); print a[2]}'`
150 if [ "${shaker}" = "" ]; then openstack security group rule create --proto tcp --dst-port ${SHAKER_PORT} $sg; fi
151 done
152
153 IMAGE_NAME=$(openstack image show -f value -c name \
154 $(openstack image list -f csv | awk -F ',' '{ print $2 "," $1 }' | \
155 grep "${IMAGE_NAME}" | head -1 | awk -F ',' '{ print $2 }' | tr -d '"'))
156
157 if [ -z $IMAGE_NAME ]; then
158 # Install shaker to use shaker-image-builder utility
159 sudo apt-add-repository "deb http://nova.clouds.archive.ubuntu.com/ubuntu/ trusty multiverse"
160 sudo apt-get update
161 sudo apt-get -y install python-dev libzmq-dev
162 sudo pip install pbr pyshaker
163
164 # Run shaker-image-builder utility to build shaker image
165 # For debug mode
166 # shaker-image-builder --nocleanup-on-error --debug
167 # For debug mode - with disk-image-builder mode
168 # shaker-image-builder --nocleanup-on-error --debug --image-builder-mode dib
169 shaker-image-builder
170
171 IMAGE_NAME=$(openstack image show -f value -c name \
172 $(openstack image list -f csv | awk -F ',' '{ print $2 "," $1 }' | \
173 grep "^\"shaker" | head -1 | awk -F ',' '{ print $2 }' | tr -d '"'))
174 fi
175
176 if [ $CLONE_SHAKER_SCENARIOS = "true" ]; then
177 SHAKER_SCENARIO="${SHAKER_DATA}/${SCENARIO}"
178 else
179 SHAKER_SCENARIO="/opt/${SCENARIO}"
180 fi
181fi
182
183#NOTE: Deploy shaker pods
184tee /tmp/shaker.yaml << EOF
185shaker:
186 controller:
187 external_ip: ${SERVER_ENDPOINT_IP}
188conf:
189 script: |
190 #!/bin/bash
191 set -xe
192
193 # Clone the shaker test-cases
194 if [ ${CLONE_SHAKER_SCENARIOS} = "true" ]; then
195 cd ${SHAKER_DATA}; git clone $SHAKER_SCENARIOS_REPO; cd -;
196 fi
197
198 if [ -z ${SERVER_ENDPOINT_IP} ]; then
199 export server_endpoint=\`ip a | grep "global ${SERVER_ENDPOINT_INTF}" | cut -f6 -d' ' | cut -f1 -d'/'\`
200 else
201 export server_endpoint=${SERVER_ENDPOINT_IP}
202 fi
203
204 echo ===========================
205 printenv | grep -i os_
206
207 echo ========== SHAKER CONF PARAMETERS =================
208 cat ${SHAKER_CONF}
209 echo =====================================================
210
211 env -i HOME="$HOME" bash -l -c "printenv; shaker --server-endpoint \$server_endpoint:${SHAKER_PORT} --config-file ${SHAKER_CONF}"
212
213 if [ $COPY_SHAKER_REPORTS_ON_HOST = "true" ]; then
214 export DATA_FOLDER_NAME=`date +%Y%m%d_%H%M%S`
215 mkdir ${SHAKER_DATA_HOSTPATH_MOUNT}/\$DATA_FOLDER_NAME
216 echo \$DATA_FOLDER_NAME > ${SHAKER_DATA_HOSTPATH_MOUNT}/latest-shaker-data-name.txt
217 declare -a file_extns_arr_to_copy=(html json subunit conf yaml stream)
218 for i in "\${file_extns_arr_to_copy[@]}"
219 do
220 if [ -e ${SHAKER_DATA}/*.\$i ]; then cp -avb ${SHAKER_DATA}/*.\$i ${SHAKER_DATA_HOSTPATH_MOUNT}/\$DATA_FOLDER_NAME/; fi
221 done
222 cp -avb ${SHAKER_CONF} ${SHAKER_DATA_HOSTPATH_MOUNT}/\$DATA_FOLDER_NAME/
223 fi
224EOF
225
226if [ -z ${SHAKER_CONF_HOST} ] || [ ! -f ${SHAKER_CONF_HOST} ]; then
227tee -a /tmp/shaker.yaml << EOF
228 shaker:
229 shaker:
230 DEFAULT:
231 debug: ${DEBUG}
232 cleanup_on_error: ${CLEANUP_ON_ERROR}
233 scenario_compute_nodes: ${COMPUTE_NODES}
234 report: ${SHAKER_DATA}/${REPORT_FILE}
235 output: ${SHAKER_DATA}/${OUTPUT_FILE}
236 scenario: ${SHAKER_SCENARIO}
237 flavor_name: ${FLAVOR_ID}
238 external_net: ${EXTERNAL_NETWORK_NAME}
239 image_name: ${IMAGE_NAME}
240 scenario_availability_zone: ${AVAILABILITY_ZONE}
241 os_username: ${OS_USERNAME}
242 os_password: ${OS_PASSWORD}
243 os_auth_url: ${OS_AUTH_URL}
244 os_project_name: ${OS_PROJECT_NAME}
245 os_region_name: ${OS_REGION_NAME}
246 os_identity_api_version: ${OS_IDENTITY_API_VERSION}
247 os_interface: ${OS_INTERFACE}
248EOF
249
250if [ $OS_IDENTITY_API_VERSION = "3" ]; then
251tee -a /tmp/shaker.yaml << EOF
252 os_project_domain_name: ${OS_PROJECT_DOMAIN_NAME}
253 os_user_domain_name: ${OS_USER_DOMAIN_NAME}
254EOF
255fi
256
257else
258
259echo " shaker:" >> /tmp/shaker.yaml
260echo " shaker:" >> /tmp/shaker.yaml
261cp ${SHAKER_CONF_HOST} ${SHAKER_CONF_HOST}.tmp
262sed -i -e 's/^/ /' ${SHAKER_CONF_HOST}.tmp
263cat ${SHAKER_CONF_HOST}.tmp >> /tmp/shaker.yaml
264rm -rf ${SHAKER_CONF_HOST}.tmp
265
266fi
267
268helm upgrade --install shaker ./shaker \
269 --namespace=openstack \
270 --values=/tmp/shaker.yaml \
271 ${OSH_EXTRA_HELM_ARGS} \
272 ${OSH_EXTRA_HELM_ARGS_SHAKER}
273
274#NOTE: Wait for deploy
275./tools/gate/scripts/wait-for-pods.sh openstack 2400
276
277#NOTE: Validate Deployment info
278kubectl get -n openstack jobs --show-all
279
280if [ -n $EXECUTE_TEST ]; then
281 helm test shaker --timeout 2700
282
283 if [ $COPY_SHAKER_REPORTS_ON_HOST = "true" ]; then
284 shaker_pod_name=`kubectl -n openstack get pods | grep shaker-run-tests | cut -f1 -d' '`
285 latest_data_folder=`cat ${SHAKER_DATA_HOSTPATH}/latest-shaker-data-name.txt`
286 kubectl -n openstack logs ${shaker_pod_name} > ${SHAKER_DATA_HOSTPATH}/${latest_data_folder}/${shaker_pod_name}.logs
287 fi
288fi