From 0d1cda8eb362e82436d0cd276af84d740dbd52d1 Mon Sep 17 00:00:00 2001 From: Akos Eros Date: Mon, 30 Sep 2024 15:49:14 +0200 Subject: [PATCH 1/2] Update secret backend change script The script is used in make secrets-backend-*. Update needed for slimed common. --- scripts/manage-secret-app.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/manage-secret-app.sh b/scripts/manage-secret-app.sh index 1ea0d0bb..18a986e5 100755 --- a/scripts/manage-secret-app.sh +++ b/scripts/manage-secret-app.sh @@ -11,13 +11,17 @@ case "$APP" in APP_NAME="vault" NAMESPACE="vault" PROJECT="$MAIN_CLUSTERGROUP_PROJECT" - CHART_LOCATION="common/hashicorp-vault" + CHART_NAME="hashicorp-vault" + CHART_VERSION=0.1.* + ;; "golang-external-secrets") APP_NAME="golang-external-secrets" NAMESPACE="golang-external-secrets" PROJECT="$MAIN_CLUSTERGROUP_PROJECT" - CHART_LOCATION="common/golang-external-secrets" + CHART_NAME="golang-external-secrets" + CHART_VERSION=0.1.* + ;; *) echo "Error - cannot manage $APP can only manage vault and golang-external-secrets" @@ -32,13 +36,13 @@ case "$STATE" in RES=$(yq ".clusterGroup.applications[] | select(.path == \"$CHART_LOCATION\")" "$MAIN_CLUSTERGROUP_FILE" 2>/dev/null) if [ -z "$RES" ]; then echo "Application with chart location $CHART_LOCATION not found, adding" - yq -i ".clusterGroup.applications.$APP_NAME = { \"name\": \"$APP_NAME\", \"namespace\": \"$NAMESPACE\", \"project\": \"$PROJECT\", \"path\": \"$CHART_LOCATION\" }" "$MAIN_CLUSTERGROUP_FILE" + yq -i ".clusterGroup.applications.$APP_NAME = { \"name\": \"$APP_NAME\", \"namespace\": \"$NAMESPACE\", \"project\": \"$PROJECT\", \"chart\": \"$CHART_NAME\", \"chartVersion\": \"$CHART_VERSION\"}" "$MAIN_CLUSTERGROUP_FILE" fi ;; "absent") common/scripts/manage-secret-namespace.sh "$NAMESPACE" "$STATE" echo "Removing application wth chart location $CHART_LOCATION" - yq -i "del(.clusterGroup.applications[] | select(.path == \"$CHART_LOCATION\"))" "$MAIN_CLUSTERGROUP_FILE" + yq -i "del(.clusterGroup.applications[] | select(.chart == \"$CHART_NAME\"))" "$MAIN_CLUSTERGROUP_FILE" ;; *) echo "$STATE not supported" From b8640e051fe9df47b32e9e080f84fe18ce9711fe Mon Sep 17 00:00:00 2001 From: Akos Eros Date: Mon, 30 Sep 2024 15:53:01 +0200 Subject: [PATCH 2/2] Update preview script Now the preview will work with remote charts, and local charts as well. Default helm registry will be oci://quay.io/repository/hybridcloudpatterns/. --- scripts/preview.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/preview.sh b/scripts/preview.sh index b9839c51..6da45785 100755 --- a/scripts/preview.sh +++ b/scripts/preview.sh @@ -2,8 +2,7 @@ # DISCLAIMER # -# - Parsing of applications needs to be more clever. Currently the code assumes that all -# targets will be local charts. This is not true, for example, in industrial-edge. +# - Parsing of applications needs to be more clever. # - There is currently not a mechanism to actually preview against multiple clusters # (i.e. a hub and a remote). All previews will be done against the current. # - Make output can be included in the YAML. @@ -22,11 +21,22 @@ if [ "${APPNAME}" != "clustergroup" ]; then # path: charts/all/foo # So we retrieve the actual index ("foobar") given the name attribute of the application APP=$(yq ".clusterGroup.applications | with_entries(select(.value.name == \"$APPNAME\")) | keys | .[0]" values-$SITE.yaml) - chart=$(yq ".clusterGroup.applications.$APP.path" values-$SITE.yaml) + isLocalHelmChart=$(yq ".clusterGroup.applications.$APP.path" values-$SITE.yaml) + if [ $isLocalHelmChart != "null" ]; then + chart=$(yq ".clusterGroup.applications.$APP.path" values-$SITE.yaml) + else + helmrepo=$(yq ".clusterGroup.applications.$APP.repoURL" values-$SITE.yaml) + helmrepo="${helmrepo:+oci://quay.io/hybridcloudpatterns}" + chartversion=$(yq ".clusterGroup.applications.$APP.chartVersion" values-$SITE.yaml) + chartname=$(yq ".clusterGroup.applications.$APP.chart" values-$SITE.yaml) + chart="${helmrepo}/${chartname} --version ${chartversion}" + fi namespace=$(yq ".clusterGroup.applications.$APP.namespace" values-$SITE.yaml) else APP=$APPNAME - chart="common/clustergroup" + clusterGroupChartVersion=$(yq ".main.multiSourceConfig.clusterGroupChartVersion" values-global.yaml) + helmrepo="oci://quay.io/hybridcloudpatterns" + chart="${helmrepo}/clustergroup --version ${clusterGroupChartVersion}" namespace="openshift-operators" fi pattern=$(yq ".global.pattern" values-global.yaml)