Skip to content

Commit cb1e1e6

Browse files
committed
Only add --server to kubectl commands when KUBERNETES_API_SERVER is specified.
1 parent 6842fe3 commit cb1e1e6

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

examples/kubernetes/env.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,18 @@
66
# use cases just need KUBECTL=kubectl, we'll make that the default.
77
KUBECTL=${KUBECTL:-kubectl}
88

9-
# Kubernetes api address for $KUBECTL
10-
# The default value is 127.0.0.1:8080
11-
# When the Kubernetes api server is not local, We can easily access the api by edit KUBERNETES_API_SERVER's value
12-
KUBERNETES_API_SERVER=${KUBERNETES_API_SERVER:-'127.0.0.1:8080'}
9+
# Kubernetes api address for $KUBECTL. When the Kubernetes api server is not
10+
# local, We can easily access the api by editing KUBERNETES_API_SERVER's value
11+
KUBERNETES_API_SERVER=${KUBERNETES_API_SERVER:-""}
1312

1413
# Kubernetes namespace for Vitess and components.
1514
VITESS_NAME=${VITESS_NAME:-'default'}
1615

1716
# Kubernetes options config
18-
KUBECTL_OPTIONS="--namespace=$VITESS_NAME --server=$KUBERNETES_API_SERVER"
17+
KUBECTL_OPTIONS="--namespace=$VITESS_NAME"
18+
if [[ -n $KUBERNETES_API_SERVER ]]; then
19+
KUBECTL_OPTIONS+=" --server=$KUBERNETES_API_SERVER"
20+
fi
1921

2022
# CELLS should be a comma separated list of cells
2123
# the first cell listed will become local to vtctld.

0 commit comments

Comments
 (0)