Skip to content

Commit 07f6584

Browse files
authored
Merge pull request #605 from darkdoc/fix_scripts
Fix scripts after common slim
2 parents 9e4bc56 + b8640e0 commit 07f6584

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

scripts/manage-secret-app.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@ case "$APP" in
1111
APP_NAME="vault"
1212
NAMESPACE="vault"
1313
PROJECT="$MAIN_CLUSTERGROUP_PROJECT"
14-
CHART_LOCATION="common/hashicorp-vault"
14+
CHART_NAME="hashicorp-vault"
15+
CHART_VERSION=0.1.*
16+
1517
;;
1618
"golang-external-secrets")
1719
APP_NAME="golang-external-secrets"
1820
NAMESPACE="golang-external-secrets"
1921
PROJECT="$MAIN_CLUSTERGROUP_PROJECT"
20-
CHART_LOCATION="common/golang-external-secrets"
22+
CHART_NAME="golang-external-secrets"
23+
CHART_VERSION=0.1.*
24+
2125
;;
2226
*)
2327
echo "Error - cannot manage $APP can only manage vault and golang-external-secrets"
@@ -32,13 +36,13 @@ case "$STATE" in
3236
RES=$(yq ".clusterGroup.applications[] | select(.path == \"$CHART_LOCATION\")" "$MAIN_CLUSTERGROUP_FILE" 2>/dev/null)
3337
if [ -z "$RES" ]; then
3438
echo "Application with chart location $CHART_LOCATION not found, adding"
35-
yq -i ".clusterGroup.applications.$APP_NAME = { \"name\": \"$APP_NAME\", \"namespace\": \"$NAMESPACE\", \"project\": \"$PROJECT\", \"path\": \"$CHART_LOCATION\" }" "$MAIN_CLUSTERGROUP_FILE"
39+
yq -i ".clusterGroup.applications.$APP_NAME = { \"name\": \"$APP_NAME\", \"namespace\": \"$NAMESPACE\", \"project\": \"$PROJECT\", \"chart\": \"$CHART_NAME\", \"chartVersion\": \"$CHART_VERSION\"}" "$MAIN_CLUSTERGROUP_FILE"
3640
fi
3741
;;
3842
"absent")
3943
common/scripts/manage-secret-namespace.sh "$NAMESPACE" "$STATE"
4044
echo "Removing application wth chart location $CHART_LOCATION"
41-
yq -i "del(.clusterGroup.applications[] | select(.path == \"$CHART_LOCATION\"))" "$MAIN_CLUSTERGROUP_FILE"
45+
yq -i "del(.clusterGroup.applications[] | select(.chart == \"$CHART_NAME\"))" "$MAIN_CLUSTERGROUP_FILE"
4246
;;
4347
*)
4448
echo "$STATE not supported"

scripts/preview.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
# DISCLAIMER
44
#
5-
# - Parsing of applications needs to be more clever. Currently the code assumes that all
6-
# targets will be local charts. This is not true, for example, in industrial-edge.
5+
# - Parsing of applications needs to be more clever.
76
# - There is currently not a mechanism to actually preview against multiple clusters
87
# (i.e. a hub and a remote). All previews will be done against the current.
98
# - Make output can be included in the YAML.
@@ -22,11 +21,22 @@ if [ "${APPNAME}" != "clustergroup" ]; then
2221
# path: charts/all/foo
2322
# So we retrieve the actual index ("foobar") given the name attribute of the application
2423
APP=$(yq ".clusterGroup.applications | with_entries(select(.value.name == \"$APPNAME\")) | keys | .[0]" values-$SITE.yaml)
25-
chart=$(yq ".clusterGroup.applications.$APP.path" values-$SITE.yaml)
24+
isLocalHelmChart=$(yq ".clusterGroup.applications.$APP.path" values-$SITE.yaml)
25+
if [ $isLocalHelmChart != "null" ]; then
26+
chart=$(yq ".clusterGroup.applications.$APP.path" values-$SITE.yaml)
27+
else
28+
helmrepo=$(yq ".clusterGroup.applications.$APP.repoURL" values-$SITE.yaml)
29+
helmrepo="${helmrepo:+oci://quay.io/hybridcloudpatterns}"
30+
chartversion=$(yq ".clusterGroup.applications.$APP.chartVersion" values-$SITE.yaml)
31+
chartname=$(yq ".clusterGroup.applications.$APP.chart" values-$SITE.yaml)
32+
chart="${helmrepo}/${chartname} --version ${chartversion}"
33+
fi
2634
namespace=$(yq ".clusterGroup.applications.$APP.namespace" values-$SITE.yaml)
2735
else
2836
APP=$APPNAME
29-
chart="common/clustergroup"
37+
clusterGroupChartVersion=$(yq ".main.multiSourceConfig.clusterGroupChartVersion" values-global.yaml)
38+
helmrepo="oci://quay.io/hybridcloudpatterns"
39+
chart="${helmrepo}/clustergroup --version ${clusterGroupChartVersion}"
3040
namespace="openshift-operators"
3141
fi
3242
pattern=$(yq ".global.pattern" values-global.yaml)

0 commit comments

Comments
 (0)