Skip to content

Commit eee791f

Browse files
committed
Add kube-context persistence to scripts
1 parent 4c79632 commit eee791f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

bin/upgrade.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,17 @@ if [ -z "$NAMESPACE" ]; then
7373
fi
7474
set -u
7575

76+
set +u
77+
if [ -z "$CONTEXT" ]; then
78+
CONTEXT=$(ask_for_input "Enter Kubernetes context")
79+
config_updated=1
80+
fi
81+
set -u
82+
7683
if [ $config_updated -eq 1 ]; then
7784
echo "RELEASE_NAME=\"$RELEASE_NAME\"" > "$CONFIG_FILE"
7885
echo "NAMESPACE=\"$NAMESPACE\"" >> "$CONFIG_FILE"
86+
echo "CONTEXT=\"$CONTEXT\"" >> "$CONFIG_FILE"
7987
fi
8088

8189
f_values=( -f values.yaml )
@@ -90,6 +98,7 @@ helm upgrade --install "$RELEASE_NAME" . \
9098
"${f_values[@]}" \
9199
--namespace "$NAMESPACE" \
92100
--create-namespace \
101+
--kube-context "$CONTEXT" \
93102
"${helm_args[@]}"
94103

95104
if [ $config_updated -eq 1 ]; then
@@ -99,4 +108,5 @@ if [ $config_updated -eq 1 ]; then
99108
echo "Deployment config saved to $CONFIG_FILE"
100109
echo " Release Name: $RELEASE_NAME"
101110
echo " Namespace: $NAMESPACE"
111+
echo " Context: $CONTEXT"
102112
fi

0 commit comments

Comments
 (0)