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:
parent
6b81b829df
commit
ad5fabe0d6
|
@ -14,39 +14,7 @@
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
export KUBECONFIG=${KUBECONFIG:-"$HOME/.airship/kubeconfig"}
|
|
||||||
export KUBECONFIG_TARGET_CONTEXT=${KUBECONFIG_TARGET_CONTEXT:-"target-cluster"}
|
|
||||||
: ${AIRSHIPCTL_PROJECT:="../airshipctl"}
|
: ${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}
|
cd ${AIRSHIPCTL_PROJECT}
|
||||||
./tools/deployment/34_deploy_worker_node.sh
|
./tools/deployment/34_deploy_controlplane_target.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
|
|
||||||
|
|
|
@ -23,31 +23,13 @@ export WORKER_NODE=${WORKER_NODE:-"$(airshipctl phase render workers-target \
|
||||||
yq .metadata.name | \
|
yq .metadata.name | \
|
||||||
sed 's/"//g')"}
|
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}
|
cd ${AIRSHIPCTL_PROJECT}
|
||||||
./tools/deployment/35_deploy_worker_node.sh
|
./tools/deployment/35_deploy_worker_node.sh
|
||||||
|
|
||||||
hosts=$(kubectl \
|
hosts=$(`kubectl \
|
||||||
--kubeconfig $KUBECONFIG \
|
--kubeconfig $KUBECONFIG \
|
||||||
--context $KUBECONFIG_TARGET_CONTEXT \
|
--context $KUBECONFIG_TARGET_CONTEXT \
|
||||||
--request-timeout 10s get nodes -o name)
|
--request-timeout 10s get nodes -o name`)
|
||||||
|
|
||||||
# Annotate node for hostconfig-operator
|
# Annotate node for hostconfig-operator
|
||||||
for i in "${!hosts[@]}"
|
for i in "${!hosts[@]}"
|
||||||
|
@ -55,9 +37,9 @@ do
|
||||||
kubectl \
|
kubectl \
|
||||||
--kubeconfig $KUBECONFIG \
|
--kubeconfig $KUBECONFIG \
|
||||||
--context $KUBECONFIG_TARGET_CONTEXT \
|
--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 \
|
kubectl \
|
||||||
--kubeconfig $KUBECONFIG \
|
--kubeconfig $KUBECONFIG \
|
||||||
--context $KUBECONFIG_TARGET_CONTEXT \
|
--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
|
done
|
||||||
|
|
Loading…
Reference in New Issue