Add script for controlplane_target phase

controlplane_target phase is required for multi-node target cluster.

Signed-off-by: James Gu <james.gu@att.com>
Change-Id: I2af1c815588c1ad457b59af8f2f0cb515ba33ce6
This commit is contained in:
James Gu 2021-04-12 17:49:09 -07:00 committed by Drew Walters
parent 6b81b829df
commit ad5fabe0d6
2 changed files with 5 additions and 55 deletions

View File

@ -14,39 +14,7 @@
set -ex
export KUBECONFIG=${KUBECONFIG:-"$HOME/.airship/kubeconfig"}
export KUBECONFIG_TARGET_CONTEXT=${KUBECONFIG_TARGET_CONTEXT:-"target-cluster"}
: ${AIRSHIPCTL_PROJECT:="../airshipctl"}
export TARGET_IP=${TARGET_IP:-"$(airshipctl phase render controlplane-target \
-k Metal3Cluster \
-l airshipit.org/stage=initinfra \
2> /dev/null | \
yq .spec.controlPlaneEndpoint.host |
sed 's/"//g')"}
export TARGET_PORT=${TARGET_PORT:-"$(airshipctl phase render controlplane-target \
-k Metal3Cluster -l airshipit.org/stage=initinfra \
2> /dev/null | \
yq .spec.controlPlaneEndpoint.port)"}
echo $TARGET_IP $TARGET_PORT
cd ${AIRSHIPCTL_PROJECT}
./tools/deployment/34_deploy_worker_node.sh
hosts=$(kubectl \
--kubeconfig $KUBECONFIG \
--context $KUBECONFIG_TARGET_CONTEXT \
--request-timeout 10s get nodes -o name)
# Annotate node for hostconfig-operator
for i in "${!hosts[@]}"
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 ${hosts[i]} kubernetes.io/role=master
done
./tools/deployment/34_deploy_controlplane_target.sh

View File

@ -23,31 +23,13 @@ export WORKER_NODE=${WORKER_NODE:-"$(airshipctl phase render workers-target \
yq .metadata.name | \
sed 's/"//g')"}
# Annotate node for hostconfig-operator
hosts=$(kubectl \
--kubeconfig $KUBECONFIG \
--context $KUBECONFIG_TARGET_CONTEXT \
--request-timeout 10s get nodes -o name)
for i in "${!hosts[@]}"
do
kubectl \
--kubeconfig $KUBECONFIG \
--context $KUBECONFIG_TARGET_CONTEXT \
--request-timeout 10s annotate --overwrite ${hosts[i]} secret=hco-ssh-auth
kubectl \
--kubeconfig $KUBECONFIG \
--context $KUBECONFIG_TARGET_CONTEXT \
--request-timeout 10s label --overwrite ${hosts[i]} kubernetes.io/role=master
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)
--request-timeout 10s get nodes -o name`)
# Annotate node for hostconfig-operator
for i in "${!hosts[@]}"
@ -55,9 +37,9 @@ do
kubectl \
--kubeconfig $KUBECONFIG \
--context $KUBECONFIG_TARGET_CONTEXT \
--request-timeout 10s annotate --overwrite ${hosts[i]} secret=hco-ssh-auth
--request-timeout 10s annotate ${hosts[i]} secret=hco-ssh-auth
kubectl \
--kubeconfig $KUBECONFIG \
--context $KUBECONFIG_TARGET_CONTEXT \
--request-timeout 10s label --overwrite ${hosts[i]} kubernetes.io/role=master
--request-timeout 10s label ${hosts[i]} kubernetes.io/role=master
done