From 868a7377758bc61ba62ce1f9cfd53be6242898b0 Mon Sep 17 00:00:00 2001 From: Sreejith Punnapuzha Date: Mon, 19 Apr 2021 11:56:28 -0500 Subject: [PATCH] Fix deployment scripts * add $ for kubectl command in host variable * remove controlplane labels as they are added via k8scontrol role Signed-off-by: Sreejith Punnapuzha Change-Id: Idc30a6704504dc151f7da4c6d551d2f8854bdd79 --- .../deployment/31_deploy_initinfra_target_node.sh | 8 ++------ tools/deployment/35_deploy_worker_node.sh | 15 ++++++++------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/tools/deployment/31_deploy_initinfra_target_node.sh b/tools/deployment/31_deploy_initinfra_target_node.sh index 0fdbeb928..3231fb7ab 100755 --- a/tools/deployment/31_deploy_initinfra_target_node.sh +++ b/tools/deployment/31_deploy_initinfra_target_node.sh @@ -22,7 +22,7 @@ cd ${AIRSHIPCTL_PROJECT} ./tools/deployment/31_deploy_initinfra_target_node.sh -hosts=(kubectl \ +hosts=$(kubectl \ --kubeconfig $KUBECONFIG \ --context $KUBECONFIG_TARGET_CONTEXT \ --request-timeout 10s get nodes -o name) @@ -33,11 +33,7 @@ do kubectl \ --kubeconfig $KUBECONFIG \ --context $KUBECONFIG_TARGET_CONTEXT \ - --request-timeout 10s annotate ${hosts[i]} secret=hco-ssh-auth - kubectl \ - --kubeconfig $KUBECONFIG \ - --context $KUBECONFIG_TARGET_CONTEXT \ - --request-timeout 10s label --overwrite ${hosts[i]} node-type=controlplane + --request-timeout 10s annotate --overwrite ${hosts[i]} secret=hco-ssh-auth kubectl \ --kubeconfig $KUBECONFIG \ --context $KUBECONFIG_TARGET_CONTEXT \ diff --git a/tools/deployment/35_deploy_worker_node.sh b/tools/deployment/35_deploy_worker_node.sh index f008c530b..cfec0edb4 100755 --- a/tools/deployment/35_deploy_worker_node.sh +++ b/tools/deployment/35_deploy_worker_node.sh @@ -18,6 +18,11 @@ export KUBECONFIG=${KUBECONFIG:-"$HOME/.airship/kubeconfig"} export KUBECONFIG_TARGET_CONTEXT=${KUBECONFIG_TARGET_CONTEXT:-"target-cluster"} : ${AIRSHIPCTL_PROJECT:="../airshipctl"} +export WORKER_NODE=${WORKER_NODE:-"$(airshipctl phase render workers-target \ + -k BareMetalHost 2> /dev/null | \ + yq .metadata.name | \ + sed 's/"//g')"} + # Annotate node for hostconfig-operator hosts=(kubectl \ --kubeconfig $KUBECONFIG \ @@ -29,11 +34,7 @@ do kubectl \ --kubeconfig $KUBECONFIG \ --context $KUBECONFIG_TARGET_CONTEXT \ - --request-timeout 10s annotate ${hosts[i]} secret=hco-ssh-auth - kubectl \ - --kubeconfig $KUBECONFIG \ - --context $KUBECONFIG_TARGET_CONTEXT \ - --request-timeout 10s label --overwrite ${hosts[i]} node-type=controlplane + --request-timeout 10s annotate --overwrite ${hosts[i]} secret=hco-ssh-auth kubectl \ --kubeconfig $KUBECONFIG \ --context $KUBECONFIG_TARGET_CONTEXT \ @@ -43,7 +44,7 @@ done cd ${AIRSHIPCTL_PROJECT} ./tools/deployment/35_deploy_worker_node.sh -hosts=(kubectl \ +hosts=$(kubectl \ --kubeconfig $KUBECONFIG \ --context $KUBECONFIG_TARGET_CONTEXT \ --request-timeout 10s get nodes -o name) @@ -54,7 +55,7 @@ do kubectl \ --kubeconfig $KUBECONFIG \ --context $KUBECONFIG_TARGET_CONTEXT \ - --request-timeout 10s annotate ${hosts[i]} secret=hco-ssh-auth + --request-timeout 10s annotate --overwrite ${hosts[i]} secret=hco-ssh-auth kubectl \ --kubeconfig $KUBECONFIG \ --context $KUBECONFIG_TARGET_CONTEXT \