From 7a7c533e3ebe51d1b3939856810db8d1a59fcdbc Mon Sep 17 00:00:00 2001 From: Dustin Specker Date: Wed, 22 Jun 2022 11:28:18 -0500 Subject: [PATCH] upgrading subchart config only impacts subchart This verifies that making a configuration change to one of Umbrella's subcharts results in only the application (DaemonSet, Deployment or StatefulSet) for that subchart being updated. No other subchart's application should be updated. This only validates subcharts from openstack-helm-infra. Validating the remaining subcharts from openstack-helm will be done in the future. OpenStack Umbrella's default values for rabbitmq was configured to use a host path. This is so rabbitmq retains its data between StatefulSet changes. Otherwise components fail to authenticate with rabbitmq after the rabbitmq pods have been recreated. The OpenStack Umbrella Chart will use the `standard` storage class by default since that's what is provisioned via minikube. Change-Id: I8570e32e6ae03563037608d337f31066edf29755 --- openstack/Chart.yaml | 2 +- openstack/values.yaml | 3 + releasenotes/notes/openstack.yaml | 1 + ...-changes-do-not-update-other-components.sh | 64 +++++++++++++++++++ zuul.d/jobs-openstack-helm.yaml | 3 + 5 files changed, 72 insertions(+), 1 deletion(-) create mode 100755 tools/gate/tests/validate-umbrella-upgrade-config-changes-do-not-update-other-components.sh diff --git a/openstack/Chart.yaml b/openstack/Chart.yaml index 138310684e..d5eaf31a80 100644 --- a/openstack/Chart.yaml +++ b/openstack/Chart.yaml @@ -53,6 +53,6 @@ dependencies: description: A chart for openstack helm commmon deployment items name: openstack type: application -version: 0.1.1 +version: 0.1.2 maintainers: - name: OpenStack-Helm Authors diff --git a/openstack/values.yaml b/openstack/values.yaml index a9fddf99a0..b55689d784 100644 --- a/openstack/values.yaml +++ b/openstack/values.yaml @@ -18,6 +18,9 @@ rabbitmq: enabled: true volume: enabled: false + use_local_path: + enabled: true + host_path: /tmp/rabbitmq-data pod: replicas: server: 1 diff --git a/releasenotes/notes/openstack.yaml b/releasenotes/notes/openstack.yaml index 0d804f97a3..386bd1a504 100644 --- a/releasenotes/notes/openstack.yaml +++ b/releasenotes/notes/openstack.yaml @@ -2,4 +2,5 @@ openstack: - 0.1.0 Initial Chart - 0.1.1 Deploy compute-kit charts (neutron, nova, libvirt, openvswitch, placement) + - 0.1.2 Use host path storage for rabbitmq, so that rabbitmq retains data across pod recreation ... diff --git a/tools/gate/tests/validate-umbrella-upgrade-config-changes-do-not-update-other-components.sh b/tools/gate/tests/validate-umbrella-upgrade-config-changes-do-not-update-other-components.sh new file mode 100755 index 0000000000..c3beeffb65 --- /dev/null +++ b/tools/gate/tests/validate-umbrella-upgrade-config-changes-do-not-update-other-components.sh @@ -0,0 +1,64 @@ +#!/bin/bash +set -ex +set -o pipefail + +# This test case aims to prove that updating a subhcart's configuration for +# the OpenStack Umbrella Helm chart results in no other subcharts' components +# being updated. + +# This test case is proven by: +# 1. getting the list of DaemonSets, Deployment, StatefulSets after an installation +# 2. performing a helm upgrade with modifying a config specific to one subchart +# 3. getting the list of DaemonSets, Deployment, StatefulSets after the upgrade +# 4. Verifying the expected subchart application changes +# 5. Verifying no other applications are changed + +validate_only_expected_application_changes () { + local app_name="$1" + local config_change="$2" + + before_apps_list="$(mktemp)" + after_apps_list="$(mktemp)" + + kubectl get daemonsets,deployments,statefulsets \ + --namespace openstack \ + --no-headers \ + --output custom-columns=Kind:.kind,Name:.metadata.name,Generation:.status.observedGeneration \ + > "$before_apps_list" + + helm upgrade openstack ./openstack \ + --namespace openstack \ + --reuse-values \ + ${config_change} \ + --wait + + ./tools/deployment/common/wait-for-pods.sh openstack + + kubectl get daemonsets,deployments,statefulsets \ + --namespace openstack \ + --no-headers \ + --output custom-columns=Kind:.kind,Name:.metadata.name,Generation:.status.observedGeneration \ + > "$after_apps_list" + + # get list of apps that exist in after list, but not in before list + changed_apps="$(comm -13 "$before_apps_list" "$after_apps_list")" + + if ! echo "$changed_apps" | grep "$app_name" ; then + echo "Expected $app_name application to update" + exit 1 + fi + + # use awk to find applications not matching app_name and pretty format as Kind/Name + unexpected_changed_apps="$(echo "$changed_apps" | awk -v appname="$app_name" '$0 !~ appname { print $1 "/" $2 }')" + if [ "x$unexpected_changed_apps" != "x" ]; then + echo "Applications changed unexpectedly: $unexpected_changed_apps" + exit 1 + fi +} + + +validate_only_expected_application_changes "libvirt" "--set libvirt.conf.libvirt.log_level=2" +validate_only_expected_application_changes "mariadb" "--set mariadb.conf.database.config_override=[mysqld]\nlog_warnings=3" +validate_only_expected_application_changes "memcached" "--set memcached.conf.memcached.stats_cachedump.enabled=false" +validate_only_expected_application_changes "openvswitch" "--set openvswitch.pod.user.nova.uid=42425" +validate_only_expected_application_changes "rabbitmq" "--set rabbitmq.conf.rabbitmq.log.file.level=info" diff --git a/zuul.d/jobs-openstack-helm.yaml b/zuul.d/jobs-openstack-helm.yaml index 085471c4a3..edae880e5d 100644 --- a/zuul.d/jobs-openstack-helm.yaml +++ b/zuul.d/jobs-openstack-helm.yaml @@ -185,6 +185,8 @@ - ^tools/deployment/developer/common/170-setup-gateway.sh$ - ^tools/deployment/developer/common/900-use-it.sh$ - ^tools/gate/deploy-k8s.sh$ + - ^tools/gate/tests/validate-umbrella-upgrade-no-side-effects.sh$ + - ^tools/gate/tests/validate-umbrella-upgrade-config-changes-do-not-update-other-components.sh$ - ^zuul\.d/.*$ vars: run_helm_tests: "yes" @@ -199,6 +201,7 @@ - - ./tools/deployment/developer/common/900-use-it.sh - ./tools/deployment/common/force-cronjob-run.sh - ./tools/gate/tests/validate-umbrella-upgrade-no-side-effects.sh + - ./tools/gate/tests/validate-umbrella-upgrade-config-changes-do-not-update-other-components.sh - job: name: openstack-helm-compute-kit-ussuri-ubuntu_bionic