From cede6c0d482b22258c60b6f7ea9e24ac6cfcf68d Mon Sep 17 00:00:00 2001
From: Pete Birley <pete@port.direct>
Date: Sat, 22 Jun 2019 07:45:01 -0500
Subject: [PATCH] Gate: Simpler multiple distro/over-ride support

This PS indroduces a simpler way to incorp over-rides into gate
runs, and also ensures that they are scoped to a single chart, rather
than all of the charts deployed within a gate run.

Depends-On: https://review.opendev.org/666957

Change-Id: I49edf52cc1fc5ec60ee9754c28880c9c0c54492e
Signed-off-by: Pete Birley <pete@port.direct>
---
 .../values_overrides/ldap.yaml                |   0
 .../deployment/common/get-values-overrides.sh |  71 ++++++++++
 tools/deployment/common/install-packages.sh   |   3 +-
 .../component/ceph/ceph-ns-activate.sh        |  12 +-
 tools/deployment/component/ceph/ceph.sh       |  15 +-
 tools/deployment/component/cinder/cinder.sh   |   7 +-
 tools/deployment/component/common/ingress.sh  |  18 +--
 tools/deployment/component/common/ldap.sh     |  44 ++++++
 tools/deployment/component/common/mariadb.sh  |  11 +-
 .../deployment/component/common/memcached.sh  |  11 +-
 tools/deployment/component/common/rabbitmq.sh |  12 +-
 .../component/compute-kit/compute-kit.sh      |  18 ++-
 .../component/compute-kit/libvirt.sh          |  12 +-
 .../component/compute-kit/openvswitch.sh      |  13 +-
 tools/deployment/component/glance/glance.sh   |   6 +-
 tools/deployment/component/heat/heat.sh       |   6 +-
 tools/deployment/component/horizon/horizon.sh |   6 +-
 .../component/keystone/keystone-ldap.sh       |  82 -----------
 .../deployment/component/keystone/keystone.sh |  33 ++++-
 zuul.d/jobs-openstack-helm.yaml               | 131 ++++++++++--------
 20 files changed, 309 insertions(+), 202 deletions(-)
 rename tools/overrides/keystone/ldap_domain_config.yaml => keystone/values_overrides/ldap.yaml (100%)
 create mode 100755 tools/deployment/common/get-values-overrides.sh
 create mode 100755 tools/deployment/component/common/ldap.sh
 delete mode 100755 tools/deployment/component/keystone/keystone-ldap.sh

