openstack-helm/tools/deployment/common/validate-umbrella-upgrade-no-side-effects.sh
Vladimir Kozhukalov 157cfe621c Run umbrella and tls test jobs on multinode envs
- Run TLS job on multinode env (5 nodes).
- Run umbrella job on multinode env. Update openstack
  umbrella chart values to work on multiple nodes
  (deploy mariadb and rabbit with general storage class).

Change-Id: I50eabc2e56646c2e75cc84aad2280a6bb1a44df0
2024-07-29 05:01:56 -05:00

47 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
set -ex
: ${OSH_HELM_REPO:="../openstack-helm"}
# This test confirms that upgrading a OpenStack Umbrella Helm release using
# --reuse-values does not result in any unexpected pods from being recreated.
# Ideally, no pods would be created if the upgrade has no configuration change.
# Unfortunately, some jobs have hooks defined such that each Helm release deletes
# and recreates jobs. These jobs are ignored in this test.
# This test aims to validate no Deployment, DaemonSet, or StatefulSet pods are
# changed by verifying the Observed Generation remains the same.
# This test case is proven by:
# 1. getting the list of DaemonSets, Deployment, StatefulSets after an installation
# 2. performing a helm upgrade with --reuse-values
# 3. getting the list of DaemonSets, Deployment, StatefulSets after the upgrade
# 4. Verifying the list is empty since no applications should have changed
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 ${OSH_HELM_REPO}/openstack \
--namespace openstack \
--reuse-values \
--wait
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 [ "x$changed_apps" != "x" ]; then
echo "Applications changed unexpectedly: $changed_apps"
exit 1
fi