From 01753f64f89232525637c4f1a0d73c672963e0c0 Mon Sep 17 00:00:00 2001 From: Alexander Hughes Date: Fri, 5 Mar 2021 09:11:10 -0500 Subject: [PATCH] Functionalize workers/provision - moves metal3 worker definition to its own function - removes workers-classification phase - removes 37_verify_hwcc_profiles.sh script Signed-off-by: Alexander Hughes Co-authored-by: Matthew Fuller Closes: #537 Change-Id: I844e88a1bf7a80954aca5afc8fa49a534c9ff2b0 --- .../workers-capm3}/kubeadmconfigtemplate.yaml | 0 .../workers-capm3}/kustomization.yaml | 5 --- .../workers-capm3}/machinedeployment.yaml | 0 .../workers-capm3}/metal3machinetemplate.yaml | 0 .../replacements/generated-secrets.yaml | 0 .../replacements/kustomization.yaml | 5 +++ .../replacements/workers-env-vars.yaml | 0 manifests/phases/phases.yaml | 13 ------ manifests/phases/plan.yaml | 1 - .../target/workers/kustomization.yaml | 5 +++ .../workers/replacements/kustomization.yaml | 3 +- playbooks/airshipctl-gate-runner.yaml | 1 - tools/deployment/35_deploy_worker_node.sh | 3 -- tools/deployment/37_verify_hwcc_profiles.sh | 43 ------------------- zuul.d/jobs.yaml | 1 - 15 files changed, 11 insertions(+), 69 deletions(-) rename manifests/{site/test-site/target/workers/provision => function/workers-capm3}/kubeadmconfigtemplate.yaml (100%) rename manifests/{site/test-site/target/workers/provision => function/workers-capm3}/kustomization.yaml (62%) rename manifests/{site/test-site/target/workers/provision => function/workers-capm3}/machinedeployment.yaml (100%) rename manifests/{site/test-site/target/workers/provision => function/workers-capm3}/metal3machinetemplate.yaml (100%) rename manifests/{site/test-site/target/workers => function/workers-capm3}/replacements/generated-secrets.yaml (100%) create mode 100644 manifests/function/workers-capm3/replacements/kustomization.yaml rename manifests/{site/test-site/target/workers => function/workers-capm3}/replacements/workers-env-vars.yaml (100%) delete mode 100755 tools/deployment/37_verify_hwcc_profiles.sh diff --git a/manifests/site/test-site/target/workers/provision/kubeadmconfigtemplate.yaml b/manifests/function/workers-capm3/kubeadmconfigtemplate.yaml similarity index 100% rename from manifests/site/test-site/target/workers/provision/kubeadmconfigtemplate.yaml rename to manifests/function/workers-capm3/kubeadmconfigtemplate.yaml diff --git a/manifests/site/test-site/target/workers/provision/kustomization.yaml b/manifests/function/workers-capm3/kustomization.yaml similarity index 62% rename from manifests/site/test-site/target/workers/provision/kustomization.yaml rename to manifests/function/workers-capm3/kustomization.yaml index f4443638d..86793bb0b 100644 --- a/manifests/site/test-site/target/workers/provision/kustomization.yaml +++ b/manifests/function/workers-capm3/kustomization.yaml @@ -1,11 +1,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - - ../../catalogues - - ../../../../../type/gating/hwccprofiles - kubeadmconfigtemplate.yaml - metal3machinetemplate.yaml - machinedeployment.yaml - -transformers: - - ../replacements diff --git a/manifests/site/test-site/target/workers/provision/machinedeployment.yaml b/manifests/function/workers-capm3/machinedeployment.yaml similarity index 100% rename from manifests/site/test-site/target/workers/provision/machinedeployment.yaml rename to manifests/function/workers-capm3/machinedeployment.yaml diff --git a/manifests/site/test-site/target/workers/provision/metal3machinetemplate.yaml b/manifests/function/workers-capm3/metal3machinetemplate.yaml similarity index 100% rename from manifests/site/test-site/target/workers/provision/metal3machinetemplate.yaml rename to manifests/function/workers-capm3/metal3machinetemplate.yaml diff --git a/manifests/site/test-site/target/workers/replacements/generated-secrets.yaml b/manifests/function/workers-capm3/replacements/generated-secrets.yaml similarity index 100% rename from manifests/site/test-site/target/workers/replacements/generated-secrets.yaml rename to manifests/function/workers-capm3/replacements/generated-secrets.yaml diff --git a/manifests/function/workers-capm3/replacements/kustomization.yaml b/manifests/function/workers-capm3/replacements/kustomization.yaml new file mode 100644 index 000000000..13e5a5f7f --- /dev/null +++ b/manifests/function/workers-capm3/replacements/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - workers-env-vars.yaml + - generated-secrets.yaml diff --git a/manifests/site/test-site/target/workers/replacements/workers-env-vars.yaml b/manifests/function/workers-capm3/replacements/workers-env-vars.yaml similarity index 100% rename from manifests/site/test-site/target/workers/replacements/workers-env-vars.yaml rename to manifests/function/workers-capm3/replacements/workers-env-vars.yaml diff --git a/manifests/phases/phases.yaml b/manifests/phases/phases.yaml index 76e2a72ae..0181edf87 100644 --- a/manifests/phases/phases.yaml +++ b/manifests/phases/phases.yaml @@ -87,19 +87,6 @@ config: --- apiVersion: airshipit.org/v1alpha1 kind: Phase -metadata: - name: workers-classification - clusterName: target-cluster -config: - cluster: target-cluster - executorRef: - apiVersion: airshipit.org/v1alpha1 - kind: KubernetesApply - name: kubernetes-apply - documentEntryPoint: target/workers/provision ---- -apiVersion: airshipit.org/v1alpha1 -kind: Phase metadata: name: clusterctl-init-ephemeral clusterName: ephemeral-cluster diff --git a/manifests/phases/plan.yaml b/manifests/phases/plan.yaml index 778aefe92..883b4e81a 100644 --- a/manifests/phases/plan.yaml +++ b/manifests/phases/plan.yaml @@ -12,7 +12,6 @@ phases: - name: initinfra-target - name: initinfra-networking-target - name: workers-target - - name: workers-classification - name: workload-target --- diff --git a/manifests/site/test-site/target/workers/kustomization.yaml b/manifests/site/test-site/target/workers/kustomization.yaml index e168397b1..97810634b 100644 --- a/manifests/site/test-site/target/workers/kustomization.yaml +++ b/manifests/site/test-site/target/workers/kustomization.yaml @@ -1,4 +1,9 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: + - ../catalogues + - ../../../../function/workers-capm3/ - nodes + +transformers: + - ../../../../function/workers-capm3/replacements diff --git a/manifests/site/test-site/target/workers/replacements/kustomization.yaml b/manifests/site/test-site/target/workers/replacements/kustomization.yaml index 13e5a5f7f..ea11f0164 100644 --- a/manifests/site/test-site/target/workers/replacements/kustomization.yaml +++ b/manifests/site/test-site/target/workers/replacements/kustomization.yaml @@ -1,5 +1,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - - workers-env-vars.yaml - - generated-secrets.yaml + - ../../../../function/workers-capm3/replacements diff --git a/playbooks/airshipctl-gate-runner.yaml b/playbooks/airshipctl-gate-runner.yaml index c191b6500..d3d2a6851 100644 --- a/playbooks/airshipctl-gate-runner.yaml +++ b/playbooks/airshipctl-gate-runner.yaml @@ -46,7 +46,6 @@ - ./tools/deployment/33_cluster_move_target_node.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/35_deploy_worker_node.sh b/tools/deployment/35_deploy_worker_node.sh index fff9453bb..0bdaaadfd 100755 --- a/tools/deployment/35_deploy_worker_node.sh +++ b/tools/deployment/35_deploy_worker_node.sh @@ -59,8 +59,5 @@ airshipctl phase run workers-target --debug echo "Waiting $TIMEOUT seconds for bmh to be in ready state." node_timeout bmh ready -echo "Classify and provision worker node" -airshipctl phase run workers-classification --debug - echo "Waiting $TIMEOUT seconds for node to be provisioned." node_timeout node Ready diff --git a/tools/deployment/37_verify_hwcc_profiles.sh b/tools/deployment/37_verify_hwcc_profiles.sh deleted file mode 100755 index e5ec47135..000000000 --- a/tools/deployment/37_verify_hwcc_profiles.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/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 -x - -export KUBECONFIG=${KUBECONFIG:-"$HOME/.airship/kubeconfig"} -export KUBECONFIG_TARGET_CONTEXT=${KUBECONFIG_TARGET_CONTEXT:-"target-cluster"} -declare -A PROFILES - -PROFILES[hardwareclassification-profile1]=1 -PROFILES[hardwareclassification-profile2]=0 - -declare -a ERRORS - -# HWCC need BMH in Ready state. -for i in "${!PROFILES[@]}" -do - nodes=$(kubectl --kubeconfig $KUBECONFIG --context $KUBECONFIG_TARGET_CONTEXT get bmh --no-headers=true -l hardwareclassification.metal3.io/$i 2>/dev/null | wc -l) - - if [ $nodes != ${PROFILES[$i]} ] - then - ERRORS+=($i) - fi -done - -if [ ${#ERRORS[@]} != 0 ] -then - echo FAILURE error with ${ERRORS[@]} - exit 1 -else - echo "SUCCESS" -fi diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 5de84269d..b4a5e1665 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -131,7 +131,6 @@ - ./tools/deployment/33_cluster_move_target_node.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 log_roles: