Skip to content

Commit 7524b89

Browse files
aleoliadamjensenbot
authored andcommitted
examples: fix the k3d apiserver address retrieval
splits the retrieval and the usage to have a better error handling
1 parent 48845ff commit 7524b89

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

examples/common.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,13 @@ function install_liqo_k3d() {
147147
shift 4
148148
labels="$*"
149149

150+
api_server_address=$(kubectl get nodes --kubeconfig "$kubeconfig" --selector=node-role.kubernetes.io/master -o jsonpath='{$.items[*].status.addresses[?(@.type=="InternalIP")].address}')
151+
150152
fail_on_error "liqoctl install k3s --cluster-name $cluster_name \
151153
--cluster-labels=$(join_by , "${labels[@]}") \
152154
--pod-cidr $pod_cidr \
153155
--service-cidr $service_cidr \
154-
--api-server-url https://$(kubectl get nodes --kubeconfig "$kubeconfig" --selector=node-role.kubernetes.io/master -o jsonpath='{$.items[*].status.addresses[?(@.type=="InternalIP")].address}'):6443 \
156+
--api-server-url https://$api_server_address:6443 \
155157
--kubeconfig $kubeconfig" "Failed to install liqo on cluster \"${cluster_name}\""
156158

157159
success_clear_line "Liqo has been installed on cluster \"$cluster_name\"."

0 commit comments

Comments
 (0)