Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions common/scripts/manage-secret-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
11 changes: 11 additions & 0 deletions common/scripts/pattern-util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ function version {
if [ -z "$PATTERN_UTILITY_CONTAINER" ]; then
PATTERN_UTILITY_CONTAINER="quay.io/hybridcloudpatterns/utility-container"
fi
# If PATTERN_DISCONNECTED_HOME is set it will be used to populate both PATTERN_UTILITY_CONTAINER
# and PATTERN_INSTALL_CHART automatically
if [ -n "${PATTERN_DISCONNECTED_HOME}" ]; then
PATTERN_UTILITY_CONTAINER="${PATTERN_DISCONNECTED_HOME}/utility-container"
PATTERN_INSTALL_CHART="oci://${PATTERN_DISCONNECTED_HOME}/pattern-install"
echo "PATTERN_DISCONNECTED_HOME is set to ${PATTERN_DISCONNECTED_HOME}"
echo "Setting the following variables:"
echo " PATTERN_UTILITY_CONTAINER: ${PATTERN_UTILITY_CONTAINER}"
echo " PATTERN_INSTALL_CHART: ${PATTERN_INSTALL_CHART}"
fi

readonly commands=(podman)
for cmd in ${commands[@]}; do is_available "$cmd"; done
Expand Down Expand Up @@ -81,6 +91,7 @@ podman run -it --rm --pull=newer \
-e VALUES_SECRET \
-e KUBECONFIG \
-e PATTERN_INSTALL_CHART \
-e PATTERN_DISCONNECTED_HOME \
-e K8S_AUTH_HOST \
-e K8S_AUTH_VERIFY_SSL \
-e K8S_AUTH_SSL_CA_CERT \
Expand Down
18 changes: 14 additions & 4 deletions common/scripts/preview.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down