From 40f7f38f7e3e5d0da1bbbc89adab17b078df026d Mon Sep 17 00:00:00 2001 From: Sreejith Punnapuzha Date: Fri, 16 Apr 2021 08:19:58 -0500 Subject: [PATCH] Fix deployment scripts * fixes labeling issue with deployment scripts * allign scripts with airshipctl and treasuremap * update playbook and zuul job with script changes Signed-off-by: Sreejith Punnapuzha Change-Id: I43221565ab29fc78a60fbd4978c058eec5c88640 --- .../airship-treasuremap-gate-runner.yaml | 6 +-- .../31_deploy_initinfra_target_node.sh | 20 ++-------- .../34_deploy_controlplane_target.sh | 20 ++++++++++ ...orker_node.sh => 35_deploy_worker_node.sh} | 39 +++++++++++++------ ...ploy_workload.sh => 36_deploy_workload.sh} | 2 +- ...profiles.sh => 37_verify_hwcc_profiles.sh} | 2 +- zuul.d/jobs.yaml | 6 +-- 7 files changed, 60 insertions(+), 35 deletions(-) create mode 100755 tools/deployment/34_deploy_controlplane_target.sh rename tools/deployment/{34_deploy_worker_node.sh => 35_deploy_worker_node.sh} (56%) rename tools/deployment/{35_deploy_workload.sh => 36_deploy_workload.sh} (96%) rename tools/deployment/{36_verify_hwcc_profiles.sh => 37_verify_hwcc_profiles.sh} (93%) diff --git a/playbooks/airship-treasuremap-gate-runner.yaml b/playbooks/airship-treasuremap-gate-runner.yaml index f082026d3..71101b21b 100644 --- a/playbooks/airship-treasuremap-gate-runner.yaml +++ b/playbooks/airship-treasuremap-gate-runner.yaml @@ -31,9 +31,9 @@ - ./tools/deployment/31_deploy_initinfra_target_node.sh - ./tools/deployment/32_cluster_init_target_node.sh - ./tools/deployment/33_cluster_move_target_node.sh - - ./tools/deployment/34_deploy_worker_node.sh - - ./tools/deployment/35_deploy_workload.sh - - ./tools/deployment/36_verify_hwcc_profiles.sh + - ./tools/deployment/35_deploy_worker_node.sh + - ./tools/deployment/36_deploy_workload.sh + - ./tools/deployment/37_verify_hwcc_profiles.sh - name: "Run gate scripts" include_role: diff --git a/tools/deployment/31_deploy_initinfra_target_node.sh b/tools/deployment/31_deploy_initinfra_target_node.sh index c0280fa0e..0fdbeb928 100755 --- a/tools/deployment/31_deploy_initinfra_target_node.sh +++ b/tools/deployment/31_deploy_initinfra_target_node.sh @@ -18,26 +18,14 @@ export KUBECONFIG=${KUBECONFIG:-"$HOME/.airship/kubeconfig"} export KUBECONFIG_TARGET_CONTEXT=${KUBECONFIG_TARGET_CONTEXT:-"target-cluster"} : ${AIRSHIPCTL_PROJECT:="../airshipctl"} -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')"} - cd ${AIRSHIPCTL_PROJECT} -kubectl \ - --kubeconfig $KUBECONFIG \ - --context $KUBECONFIG_TARGET_CONTEXT \ - --request-timeout 10s \ - label nodes $TARGET_NODE node-type=controlplane - ./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`) + --request-timeout 10s get nodes -o name) # Annotate node for hostconfig-operator for i in "${!hosts[@]}" @@ -49,9 +37,9 @@ do kubectl \ --kubeconfig $KUBECONFIG \ --context $KUBECONFIG_TARGET_CONTEXT \ - --request-timeout 10s label ${hosts[i]} node-type=controlplane + --request-timeout 10s label --overwrite ${hosts[i]} node-type=controlplane kubectl \ --kubeconfig $KUBECONFIG \ --context $KUBECONFIG_TARGET_CONTEXT \ - --request-timeout 10s label ${hosts[i]} kubernetes.io/role=master + --request-timeout 10s label --overwrite ${hosts[i]} kubernetes.io/role=master done diff --git a/tools/deployment/34_deploy_controlplane_target.sh b/tools/deployment/34_deploy_controlplane_target.sh new file mode 100755 index 000000000..b7d88e296 --- /dev/null +++ b/tools/deployment/34_deploy_controlplane_target.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -ex + +: ${AIRSHIPCTL_PROJECT:="../airshipctl"} + +cd ${AIRSHIPCTL_PROJECT} +./tools/deployment/34_deploy_controlplane_target.sh diff --git a/tools/deployment/34_deploy_worker_node.sh b/tools/deployment/35_deploy_worker_node.sh similarity index 56% rename from tools/deployment/34_deploy_worker_node.sh rename to tools/deployment/35_deploy_worker_node.sh index b93bb883f..f008c530b 100755 --- a/tools/deployment/34_deploy_worker_node.sh +++ b/tools/deployment/35_deploy_worker_node.sh @@ -18,18 +18,35 @@ 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')"} - -cd ${AIRSHIPCTL_PROJECT} -./tools/deployment/34_deploy_worker_node.sh - -hosts=$(`kubectl \ +# Annotate node for hostconfig-operator +hosts=(kubectl \ --kubeconfig $KUBECONFIG \ --context $KUBECONFIG_TARGET_CONTEXT \ - --request-timeout 10s get nodes -o name`) + --request-timeout 10s get nodes -o name) + +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 --overwrite ${hosts[i]} node-type=controlplane + 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 \ + --kubeconfig $KUBECONFIG \ + --context $KUBECONFIG_TARGET_CONTEXT \ + --request-timeout 10s get nodes -o name) # Annotate node for hostconfig-operator for i in "${!hosts[@]}" @@ -41,5 +58,5 @@ do kubectl \ --kubeconfig $KUBECONFIG \ --context $KUBECONFIG_TARGET_CONTEXT \ - --request-timeout 10s label ${hosts[i]} kubernetes.io/role=master + --request-timeout 10s label --overwrite ${hosts[i]} kubernetes.io/role=master done diff --git a/tools/deployment/35_deploy_workload.sh b/tools/deployment/36_deploy_workload.sh similarity index 96% rename from tools/deployment/35_deploy_workload.sh rename to tools/deployment/36_deploy_workload.sh index 09f09820a..53282064b 100755 --- a/tools/deployment/35_deploy_workload.sh +++ b/tools/deployment/36_deploy_workload.sh @@ -29,4 +29,4 @@ export TARGET_PORT=${TARGET_PORT:-"$(airshipctl phase render controlplane-target echo $TARGET_IP $TARGET_PORT cd ${AIRSHIPCTL_PROJECT} -./tools/deployment/35_deploy_workload.sh +./tools/deployment/36_deploy_workload.sh diff --git a/tools/deployment/36_verify_hwcc_profiles.sh b/tools/deployment/37_verify_hwcc_profiles.sh similarity index 93% rename from tools/deployment/36_verify_hwcc_profiles.sh rename to tools/deployment/37_verify_hwcc_profiles.sh index 94f94ee75..25d7cbdae 100755 --- a/tools/deployment/36_verify_hwcc_profiles.sh +++ b/tools/deployment/37_verify_hwcc_profiles.sh @@ -17,4 +17,4 @@ set -ex : ${AIRSHIPCTL_PROJECT:="../airshipctl"} cd ${AIRSHIPCTL_PROJECT} -./tools/deployment/36_verify_hwcc_profiles.sh +./tools/deployment/37_verify_hwcc_profiles.sh diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index af9eda124..86a102bde 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -79,9 +79,9 @@ - ./tools/deployment/31_deploy_initinfra_target_node.sh - ./tools/deployment/32_cluster_init_target_node.sh - ./tools/deployment/33_cluster_move_target_node.sh - - ./tools/deployment/34_deploy_worker_node.sh - - ./tools/deployment/35_deploy_workload.sh - - ./tools/deployment/36_verify_hwcc_profiles.sh + - ./tools/deployment/35_deploy_worker_node.sh + - ./tools/deployment/36_deploy_workload.sh + - ./tools/deployment/37_verify_hwcc_profiles.sh serve_dir: /srv/images serve_port: 8099 voting: false