Improve the script 33 to retrieve the target node from rendered

document

Changes from hard coded value node01 to retrieve the first target
node name from the rendered phase document

Signed-off-by: James Gu <james.gu@att.com>
Change-Id: I5e80b34a3a1267b75202b2bdef9d43d053bf22c5
This commit is contained in:
James Gu 2021-04-13 08:31:57 -07:00
parent 03790b2425
commit 1ceecdb1f1
1 changed files with 5 additions and 1 deletions

View File

@ -19,8 +19,12 @@ export TIMEOUT=${TIMEOUT:-3600}
export KUBECONFIG=${KUBECONFIG:-"$HOME/.airship/kubeconfig"}
export KUBECONFIG_EPHEMERAL_CONTEXT=${KUBECONFIG_EPHEMERAL_CONTEXT:-"ephemeral-cluster"}
export KUBECONFIG_TARGET_CONTEXT=${KUBECONFIG_TARGET_CONTEXT:-"target-cluster"}
export TARGET_NODE=${TARGET_NODE:-"node01"}
export CLUSTER_NAMESPACE=${CLUSTER_NAMESPACE:-"default"}
export TARGET_NODE=${TARGET_NODE:-"$(airshipctl phase render controlplane-ephemeral \
-k BareMetalHost -l airshipit.org/k8s-role=controlplane-host \
2> /dev/null | \
yq .metadata.name | \
sed 's/"//g')"}
echo "Check Cluster Status"
kubectl --kubeconfig $KUBECONFIG --context $KUBECONFIG_EPHEMERAL_CONTEXT -n $CLUSTER_NAMESPACE get cluster target-cluster -o json | jq '.status.controlPlaneReady'