Merge "upgrading subchart config only impacts subchart"

This commit is contained in:
Zuul 2022-07-11 18:24:57 +00:00 committed by Gerrit Code Review
commit 147f7fc582
5 changed files with 72 additions and 1 deletions

View File

@ -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

View File

@ -18,6 +18,9 @@ rabbitmq:
enabled: true
volume:
enabled: false
use_local_path:
enabled: true
host_path: /tmp/rabbitmq-data
pod:
replicas:
server: 1

View File

@ -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
...

View File

@ -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"

View File

@ -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