Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

Commit

Permalink
add cluster specific config when KUBERNETES_CLUSTER_CONTEXT not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
cr1cr1 committed Sep 27, 2023
1 parent 003588f commit ed1f64d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/k.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ if [[ ! $(type -p $PACKAGE_BIN) || "$($PACKAGE_BIN version)" != "$PACKAGE_VERSIO
fi
fi

CONFIG_COMMAND=
if [[ -z "$CLUSTER_CONFIG" && -n "$KUBERNETES_CLUSTER_CONTEXT" ]]; then
CLUSTER_CONFIG="$SCRIPT_DIR/kubestrap-$KUBERNETES_CLUSTER_CONTEXT.yaml"
if [[ -f "$CLUSTER_CONFIG" ]]; then
CONFIG_COMMAND="--config $CLUSTER_CONFIG"
fi
fi

set -x
$PACKAGE_BIN --config $SCRIPT_DIR/kubestrap-defaults.yaml "$@"
$PACKAGE_BIN --config $SCRIPT_DIR/kubestrap-defaults.yaml $CONFIG_COMMAND "$@"
{ set +x; } 2>/dev/null

0 comments on commit ed1f64d

Please sign in to comment.