diff --git a/.zuul.yaml b/.zuul.yaml index d5ae9311..a9baf5c0 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -43,6 +43,7 @@ vars: osh_openstack_release: newton zuul_osh_infra_relative_path: ../openstack-helm-infra/ + zuul_osh_relative_path: ../openstack-helm/ timeout: 7200 pre-run: - tools/gate/playbooks/osh-infra-upgrade-host.yaml @@ -53,6 +54,7 @@ post-run: tools/gate/playbooks/osh-infra-collect-logs.yaml required-projects: - openstack/openstack-helm-infra + - openstack/openstack-helm nodeset: openstack-helm-ubuntu - job: diff --git a/ranger-agent/templates/deployment-ranger-agent-api.yaml b/ranger-agent/templates/deployment-ranger-agent-api.yaml index 1d2f7e36..3aa68c01 100755 --- a/ranger-agent/templates/deployment-ranger-agent-api.yaml +++ b/ranger-agent/templates/deployment-ranger-agent-api.yaml @@ -28,6 +28,8 @@ apiVersion: apps/v1beta1 kind: Deployment metadata: name: ranger-agent-api + annotations: + {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} spec: replicas: {{ .Values.pod.replicas.api }} {{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }} diff --git a/ranger-agent/templates/deployment-ranger-agent-engine.yaml b/ranger-agent/templates/deployment-ranger-agent-engine.yaml index 79bd5379..aaa99cdb 100755 --- a/ranger-agent/templates/deployment-ranger-agent-engine.yaml +++ b/ranger-agent/templates/deployment-ranger-agent-engine.yaml @@ -26,6 +26,8 @@ apiVersion: apps/v1beta1 kind: Deployment metadata: name: ranger-agent-engine + annotations: + {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} spec: replicas: {{ .Values.pod.replicas.engine }} {{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }} diff --git a/ranger-agent/values.yaml b/ranger-agent/values.yaml index aebaa21a..1493e5ad 100755 --- a/ranger-agent/values.yaml +++ b/ranger-agent/values.yaml @@ -35,8 +35,8 @@ labels: images: tags: - ranger_agent: quay.io/attcomdev/ranger-agent:5d29fd462bb85cf6c1b0acb25bfb898944e62b1a - ranger-agent_db_sync: quay.io/attcomdev/ranger-agent:5d29fd462bb85cf6c1b0acb25bfb898944e62b1a + ranger_agent: quay.io/attcomdev/ranger-agent:60529ac023bf550f0e9cb9e0eb4d4eb3dbf2d5c6 + ranger-agent_db_sync: quay.io/attcomdev/ranger-agent:60529ac023bf550f0e9cb9e0eb4d4eb3dbf2d5c6 db_drop: docker.io/openstackhelm/heat:newton db_init: docker.io/openstackhelm/heat:newton ks_user: docker.io/openstackhelm/heat:newton diff --git a/ranger/templates/deployment-ranger-services.yaml b/ranger/templates/deployment-ranger-services.yaml index 78551cac..009811bd 100755 --- a/ranger/templates/deployment-ranger-services.yaml +++ b/ranger/templates/deployment-ranger-services.yaml @@ -26,6 +26,8 @@ apiVersion: apps/v1beta1 kind: Deployment metadata: name: {{ $serviceAccountName }} + annotations: + {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} spec: replicas: {{ .Values.pod.replicas.ranger }} {{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }} diff --git a/ranger/values.yaml b/ranger/values.yaml index 1e434b19..800e85b2 100755 --- a/ranger/values.yaml +++ b/ranger/values.yaml @@ -32,8 +32,8 @@ labels: images: tags: - ranger: docker.io/hosingh000/ranger:0.1.0 - ranger_db_sync: docker.io/hosingh000/ranger:0.1.0 + ranger: quay.io/attcomdev/ranger:d376b6059733a4d9b0c47d1c8ba1edf98c8953e3 + ranger_db_sync: quay.io/attcomdev/ranger:d376b6059733a4d9b0c47d1c8ba1edf98c8953e3 db_drop: docker.io/openstackhelm/heat:newton db_init: docker.io/openstackhelm/heat:newton dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1 @@ -54,27 +54,27 @@ conf: pecan_debug: True ranger_base: '/home/ranger/ranger' ssl_verify: False - log_location: '/var/log/ranger' + use_handlers: console ranger_agent_https_enable: False ranger_agent_client_cert_path: '' cms: - log: cms.log + log: null fms: - log: fms.log + log: null ims: - log: ims.log + log: null rms: - log: rms.log + log: null rds: - log: rds.log + log: null repo_local_location: /home/ranger/git_repo repo_remote_location: git@127.0.0.1:/home/repo/ORM.git repo_user: orm repo_email: orm@test.com uuid: - log: uuid.log + log: null audit: - log: audit.log + log: null cli: base_region: RegionOne database: @@ -82,6 +82,7 @@ conf: keystone_authtoken: auth_type: password auth_version: v3 + auth_enabled: False ssh: user: ranger user_home: /home/ranger diff --git a/tools/gate/playbooks/osh-addons-check.yaml b/tools/gate/playbooks/osh-addons-check.yaml index f222a906..6cb64f23 100644 --- a/tools/gate/playbooks/osh-addons-check.yaml +++ b/tools/gate/playbooks/osh-addons-check.yaml @@ -17,6 +17,58 @@ - name: Build Charts shell: | set -xe; - ./tools/gate/scripts/build-charts.sh + ./tools/gate/scripts/010-setup-client.sh + args: + chdir: "{{ zuul_osh_addons_relative_path | default(zuul.project.src_dir) }}" + - name: Deploy MariaDB + environment: + OSH_EXTRA_HELM_ARGS: "{{ zuul_osh_extra_helm_args_relative_path | default('') }}" + OSH_INFRA_PATH: "{{ zuul_osh_infra_relative_path | default('') }}" + zuul_site_mirror_fqdn: "{{ zuul_site_mirror_fqdn }}" + shell: | + set -xe; + ./tools/gate/scripts/020-deploy-mariadb.sh + args: + chdir: "{{ zuul_osh_addons_relative_path | default(zuul.project.src_dir) }}" + - name: Deploy RabbitMQ + environment: + OSH_EXTRA_HELM_ARGS: "{{ zuul_osh_extra_helm_args_relative_path | default('') }}" + OSH_INFRA_PATH: "{{ zuul_osh_infra_relative_path | default('') }}" + zuul_site_mirror_fqdn: "{{ zuul_site_mirror_fqdn }}" + shell: | + set -xe; + ./tools/gate/scripts/030-deploy-rabbitmq.sh + args: + chdir: "{{ zuul_osh_addons_relative_path | default(zuul.project.src_dir) }}" + - name: Deploy Memcached + environment: + OSH_EXTRA_HELM_ARGS: "{{ zuul_osh_extra_helm_args_relative_path | default('') }}" + OSH_INFRA_PATH: "{{ zuul_osh_infra_relative_path | default('') }}" + zuul_site_mirror_fqdn: "{{ zuul_site_mirror_fqdn }}" + shell: | + set -xe; + ./tools/gate/scripts/040-deploy-memcached.sh + args: + chdir: "{{ zuul_osh_addons_relative_path | default(zuul.project.src_dir) }}" + - name: Deploy Keystone + environment: + OSH_EXTRA_HELM_ARGS: "{{ zuul_osh_extra_helm_args_relative_path | default('') }}" + OSH_PATH: "{{ zuul_osh_relative_path | default('') }}" + zuul_site_mirror_fqdn: "{{ zuul_site_mirror_fqdn }}" + shell: | + set -xe; + ./tools/gate/scripts/050-deploy-keystone.sh + args: + chdir: "{{ zuul_osh_addons_relative_path | default(zuul.project.src_dir) }}" + - name: Deploy Ranger Charts + shell: | + set -xe; + ./tools/gate/scripts/060-deploy-ranger.sh + args: + chdir: "{{ zuul_osh_addons_relative_path | default(zuul.project.src_dir) }}" + - name: Deploy Ranger Agent Charts + shell: | + set -xe; + ./tools/gate/scripts/070-deploy-ranger-agent.sh args: chdir: "{{ zuul_osh_addons_relative_path | default(zuul.project.src_dir) }}" diff --git a/tools/gate/scripts/010-setup-client.sh b/tools/gate/scripts/010-setup-client.sh new file mode 100755 index 00000000..60acf31f --- /dev/null +++ b/tools/gate/scripts/010-setup-client.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# 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. + +set -xe + +sudo -H -E pip install "cmd2<=0.8.7" +sudo -H -E pip install python-openstackclient python-heatclient --ignore-installed + +sudo -H mkdir -p /etc/openstack +sudo -H chown -R $(id -un): /etc/openstack +tee /etc/openstack/clouds.yaml << EOF +clouds: + openstack_helm: + region_name: RegionOne + identity_api_version: 3 + auth: + username: 'admin' + password: 'password' + project_name: 'admin' + project_domain_name: 'default' + user_domain_name: 'default' + auth_url: 'http://keystone.openstack.svc.cluster.local/v3' +EOF + +#NOTE: Build charts +make all diff --git a/tools/gate/scripts/020-deploy-mariadb.sh b/tools/gate/scripts/020-deploy-mariadb.sh new file mode 100755 index 00000000..6df6216d --- /dev/null +++ b/tools/gate/scripts/020-deploy-mariadb.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# 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. + +set -xe + +#NOTE: Lint and package chart +: ${OSH_INFRA_PATH:="../openstack-helm-infra"} +make -C ${OSH_INFRA_PATH} mariadb + +#NOTE: Deploy command +: ${OSH_EXTRA_HELM_ARGS:=""} +helm upgrade --install mariadb ${OSH_INFRA_PATH}/mariadb \ + --namespace=openstack \ + --set pod.replicas.server=1 \ + --set volume.enabled=false \ + ${OSH_EXTRA_HELM_ARGS} \ + ${OSH_EXTRA_HELM_ARGS_MARIADB} + +#NOTE: Wait for deploy +./tools/gate/scripts/wait-for-pods.sh openstack + +#NOTE: Validate Deployment info +helm status mariadb diff --git a/tools/gate/scripts/030-deploy-rabbitmq.sh b/tools/gate/scripts/030-deploy-rabbitmq.sh new file mode 100755 index 00000000..c5d09149 --- /dev/null +++ b/tools/gate/scripts/030-deploy-rabbitmq.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# 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. + +set -xe + +#NOTE: Lint and package chart +: ${OSH_INFRA_PATH:="../openstack-helm-infra"} +make -C ${OSH_INFRA_PATH} rabbitmq + +#NOTE: Deploy command +: ${OSH_EXTRA_HELM_ARGS:=""} +helm upgrade --install rabbitmq ${OSH_INFRA_PATH}/rabbitmq \ + --namespace=openstack \ + --set pod.replicas.server=1 \ + --set volume.enabled=false \ + ${OSH_EXTRA_HELM_ARGS} \ + ${OSH_EXTRA_HELM_ARGS_RABBITMQ} + +#NOTE: Wait for deploy +./tools/gate/scripts/wait-for-pods.sh openstack + +#NOTE: Validate Deployment info +helm status rabbitmq diff --git a/tools/gate/scripts/040-deploy-memcached.sh b/tools/gate/scripts/040-deploy-memcached.sh new file mode 100755 index 00000000..78c4e42c --- /dev/null +++ b/tools/gate/scripts/040-deploy-memcached.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# 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. + +set -xe + +#NOTE: Lint and package chart +: ${OSH_INFRA_PATH:="../openstack-helm-infra"} +make -C ${OSH_INFRA_PATH} memcached + +#NOTE: Deploy command +: ${OSH_EXTRA_HELM_ARGS:=""} +helm upgrade --install memcached ${OSH_INFRA_PATH}/memcached \ + --namespace=openstack \ + ${OSH_EXTRA_HELM_ARGS} \ + ${OSH_EXTRA_HELM_ARGS_MEMCACHED} + +#NOTE: Wait for deploy +./tools/gate/scripts/wait-for-pods.sh openstack + +#NOTE: Validate Deployment info +helm status memcached diff --git a/tools/gate/scripts/build-charts.sh b/tools/gate/scripts/050-deploy-keystone.sh similarity index 60% rename from tools/gate/scripts/build-charts.sh rename to tools/gate/scripts/050-deploy-keystone.sh index 0981807d..8e27528c 100755 --- a/tools/gate/scripts/build-charts.sh +++ b/tools/gate/scripts/050-deploy-keystone.sh @@ -16,4 +16,19 @@ set -xe -make all +#NOTE: Lint and package chart +: ${OSH_PATH:="../openstack-helm"} +make -C ${OSH_PATH} keystone + +#NOTE: Deploy command +: ${OSH_EXTRA_HELM_ARGS:=""} +helm upgrade --install keystone ${OSH_PATH}/keystone \ + --namespace=openstack \ + ${OSH_EXTRA_HELM_ARGS} \ + ${OSH_EXTRA_HELM_ARGS_KEYSTONE} + +#NOTE: Wait for deploy +./tools/gate/scripts/wait-for-pods.sh openstack + +#NOTE: Validate Deployment info +helm status keystone \ No newline at end of file diff --git a/tools/gate/scripts/060-deploy-ranger.sh b/tools/gate/scripts/060-deploy-ranger.sh new file mode 100755 index 00000000..8e17870f --- /dev/null +++ b/tools/gate/scripts/060-deploy-ranger.sh @@ -0,0 +1,24 @@ +set -xe + +#NOTE: Deploy command + +#NOTE: override file +tee /tmp/ranger.yaml << EOF +conf: + ranger: + DEFAULT: + ranger_agent_https_enable: true + ranger_agent_client_cert_path: '/home/ranger/ord.cert' + ssh: + ssh_key: null + ssh_config: null + cert: + ranger_agent_client_cert: null +EOF + +helm upgrade --install ranger ./ranger \ + --namespace=openstack \ + --values=/tmp/ranger.yaml + +#NOTE: Wait for deploy +./tools/gate/scripts/wait-for-pods.sh openstack diff --git a/tools/gate/scripts/070-deploy-ranger-agent.sh b/tools/gate/scripts/070-deploy-ranger-agent.sh new file mode 100755 index 00000000..9b86afb4 --- /dev/null +++ b/tools/gate/scripts/070-deploy-ranger-agent.sh @@ -0,0 +1,78 @@ +set -xe + +#NOTE: Deploy command + +#NOTE: override file +tee /tmp/ranger-agent.yaml << EOF +conf: + ranger_agent: + DEFAULT: + enable_rds_callback_check: False + ssh: + ssh_key: null + ssh_config: null +dependencies: + static: + api: + jobs: + - ranger-agent-db-sync + - ranger-agent-ks-user + - ranger-agent-ks-endpoints + - ranger-agent-rabbit-init + services: + - service: oslo_db + endpoint: internal + engine: + jobs: + - ranger-agent-db-sync + - ranger-agent-ks-user + - ranger-agent-rabbit-init + services: + - service: oslo_db + endpoint: internal + - service: identity + endpoint: internal + db_init: + services: + - service: oslo_db + endpoint: internal + db_sync: + jobs: + - ranger-agent-db-init + services: + - service: oslo_db + endpoint: internal + db_drop: + services: + - service: oslo_db + endpoint: internal + ks_user: + services: + - service: identity + endpoint: internal + ks_service: + services: + - service: identity + endpoint: internal + ks_endpoints: + jobs: + - ranger-agent-ks-service + services: + - service: identity + endpoint: internal + rabbit_init: + services: + - service: oslo_messaging + endpoint: internal + image_repo_sync: + services: + - endpoint: internal + service: local_image_registry +EOF + +helm upgrade --install ranger-agent ./ranger-agent \ + --namespace=openstack \ + --values=/tmp/ranger-agent.yaml + +#NOTE: Wait for deploy +./tools/gate/scripts/wait-for-pods.sh openstack diff --git a/tools/gate/scripts/wait-for-pods.sh b/tools/gate/scripts/wait-for-pods.sh new file mode 100755 index 00000000..3dfc8a8f --- /dev/null +++ b/tools/gate/scripts/wait-for-pods.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# 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. +set -e + +# From Kolla-Kubernetes, orginal authors Kevin Fox & Serguei Bezverkhi +# Default wait timeout is 600 seconds +end=$(date +%s) +if ! [ -z $2 ]; then + end=$((end + $2)) +else + end=$((end + 900)) +fi +while true; do + kubectl get pods --namespace=$1 -o json | jq -r \ + '.items[].status.phase' | grep Pending > /dev/null && \ + PENDING=True || PENDING=False + query='.items[]|select(.status.phase=="Running")' + query="$query|.status.containerStatuses[].ready" + kubectl get pods --namespace=$1 -o json | jq -r "$query" | \ + grep false > /dev/null && READY="False" || READY="True" + kubectl get jobs -o json --namespace=$1 | jq -r \ + '.items[] | .spec.completions == .status.succeeded' | \ + grep false > /dev/null && JOBR="False" || JOBR="True" + [ $PENDING == "False" -a $READY == "True" -a $JOBR == "True" ] && \ + break || true + sleep 5 + now=$(date +%s) + [ $now -gt $end ] && echo containers failed to start. && \ + kubectl get pods --namespace $1 -o wide && exit -1 +done \ No newline at end of file