diff --git a/tools/overrides/keystone/ldap_domain_config.yaml b/keystone/values_overrides/ldap.yaml
similarity index 100%
rename from tools/overrides/keystone/ldap_domain_config.yaml
rename to keystone/values_overrides/ldap.yaml
diff --git a/tools/deployment/common/get-values-overrides.sh b/tools/deployment/common/get-values-overrides.sh
new file mode 100755
index 0000000000..baf604e875
--- /dev/null
+++ b/tools/deployment/common/get-values-overrides.sh
@@ -0,0 +1,71 @@
+#!/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.
+
+# This script will generate a matrix of values-override file args to apply to
+# charts, in the gate and development environments. It will 1st produce a
+# consistenly ordered list of all permuations of filenames to try, and then
+# if a file matching this name exists in the `values_overrides` directory within
+# each chart, apply it upon install/upgrade.
+
+set -e
+HELM_CHART="$1"
+: "${HELM_CHART_ROOT_PATH:="../openstack-helm"}"
+: "${OPENSTACK_RELEASE:="ocata"}"
+: "${CONTAINER_DISTRO_NAME:="ubuntu"}"
+: "${CONTAINER_DISTRO_VERSION:="xenial"}"
+: "${FEATURE_GATES:=""}"
+OSH_FEATURE_MIX="${FEATURE_GATES},${OPENSTACK_RELEASE},${CONTAINER_DISTRO_NAME}_${CONTAINER_DISTRO_VERSION},${CONTAINER_DISTRO_NAME}"
+
+function echoerr () {
+  echo "$@" 1>&2;
+}
+
+function generate_awk_exp_from_mask () {
+  local POSITION=1
+  for VALUE in $@; do
+    [ "${VALUE}" -eq 1 ] && echo -n "print \$${POSITION};"
+    POSITION=$((POSITION+1))
+  done
+  echo -e "\n"
+}
+
+function combination () {
+  POWER=$((2**$#))
+  BITS="$(awk "BEGIN { while (c++ < $#) printf \"0\" }")"
+  while [ "${POWER}" -gt 1 ];do
+    POWER=$((POWER-1))
+    BIN="$(bc <<< "obase=2; ${POWER}")"
+    MASK="$(echo "${BITS}" | sed -e "s/0\{${#BIN}\}$/$BIN/" | grep -o .)"
+    #NOTE: This line is odd, but written to support both BSD and GNU utils
+    awk -v ORS="-" "{$(generate_awk_exp_from_mask "$MASK")}" <<< "$@" | awk 1 | sed 's/-$//'
+  done
+}
+
+function override_file_args () {
+    OVERRIDE_ARGS=""
+    echoerr "We will attempt to use values-override files with the following paths:"
+    for FILE in $(combination ${1//,/ } | uniq | tac); do
+      FILE_PATH="${HELM_CHART_ROOT_PATH}/${HELM_CHART}/values_overrides/${FILE}.yaml"
+       if [ -f "${FILE_PATH}" ]; then
+        OVERRIDE_ARGS+=" --values=${FILE_PATH} "
+       fi
+       echoerr "${FILE_PATH}"
+    done
+    echo "${OVERRIDE_ARGS}"
+}
+
+echoerr "We are going to deploy the service ${HELM_CHART} for the OpenStack ${OPENSTACK_RELEASE} release, using ${CONTAINER_DISTRO_NAME} (${CONTAINER_DISTRO_VERSION}) distribution containers."
+override_file_args "${OSH_FEATURE_MIX}"
diff --git a/tools/deployment/common/install-packages.sh b/tools/deployment/common/install-packages.sh
index fb83bc3ea8..6a126eb6e0 100755
--- a/tools/deployment/common/install-packages.sh
+++ b/tools/deployment/common/install-packages.sh
@@ -24,4 +24,5 @@ sudo apt-get install --no-install-recommends -y \
         jq \
         nmap \
         curl \
-        uuid-runtime
+        uuid-runtime \
+        bc
diff --git a/tools/deployment/component/ceph/ceph-ns-activate.sh b/tools/deployment/component/ceph/ceph-ns-activate.sh
index 7f7f2a172a..110397837b 100755
--- a/tools/deployment/component/ceph/ceph-ns-activate.sh
+++ b/tools/deployment/component/ceph/ceph-ns-activate.sh
@@ -16,12 +16,14 @@
 
 set -xe
 
+#NOTE: Get the over-rides to use
+export HELM_CHART_ROOT_PATH="${HELM_CHART_ROOT_PATH:="${OSH_INFRA_PATH:="../openstack-helm-infra"}"}"
+: ${OSH_EXTRA_HELM_ARGS_CEPH_NS_ACTIVATE:="$(./tools/deployment/common/get-values-overrides.sh ceph-provisioners)"}
+
 #NOTE: Lint and package chart
-: ${OSH_INFRA_PATH:="../openstack-helm-infra"}
-make -C ${OSH_INFRA_PATH} ceph-provisioners
+make -C ${HELM_CHART_ROOT_PATH} ceph-provisioners
 
 #NOTE: Deploy command
-: ${OSH_EXTRA_HELM_ARGS:=""}
 tee /tmp/ceph-openstack-config.yaml <<EOF
 endpoints:
   identity:
@@ -46,10 +48,10 @@ conf:
   rgw_ks:
     enabled: true
 EOF
-helm upgrade --install ceph-openstack-config ${OSH_INFRA_PATH}/ceph-provisioners \
+helm upgrade --install ceph-openstack-config ${HELM_CHART_ROOT_PATH}/ceph-provisioners \
   --namespace=openstack \
   --values=/tmp/ceph-openstack-config.yaml \
-  ${OSH_EXTRA_HELM_ARGS} \
+  ${OSH_EXTRA_HELM_ARGS:=} \
   ${OSH_EXTRA_HELM_ARGS_CEPH_NS_ACTIVATE}
 
 #NOTE: Wait for deploy
diff --git a/tools/deployment/component/ceph/ceph.sh b/tools/deployment/component/ceph/ceph.sh
index f03ed82994..2dd5cb6196 100755
--- a/tools/deployment/component/ceph/ceph.sh
+++ b/tools/deployment/component/ceph/ceph.sh
@@ -17,14 +17,12 @@
 set -xe
 
 #NOTE: Lint and package chart
-: ${OSH_INFRA_PATH:="../openstack-helm-infra"}
+export HELM_CHART_ROOT_PATH="${HELM_CHART_ROOT_PATH:="${OSH_INFRA_PATH:="../openstack-helm-infra"}"}"
 for CHART in ceph-mon ceph-osd ceph-client ceph-provisioners; do
-  make -C ${OSH_INFRA_PATH} "${CHART}"
+  make -C ${HELM_CHART_ROOT_PATH} "${CHART}"
 done
 
 #NOTE: Deploy command
-
-: ${OSH_EXTRA_HELM_ARGS:=""}
 [ -s /tmp/ceph-fs-uuid.txt ] || uuidgen > /tmp/ceph-fs-uuid.txt
 CEPH_FS_ID="$(cat /tmp/ceph-fs-uuid.txt)"
 #NOTE(portdirect): to use RBD devices with Ubuntu kernels < 4.5 this
@@ -188,11 +186,14 @@ manifests:
 EOF
 
 for CHART in ceph-mon ceph-osd ceph-client ceph-provisioners; do
-  helm upgrade --install ${CHART} ${OSH_INFRA_PATH}/${CHART} \
+  #NOTE: Get the over-rides to use
+  : ${OSH_EXTRA_HELM_ARGS_CEPH:="$(./tools/deployment/common/get-values-overrides.sh ${CHART})"}
+
+  helm upgrade --install ${CHART} ${HELM_CHART_ROOT_PATH}/${CHART} \
     --namespace=ceph \
     --values=/tmp/ceph.yaml \
-    ${OSH_EXTRA_HELM_ARGS} \
-    ${OSH_EXTRA_HELM_ARGS_CEPH_DEPLOY}
+    ${OSH_EXTRA_HELM_ARGS:=} \
+    ${OSH_EXTRA_HELM_ARGS_CEPH}
 
   #NOTE: Wait for deploy
   ./tools/deployment/common/wait-for-pods.sh ceph
diff --git a/tools/deployment/component/cinder/cinder.sh b/tools/deployment/component/cinder/cinder.sh
index 6888e66a3e..789e8d8728 100755
--- a/tools/deployment/component/cinder/cinder.sh
+++ b/tools/deployment/component/cinder/cinder.sh
@@ -15,11 +15,13 @@
 #    under the License.
 set -xe
 
+#NOTE: Get the over-rides to use
+: ${OSH_EXTRA_HELM_ARGS_CINDER:="$(./tools/deployment/common/get-values-overrides.sh cinder)"}
+
 #NOTE: Lint and package chart
 make cinder
 
 #NOTE: Deploy command
-: ${OSH_EXTRA_HELM_ARGS:=""}
 tee /tmp/cinder.yaml <<EOF
 conf:
   ceph:
@@ -36,8 +38,7 @@ EOF
 helm upgrade --install cinder ./cinder \
   --namespace=openstack \
   --values=/tmp/cinder.yaml \
-  ${OSH_EXTRA_HELM_ARGS} \
-  ${OSH_VALUES_OVERRIDES_HELM_ARGS:=} \
+  ${OSH_EXTRA_HELM_ARGS:=} \
   ${OSH_EXTRA_HELM_ARGS_CINDER}
 
 #NOTE: Wait for deploy
diff --git a/tools/deployment/component/common/ingress.sh b/tools/deployment/component/common/ingress.sh
index 1aa2a62f28..f571805bcf 100755
--- a/tools/deployment/component/common/ingress.sh
+++ b/tools/deployment/component/common/ingress.sh
@@ -16,10 +16,12 @@
 
 set -xe
 
+#NOTE: Get the over-rides to use
+export HELM_CHART_ROOT_PATH="${HELM_CHART_ROOT_PATH:="${OSH_INFRA_PATH:="../openstack-helm-infra"}"}"
+: ${OSH_EXTRA_HELM_ARGS_INGRESS:="$(./tools/deployment/common/get-values-overrides.sh ingress)"}
+
 #NOTE: Lint and package chart
-: ${OSH_INFRA_PATH:="../openstack-helm-infra"}
-: ${OSH_EXTRA_HELM_ARGS:=""}
-make -C ${OSH_INFRA_PATH} ingress
+make -C ${HELM_CHART_ROOT_PATH} ingress
 
 #NOTE: Deploy command
 tee /tmp/ingress-kube-system.yaml << EOF
@@ -29,11 +31,11 @@ deployment:
 network:
   host_namespace: true
 EOF
-helm upgrade --install ingress-kube-system ${OSH_INFRA_PATH}/ingress \
+helm upgrade --install ingress-kube-system ${HELM_CHART_ROOT_PATH}/ingress \
   --namespace=kube-system \
   --values=/tmp/ingress-kube-system.yaml \
-  ${OSH_EXTRA_HELM_ARGS} \
-  ${OSH_VALUES_OVERRIDES_HELM_ARGS:=} \
+  ${OSH_EXTRA_HELM_ARGS:=} \
+  ${OSH_EXTRA_HELM_ARGS_INGRESS} \
   ${OSH_EXTRA_HELM_ARGS_INGRESS_KUBE_SYSTEM}
 
 #NOTE: Wait for deploy
@@ -45,8 +47,8 @@ helm status ingress-kube-system
 #NOTE: Deploy namespace ingress
 helm upgrade --install ingress-openstack ${OSH_INFRA_PATH}/ingress \
   --namespace=openstack \
-  ${OSH_EXTRA_HELM_ARGS} \
-  ${OSH_VALUES_OVERRIDES_HELM_ARGS:=} \
+  ${OSH_EXTRA_HELM_ARGS:=} \
+  ${OSH_EXTRA_HELM_ARGS_INGRESS} \
   ${OSH_EXTRA_HELM_ARGS_INGRESS_OPENSTACK}
 
 #NOTE: Wait for deploy
diff --git a/tools/deployment/component/common/ldap.sh b/tools/deployment/component/common/ldap.sh
new file mode 100755
index 0000000000..06f2555a58
--- /dev/null
+++ b/tools/deployment/component/common/ldap.sh
@@ -0,0 +1,44 @@
+#!/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: Get the over-rides to use
+export HELM_CHART_ROOT_PATH="${HELM_CHART_ROOT_PATH:="${OSH_INFRA_PATH:="../openstack-helm-infra"}"}"
+: ${OSH_EXTRA_HELM_ARGS_LDAP:="$(./tools/deployment/common/get-values-overrides.sh ldap)"}
+
+#NOTE: Lint and package chart
+make -C ${HELM_CHART_ROOT_PATH} ldap
+
+#NOTE: Deploy command
+tee /tmp/ldap.yaml <<EOF
+pod:
+  replicas:
+    server: 1
+bootstrap:
+  enabled: true
+storage:
+  pvc:
+    enabled: false
+EOF
+helm upgrade --install ldap ${HELM_CHART_ROOT_PATH}/ldap \
+    --namespace=openstack \
+    --values=/tmp/ldap.yaml \
+    ${OSH_EXTRA_HELM_ARGS:=} \
+    ${OSH_EXTRA_HELM_ARGS_LDAP}
+
+#NOTE: Wait for deploy
+./tools/deployment/common/wait-for-pods.sh openstack
diff --git a/tools/deployment/component/common/mariadb.sh b/tools/deployment/component/common/mariadb.sh
index 92ea7abd3e..494745bf58 100755
--- a/tools/deployment/component/common/mariadb.sh
+++ b/tools/deployment/component/common/mariadb.sh
@@ -16,18 +16,21 @@
 
 set -xe
 
+#NOTE: Get the over-rides to use
+export HELM_CHART_ROOT_PATH="${HELM_CHART_ROOT_PATH:="${OSH_INFRA_PATH:="../openstack-helm-infra"}"}"
+: ${OSH_EXTRA_HELM_ARGS_MARIADB:="$(./tools/deployment/common/get-values-overrides.sh mariadb)"}
+
 #NOTE: Lint and package chart
-: ${OSH_INFRA_PATH:="../openstack-helm-infra"}
-make -C ${OSH_INFRA_PATH} mariadb
+make -C ${HELM_CHART_ROOT_PATH} mariadb
 
 #NOTE: Deploy command
 : ${OSH_EXTRA_HELM_ARGS:=""}
-helm upgrade --install mariadb ${OSH_INFRA_PATH}/mariadb \
+helm upgrade --install mariadb ${HELM_CHART_ROOT_PATH}/mariadb \
     --namespace=openstack \
     --set volume.use_local_path_for_single_pod_cluster.enabled=true \
     --set volume.enabled=false \
     --set pod.replicas.server=1 \
-    ${OSH_EXTRA_HELM_ARGS} \
+    ${OSH_EXTRA_HELM_ARGS:=} \
     ${OSH_EXTRA_HELM_ARGS_MARIADB}
 
 #NOTE: Wait for deploy
diff --git a/tools/deployment/component/common/memcached.sh b/tools/deployment/component/common/memcached.sh
index 5891a6a298..b8981b793a 100755
--- a/tools/deployment/component/common/memcached.sh
+++ b/tools/deployment/component/common/memcached.sh
@@ -16,15 +16,18 @@
 
 set -xe
 
+#NOTE: Get the over-rides to use
+export HELM_CHART_ROOT_PATH="${HELM_CHART_ROOT_PATH:="${OSH_INFRA_PATH:="../openstack-helm-infra"}"}"
+: ${OSH_EXTRA_HELM_ARGS_MARIADB:="$(./tools/deployment/common/get-values-overrides.sh memcached)"}
+
 #NOTE: Lint and package chart
-: ${OSH_INFRA_PATH:="../openstack-helm-infra"}
-make -C ${OSH_INFRA_PATH} memcached
+make -C ${HELM_CHART_ROOT_PATH} memcached
 
 #NOTE: Deploy command
 : ${OSH_EXTRA_HELM_ARGS:=""}
-helm upgrade --install memcached ${OSH_INFRA_PATH}/memcached \
+helm upgrade --install memcached ${HELM_CHART_ROOT_PATH}/memcached \
     --namespace=openstack \
-    ${OSH_EXTRA_HELM_ARGS} \
+    ${OSH_EXTRA_HELM_ARGS:=} \
     ${OSH_EXTRA_HELM_ARGS_MEMCACHED}
 
 #NOTE: Wait for deploy
diff --git a/tools/deployment/component/common/rabbitmq.sh b/tools/deployment/component/common/rabbitmq.sh
index ecf50d5af2..b9cd634f4f 100755
--- a/tools/deployment/component/common/rabbitmq.sh
+++ b/tools/deployment/component/common/rabbitmq.sh
@@ -16,17 +16,19 @@
 
 set -xe
 
+#NOTE: Get the over-rides to use
+export HELM_CHART_ROOT_PATH="${HELM_CHART_ROOT_PATH:="${OSH_INFRA_PATH:="../openstack-helm-infra"}"}"
+: ${OSH_EXTRA_HELM_ARGS_RABBITMQ:="$(./tools/deployment/common/get-values-overrides.sh rabbitmq)"}
+
 #NOTE: Lint and package chart
-: ${OSH_INFRA_PATH:="../openstack-helm-infra"}
-make -C ${OSH_INFRA_PATH} rabbitmq
+make -C ${HELM_CHART_ROOT_PATH} rabbitmq
 
 #NOTE: Deploy command
-: ${OSH_EXTRA_HELM_ARGS:=""}
-helm upgrade --install rabbitmq ${OSH_INFRA_PATH}/rabbitmq \
+helm upgrade --install rabbitmq ${HELM_CHART_ROOT_PATH}/rabbitmq \
     --namespace=openstack \
     --set volume.enabled=false \
     --set pod.replicas.server=1 \
-    ${OSH_EXTRA_HELM_ARGS} \
+    ${OSH_EXTRA_HELM_ARGS:=} \
     ${OSH_EXTRA_HELM_ARGS_RABBITMQ}
 
 #NOTE: Wait for deploy
diff --git a/tools/deployment/component/compute-kit/compute-kit.sh b/tools/deployment/component/compute-kit/compute-kit.sh
index 02f9b2900a..011626fb11 100755
--- a/tools/deployment/component/compute-kit/compute-kit.sh
+++ b/tools/deployment/component/compute-kit/compute-kit.sh
@@ -15,9 +15,11 @@
 #    under the License.
 set -xe
 
+#NOTE: Get the over-rides to use
+: ${OSH_EXTRA_HELM_ARGS_NOVA:="$(./tools/deployment/common/get-values-overrides.sh nova)"}
+
 #NOTE: Lint and package chart
 make nova
-make neutron
 
 #NOTE: Deploy nova
 : ${OSH_EXTRA_HELM_ARGS:=""}
@@ -26,8 +28,7 @@ if [ "x$(systemd-detect-virt)" == "xnone" ]; then
   helm upgrade --install nova ./nova \
       --namespace=openstack \
       --set conf.ceph.enabled=false \
-      ${OSH_EXTRA_HELM_ARGS} \
-      ${OSH_VALUES_OVERRIDES_HELM_ARGS:=} \
+      ${OSH_EXTRA_HELM_ARGS:=} \
       ${OSH_EXTRA_HELM_ARGS_NOVA}
 else
   echo 'OSH is being deployed in virtualized environment, using qemu for nova'
@@ -36,11 +37,16 @@ else
       --set conf.ceph.enabled=false \
       --set conf.nova.libvirt.virt_type=qemu \
       --set conf.nova.libvirt.cpu_mode=none \
-      ${OSH_EXTRA_HELM_ARGS} \
-      ${OSH_VALUES_OVERRIDES_HELM_ARGS:=} \
+      ${OSH_EXTRA_HELM_ARGS:=} \
       ${OSH_EXTRA_HELM_ARGS_NOVA}
 fi
 
+#NOTE: Get the over-rides to use
+: ${OSH_EXTRA_HELM_ARGS_NEUTRON:="$(./tools/deployment/common/get-values-overrides.sh neutron)"}
+
+#NOTE: Lint and package chart
+make neutron
+
 #NOTE: Deploy neutron
 tee /tmp/neutron.yaml << EOF
 network:
@@ -69,7 +75,7 @@ EOF
 helm upgrade --install neutron ./neutron \
     --namespace=openstack \
     --values=/tmp/neutron.yaml \
-    ${OSH_EXTRA_HELM_ARGS} \
+    ${OSH_EXTRA_HELM_ARGS:=} \
     ${OSH_VALUES_OVERRIDES_HELM_ARGS:=} \
     ${OSH_EXTRA_HELM_ARGS_NEUTRON}
 
diff --git a/tools/deployment/component/compute-kit/libvirt.sh b/tools/deployment/component/compute-kit/libvirt.sh
index bcb25cf11b..0627206a95 100755
--- a/tools/deployment/component/compute-kit/libvirt.sh
+++ b/tools/deployment/component/compute-kit/libvirt.sh
@@ -15,17 +15,19 @@
 #    under the License.
 set -xe
 
+#NOTE: Get the over-rides to use
+export HELM_CHART_ROOT_PATH="${HELM_CHART_ROOT_PATH:="${OSH_INFRA_PATH:="../openstack-helm-infra"}"}"
+: ${OSH_EXTRA_HELM_ARGS_LIBVIRT:="$(./tools/deployment/common/get-values-overrides.sh rabbitmq)"}
+
 #NOTE: Lint and package chart
-: ${OSH_INFRA_PATH:="../openstack-helm-infra"}
-make -C ${OSH_INFRA_PATH} libvirt
+make -C ${HELM_CHART_ROOT_PATH} libvirt
 
 #NOTE: Deploy command
 : ${OSH_EXTRA_HELM_ARGS:=""}
-helm upgrade --install libvirt ${OSH_INFRA_PATH}/libvirt \
+helm upgrade --install libvirt ${HELM_CHART_ROOT_PATH}/libvirt \
   --namespace=openstack \
   --set conf.ceph.enabled=false \
-  ${OSH_EXTRA_HELM_ARGS} \
-  ${OSH_VALUES_OVERRIDES_HELM_ARGS:=} \
+  ${OSH_EXTRA_HELM_ARGS:=} \
   ${OSH_EXTRA_HELM_ARGS_LIBVIRT}
 
 #NOTE(portdirect): We don't wait for libvirt pods to come up, as they depend
diff --git a/tools/deployment/component/compute-kit/openvswitch.sh b/tools/deployment/component/compute-kit/openvswitch.sh
index cb6efe5cba..60fd20aba9 100755
--- a/tools/deployment/component/compute-kit/openvswitch.sh
+++ b/tools/deployment/component/compute-kit/openvswitch.sh
@@ -15,16 +15,17 @@
 #    under the License.
 set -xe
 
+#NOTE: Get the over-rides to use
+export HELM_CHART_ROOT_PATH="${HELM_CHART_ROOT_PATH:="${OSH_INFRA_PATH:="../openstack-helm-infra"}"}"
+: ${OSH_EXTRA_HELM_ARGS_LIBVIRT:="$(./tools/deployment/common/get-values-overrides.sh openvswitch)"}
+
 #NOTE: Lint and package chart
-: ${OSH_INFRA_PATH:="../openstack-helm-infra"}
-make -C ${OSH_INFRA_PATH} openvswitch
+make -C ${HELM_CHART_ROOT_PATH} openvswitch
 
 #NOTE: Deploy command
-: ${OSH_EXTRA_HELM_ARGS:=""}
-helm upgrade --install openvswitch ${OSH_INFRA_PATH}/openvswitch \
+helm upgrade --install openvswitch ${HELM_CHART_ROOT_PATH}/openvswitch \
   --namespace=openstack \
-  ${OSH_EXTRA_HELM_ARGS} \
-  ${OSH_VALUES_OVERRIDES_HELM_ARGS:=} \
+  ${OSH_EXTRA_HELM_ARGS:=} \
   ${OSH_EXTRA_HELM_ARGS_OPENVSWITCH}
 
 #NOTE: Wait for deploy
diff --git a/tools/deployment/component/glance/glance.sh b/tools/deployment/component/glance/glance.sh
index 7213627bde..1f7dc79ab8 100755
--- a/tools/deployment/component/glance/glance.sh
+++ b/tools/deployment/component/glance/glance.sh
@@ -16,6 +16,9 @@
 
 set -xe
 
+#NOTE: Get the over-rides to use
+: ${OSH_EXTRA_HELM_ARGS_GLANCE:="$(./tools/deployment/common/get-values-overrides.sh glance)"}
+
 #NOTE: Lint and package chart
 make glance
 
@@ -45,8 +48,7 @@ fi
 helm upgrade --install glance ./glance \
   --namespace=openstack \
   --values=/tmp/glance.yaml \
-  ${OSH_EXTRA_HELM_ARGS} \
-  ${OSH_VALUES_OVERRIDES_HELM_ARGS:=} \
+  ${OSH_EXTRA_HELM_ARGS:=} \
   ${OSH_EXTRA_HELM_ARGS_GLANCE}
 
 #NOTE: Wait for deploy
diff --git a/tools/deployment/component/heat/heat.sh b/tools/deployment/component/heat/heat.sh
index b5a5d48ff1..5572f0a229 100755
--- a/tools/deployment/component/heat/heat.sh
+++ b/tools/deployment/component/heat/heat.sh
@@ -15,6 +15,9 @@
 #    under the License.
 set -xe
 
+#NOTE: Get the over-rides to use
+: ${OSH_EXTRA_HELM_ARGS_HEAT:="$(./tools/deployment/common/get-values-overrides.sh heat)"}
+
 #NOTE: Lint and package chart
 make heat
 
@@ -22,8 +25,7 @@ make heat
 : ${OSH_EXTRA_HELM_ARGS:=""}
 helm upgrade --install heat ./heat \
   --namespace=openstack \
-  ${OSH_EXTRA_HELM_ARGS} \
-  ${OSH_VALUES_OVERRIDES_HELM_ARGS:=} \
+  ${OSH_EXTRA_HELM_ARGS:=} \
   ${OSH_EXTRA_HELM_ARGS_HEAT}
 
 #NOTE: Wait for deploy
diff --git a/tools/deployment/component/horizon/horizon.sh b/tools/deployment/component/horizon/horizon.sh
index e553f16b5a..7c3ad096a6 100755
--- a/tools/deployment/component/horizon/horizon.sh
+++ b/tools/deployment/component/horizon/horizon.sh
@@ -16,14 +16,16 @@
 
 set -xe
 
+#NOTE: Get the over-rides to use
+: ${OSH_EXTRA_HELM_ARGS_HORIZON:="$(./tools/deployment/common/get-values-overrides.sh horizon)"}
+
 #NOTE: Lint and package chart
 make horizon
 
 #NOTE: Deploy command
-: ${OSH_EXTRA_HELM_ARGS:=""}
 helm upgrade --install horizon ./horizon \
     --namespace=openstack \
-    ${OSH_EXTRA_HELM_ARGS} \
+    ${OSH_EXTRA_HELM_ARGS:=} \
     ${OSH_EXTRA_HELM_ARGS_HORIZON}
 
 #NOTE: Wait for deploy
diff --git a/tools/deployment/component/keystone/keystone-ldap.sh b/tools/deployment/component/keystone/keystone-ldap.sh
deleted file mode 100755
index a3a21238f1..0000000000
--- a/tools/deployment/component/keystone/keystone-ldap.sh
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/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: Deploy command
-: ${OSH_INFRA_PATH:="../openstack-helm-infra"}
-: ${OSH_EXTRA_HELM_ARGS:=""}
-
-tee /tmp/ldap.yaml <<EOF
-pod:
-  replicas:
-    server: 1
-bootstrap:
-  enabled: true
-storage:
-  pvc:
-    enabled: false
-EOF
-
-helm upgrade --install ldap ${OSH_INFRA_PATH}/ldap \
-    --namespace=openstack \
-    --values=/tmp/ldap.yaml \
-    ${OSH_EXTRA_HELM_ARGS} \
-    ${OSH_EXTRA_HELM_ARGS_LDAP}
-
-#NOTE: Wait for deploy
-./tools/deployment/common/wait-for-pods.sh openstack
-
-#NOTE: Validate Deployment info
-helm status ldap
-
-#NOTE: Deploy command
-: ${OSH_EXTRA_HELM_ARGS:=""}
-helm upgrade --install keystone ./keystone \
-    --namespace=openstack \
-    --values=./tools/overrides/keystone/ldap_domain_config.yaml \
-    ${OSH_EXTRA_HELM_ARGS} \
-    ${OSH_EXTRA_HELM_ARGS_KEYSTONE}
-
-#NOTE: Wait for deploy
-./tools/deployment/common/wait-for-pods.sh openstack
-
-#NOTE: Validate Deployment info
-helm status keystone
-export OS_CLOUD=openstack_helm
-sleep 30 #NOTE(portdirect): Wait for ingress controller to update rules and restart Nginx
-openstack endpoint list
-
-#NOTE: Do some additional queries here for LDAP
-openstack domain list
-openstack user list
-openstack user list --domain ldapdomain
-
-openstack role add --user bob --project admin --user-domain ldapdomain --project-domain default admin
-
-domain="ldapdomain"
-domainId=$(openstack domain show ${domain} -f value -c id)
-token=$(openstack token issue -f value -c id)
-
-#NOTE: Testing we can auth against the LDAP user
-unset OS_CLOUD
-openstack --os-auth-url http://keystone.openstack.svc.cluster.local/v3 --os-username bob --os-password password --os-user-domain-name ${domain} --os-identity-api-version 3 token issue
-
-#NOTE: Test the domain specific thing works
-curl --verbose -X GET \
-  -H "Content-Type: application/json" \
-  -H "X-Auth-Token: $token" \
-  http://keystone.openstack.svc.cluster.local/v3/domains/${domainId}/config
diff --git a/tools/deployment/component/keystone/keystone.sh b/tools/deployment/component/keystone/keystone.sh
index 8cc3f0a6e3..fcee81c712 100755
--- a/tools/deployment/component/keystone/keystone.sh
+++ b/tools/deployment/component/keystone/keystone.sh
@@ -16,16 +16,17 @@
 
 set -xe
 
+#NOTE: Get the over-rides to use
+: ${OSH_EXTRA_HELM_ARGS_KEYSTONE:="$(./tools/deployment/common/get-values-overrides.sh keystone)"}
+
 #NOTE: Lint and package chart
 make keystone
 
 #NOTE: Deploy command
-: ${OSH_EXTRA_HELM_ARGS:=""}
 helm upgrade --install keystone ./keystone \
     --namespace=openstack \
-    ${OSH_EXTRA_HELM_ARGS} \
-    ${OSH_VALUES_OVERRIDES_HELM_ARGS:=} \
-    ${OSH_EXTRA_HELM_ARGS_KEYSTONE}
+    ${OSH_EXTRA_HELM_ARGS:=} \
+    ${OSH_EXTRA_HELM_ARGS_KEYSTONE:=}
 
 #NOTE: Wait for deploy
 ./tools/deployment/common/wait-for-pods.sh openstack
@@ -35,3 +36,27 @@ helm status keystone
 export OS_CLOUD=openstack_helm
 sleep 30 #NOTE(portdirect): Wait for ingress controller to update rules and restart Nginx
 openstack endpoint list
+
+#NOTE: Validate feature gate options if required
+FEATURE_GATE="ldap"; if [[ ${FEATURE_GATES//,/ } =~ (^|[[:space:]])${FEATURE_GATE}($|[[:space:]]) ]]; then
+  #NOTE: Do some additional queries here for LDAP
+  openstack domain list
+  openstack user list
+  openstack user list --domain ldapdomain
+
+  openstack role add --user bob --project admin --user-domain ldapdomain --project-domain default admin
+
+  domain="ldapdomain"
+  domainId=$(openstack domain show ${domain} -f value -c id)
+  token=$(openstack token issue -f value -c id)
+
+  #NOTE: Testing we can auth against the LDAP user
+  unset OS_CLOUD
+  openstack --os-auth-url http://keystone.openstack.svc.cluster.local/v3 --os-username bob --os-password password --os-user-domain-name ${domain} --os-identity-api-version 3 token issue
+
+  #NOTE: Test the domain specific thing works
+  curl --verbose -X GET \
+    -H "Content-Type: application/json" \
+    -H "X-Auth-Token: $token" \
+    http://keystone.openstack.svc.cluster.local/v3/domains/${domainId}/config
+fi
diff --git a/zuul.d/jobs-openstack-helm.yaml b/zuul.d/jobs-openstack-helm.yaml
index 73ab5dbf5b..91fb5a1c25 100644
--- a/zuul.d/jobs-openstack-helm.yaml
+++ b/zuul.d/jobs-openstack-helm.yaml
@@ -57,6 +57,10 @@
     parent: openstack-helm-chart-deploy
     run: tools/gate/playbooks/osh-gate-runner.yaml
     vars:
+      osh_params:
+        openstack_release: newton
+        container_distro_name: ubuntu
+        container_distro_version: xenial
       gate_scripts:
         - ./tools/deployment/common/install-packages.sh
         - ./tools/deployment/common/deploy-k8s.sh
@@ -70,23 +74,29 @@
     name: openstack-helm-keystone-pike-ubuntu_xenial
     parent: openstack-helm-keystone
     vars:
-      values_overrides:
-        # - ../openstack-helm-infra/ingress/values_overrides/pike-ubuntu_xenial.yaml
-        - ./keystone/values_overrides/pike-ubuntu_xenial.yaml
+      osh_params:
+        openstack_release: pike
+        container_distro_name: ubuntu
+        container_distro_version: xenial
 - job:
     name: openstack-helm-keystone-rocky-opensuse_15
     parent: openstack-helm-keystone
     vars:
-      values_overrides:
-        - ../openstack-helm-infra/ingress/values_overrides/rocky-opensuse_15.yaml
-        - ./keystone/values_overrides/opensuse_15.yaml
-        - ./keystone/values_overrides/rocky-opensuse_15.yaml
+      osh_params:
+        openstack_release: rocky
+        container_distro_name: opensuse
+        container_distro_version: '15'
 
 - job:
     name: openstack-helm-keystone-ldap
     parent: openstack-helm-chart-deploy
     run: tools/gate/playbooks/osh-gate-runner.yaml
     vars:
+      osh_params:
+        openstack_release: newton
+        container_distro_name: ubuntu
+        container_distro_version: xenial
+        feature_gates: ldap
       gate_scripts:
         - ./tools/deployment/common/install-packages.sh
         - ./tools/deployment/common/deploy-k8s.sh
@@ -95,13 +105,18 @@
         - ./tools/deployment/component/common/mariadb.sh
         - ./tools/deployment/component/common/memcached.sh
         - ./tools/deployment/component/common/rabbitmq.sh
-        - ./tools/deployment/component/keystone/keystone-ldap.sh
+        - ./tools/deployment/component/common/ldap.sh
+        - ./tools/deployment/component/keystone/keystone.sh
 
 - job:
     name: openstack-helm-glance
     parent: openstack-helm-chart-deploy
     run: tools/gate/playbooks/osh-gate-runner.yaml
     vars:
+      osh_params:
+        openstack_release: newton
+        container_distro_name: ubuntu
+        container_distro_version: xenial
       gate_scripts:
         - ./tools/deployment/common/install-packages.sh
         - ./tools/deployment/common/deploy-k8s.sh
@@ -117,25 +132,28 @@
     name: openstack-helm-glance-pike-ubuntu_xenial
     parent: openstack-helm-glance
     vars:
-      values_overrides:
-        # - ../openstack-helm-infra/ingress/values_overrides/pike-ubuntu_xenial.yaml
-        - ./keystone/values_overrides/pike-ubuntu_xenial.yaml
-        - ./glance/values_overrides/pike-ubuntu_xenial.yaml
+      osh_params:
+        openstack_release: pike
+        container_distro_name: ubuntu
+        container_distro_version: xenial
 - job:
     name: openstack-helm-glance-rocky-opensuse_15
     parent: openstack-helm-glance
     vars:
-      values_overrides:
-        - ../openstack-helm-infra/ingress/values_overrides/rocky-opensuse_15.yaml
-        - ./keystone/values_overrides/opensuse_15.yaml
-        - ./keystone/values_overrides/rocky-opensuse_15.yaml
-        - ./glance/values_overrides/rocky-opensuse_15.yaml
+      osh_params:
+        openstack_release: rocky
+        container_distro_name: opensuse
+        container_distro_version: '15'
 
 - job:
     name: openstack-helm-heat
     parent: openstack-helm-chart-deploy
     run: tools/gate/playbooks/osh-gate-runner.yaml
     vars:
+      osh_params:
+        openstack_release: newton
+        container_distro_name: ubuntu
+        container_distro_version: xenial
       gate_scripts:
         - ./tools/deployment/common/install-packages.sh
         - ./tools/deployment/common/deploy-k8s.sh
@@ -150,25 +168,28 @@
     name: openstack-helm-heat-pike-ubuntu_xenial
     parent: openstack-helm-heat
     vars:
-      values_overrides:
-        # - ../openstack-helm-infra/ingress/values_overrides/pike-ubuntu_xenial.yaml
-        - ./keystone/values_overrides/pike-ubuntu_xenial.yaml
-        - ./heat/values_overrides/pike-ubuntu_xenial.yaml
+      osh_params:
+        openstack_release: pike
+        container_distro_name: ubuntu
+        container_distro_version: xenial
 - job:
     name: openstack-helm-heat-rocky-opensuse_15
     parent: openstack-helm-heat
     vars:
-      values_overrides:
-        - ../openstack-helm-infra/ingress/values_overrides/rocky-opensuse_15.yaml
-        - ./keystone/values_overrides/opensuse_15.yaml
-        - ./keystone/values_overrides/rocky-opensuse_15.yaml
-        - ./heat/values_overrides/rocky-opensuse_15.yaml
+      osh_params:
+        openstack_release: rocky
+        container_distro_name: opensuse
+        container_distro_version: '15'
 
 - job:
     name: openstack-helm-cinder
     parent: openstack-helm-chart-deploy
     run: tools/gate/playbooks/osh-gate-runner.yaml
     vars:
+      osh_params:
+        openstack_release: newton
+        container_distro_name: ubuntu
+        container_distro_version: xenial
       gate_scripts:
         - ./tools/deployment/common/install-packages.sh
         - ./tools/deployment/common/deploy-k8s.sh
@@ -185,25 +206,28 @@
     name: openstack-helm-cinder-pike-ubuntu_xenial
     parent: openstack-helm-cinder
     vars:
-      values_overrides:
-        # - ../openstack-helm-infra/ingress/values_overrides/pike-ubuntu_xenial.yaml
-        - ./keystone/values_overrides/pike-ubuntu_xenial.yaml
-        - ./cinder/values_overrides/pike-ubuntu_xenial.yaml
+      osh_params:
+        openstack_release: pike
+        container_distro_name: ubuntu
+        container_distro_version: xenial
 - job:
     name: openstack-helm-cinder-rocky-opensuse_15
     parent: openstack-helm-cinder
     vars:
-      values_overrides:
-        - ../openstack-helm-infra/ingress/values_overrides/rocky-opensuse_15.yaml
-        - ./keystone/values_overrides/opensuse_15.yaml
-        - ./keystone/values_overrides/rocky-opensuse_15.yaml
-        - ./cinder/values_overrides/rocky-opensuse_15.yaml
+      osh_params:
+        openstack_release: rocky
+        container_distro_name: opensuse
+        container_distro_version: '15'
 
 - job:
     name: openstack-helm-compute-kit
     parent: openstack-helm-chart-deploy
     run: tools/gate/playbooks/osh-gate-runner.yaml
     vars:
+      osh_params:
+        openstack_release: newton
+        container_distro_name: ubuntu
+        container_distro_version: xenial
       gate_scripts:
         - ./tools/deployment/common/install-packages.sh
         - ./tools/deployment/common/deploy-k8s.sh
@@ -225,37 +249,28 @@
     name: openstack-helm-compute-kit-pike-ubuntu_xenial
     parent: openstack-helm-compute-kit
     vars:
-      values_overrides:
-        # - ../openstack-helm-infra/ingress/values_overrides/pike-ubuntu_xenial.yaml
-        - ./keystone/values_overrides/pike-ubuntu_xenial.yaml
-        - ./heat/values_overrides/pike-ubuntu_xenial.yaml
-        - ./glance/values_overrides/pike-ubuntu_xenial.yaml
-        # - ../openstack-helm-infra/openvswitch/values_overrides/pike-ubuntu_xenial.yaml
-        # - ../openstack-helm-infra/libvirt/values_overrides/pike-ubuntu_xenial.yaml
-        - ./neutron/values_overrides/pike-ubuntu_xenial.yaml
-        - ./nova/values_overrides/pike-ubuntu_xenial.yaml
+      osh_params:
+        openstack_release: pike
+        container_distro_name: ubuntu
+        container_distro_version: xenial
 - job:
     name: openstack-helm-compute-kit-rocky-opensuse_15
     parent: openstack-helm-compute-kit
     vars:
-      values_overrides:
-        - ../openstack-helm-infra/ingress/values_overrides/rocky-opensuse_15.yaml
-        - ./keystone/values_overrides/opensuse_15.yaml
-        - ./keystone/values_overrides/rocky-opensuse_15.yaml
-        - ./heat/values_overrides/rocky-opensuse_15.yaml
-        - ./glance/values_overrides/rocky-opensuse_15.yaml
-        - ../openstack-helm-infra/openvswitch/values_overrides/rocky-opensuse_15.yaml
-        - ../openstack-helm-infra/libvirt/values_overrides/rocky-opensuse_15.yaml
-        - ./neutron/values_overrides/rocky.yaml
-        - ./neutron/values_overrides/rocky-opensuse_15.yaml
-        - ./nova/values_overrides/opensuse_15.yaml
-        - ./nova/values_overrides/rocky-opensuse_15.yaml
+      osh_params:
+        openstack_release: rocky
+        container_distro_name: opensuse
+        container_distro_version: '15'
 
 - job:
     name: openstack-helm-horizon
     parent: openstack-helm-chart-deploy
     run: tools/gate/playbooks/osh-gate-runner.yaml
     vars:
+      osh_params:
+        openstack_release: newton
+        container_distro_name: ubuntu
+        container_distro_version: xenial
       gate_scripts:
         - ./tools/deployment/common/install-packages.sh
         - ./tools/deployment/common/deploy-k8s.sh
@@ -272,6 +287,10 @@
     parent: openstack-helm-chart-deploy
     run: tools/gate/playbooks/osh-gate-runner.yaml
     vars:
+      osh_params:
+        openstack_release: newton
+        container_distro_name: ubuntu
+        container_distro_version: xenial
       gate_scripts:
         - ./tools/deployment/common/install-packages.sh
         - ./tools/deployment/common/deploy-k8s.sh