From 2119c3c2f34687aa02a115ccde807c13dd8e67c9 Mon Sep 17 00:00:00 2001 From: James Gu Date: Fri, 11 Jun 2021 18:11:00 +0000 Subject: [PATCH] Added phase helper to power off ephemeral baremetal node Ephemeral node needs to be powered off to avoid dhcp conflict after cluster move. Also is used to replace the ephemeral vm destroy phase in the gate type plan. Tested in stl2. Change-Id: I099b226da384011954f81b574e89b742806eac95 --- .../airshipit.org_baremetalmanagers.yaml | 2 -- .../replacements/remotedirect-vars.yaml | 9 +++++++++ manifests/phases/executors.yaml | 17 ++++++++++++++--- manifests/phases/phases.yaml | 10 ++++++++++ manifests/type/gating/plan.yaml | 7 ++----- 5 files changed, 35 insertions(+), 10 deletions(-) diff --git a/manifests/function/airshipctl-schemas/airshipit.org_baremetalmanagers.yaml b/manifests/function/airshipctl-schemas/airshipit.org_baremetalmanagers.yaml index b225f1e6a..e6069d5b1 100644 --- a/manifests/function/airshipctl-schemas/airshipit.org_baremetalmanagers.yaml +++ b/manifests/function/airshipctl-schemas/airshipit.org_baremetalmanagers.yaml @@ -68,8 +68,6 @@ spec: required: - isoURL type: object - required: - - remoteDirect type: object timeout: description: Timeout in seconds diff --git a/manifests/function/bootstrap/replacements/remotedirect-vars.yaml b/manifests/function/bootstrap/replacements/remotedirect-vars.yaml index 0bc81b273..9580398e3 100644 --- a/manifests/function/bootstrap/replacements/remotedirect-vars.yaml +++ b/manifests/function/bootstrap/replacements/remotedirect-vars.yaml @@ -25,3 +25,12 @@ replacements: kind: BaremetalManager name: RemoteDirectEphemeral fieldrefs: ["spec.hostSelector.name%EPHEMERAL_NODE%"] +- source: + objref: + name: versions-remotedirect + fieldref: spec.remotedirect.node + target: + objref: + kind: BaremetalManager + name: PowerOffEphemeral + fieldrefs: ["spec.hostSelector.name%EPHEMERAL_NODE%"] diff --git a/manifests/phases/executors.yaml b/manifests/phases/executors.yaml index ea708563b..04df91765 100644 --- a/manifests/phases/executors.yaml +++ b/manifests/phases/executors.yaml @@ -215,6 +215,17 @@ spec: isoURL: ISO_URL --- apiVersion: airshipit.org/v1alpha1 +kind: BaremetalManager +metadata: + name: PowerOffEphemeral + labels: + airshipit.org/deploy-k8s: "false" +spec: + operation: power-off + hostSelector: + name: EPHEMERAL_NODE +--- +apiVersion: airshipit.org/v1alpha1 kind: GenericContainer metadata: name: iso-cloud-init-data @@ -501,7 +512,7 @@ kind: GenericContainer metadata: name: kubectl-wait-bmh spec: - image: quay.io/airshipit/toolbox:latest + image: localhost/toolbox hostNetwork: true envVars: - RESOURCE_GROUP_FILTER=metal3.io @@ -518,7 +529,7 @@ kind: GenericContainer metadata: name: kubectl-wait-label-node spec: - image: quay.io/airshipit/toolbox:latest + image: localhost/toolbox hostNetwork: true envVars: - RESOURCE_GROUP_FILTER=metal3.io @@ -535,7 +546,7 @@ kind: GenericContainer metadata: name: kubectl-check-ingress-ctrl spec: - image: quay.io/airshipit/toolbox:latest + image: localhost/toolbox hostNetwork: true configRef: kind: ConfigMap diff --git a/manifests/phases/phases.yaml b/manifests/phases/phases.yaml index 707cab59c..ea60e6ca0 100644 --- a/manifests/phases/phases.yaml +++ b/manifests/phases/phases.yaml @@ -280,6 +280,16 @@ config: --- apiVersion: airshipit.org/v1alpha1 kind: Phase +metadata: + name: power-off-ephemeral +config: + executorRef: + apiVersion: airshipit.org/v1alpha1 + kind: BaremetalManager + name: PowerOffEphemeral +--- +apiVersion: airshipit.org/v1alpha1 +kind: Phase metadata: name: kubectl-wait-node-ephemeral clusterName: ephemeral-cluster diff --git a/manifests/type/gating/plan.yaml b/manifests/type/gating/plan.yaml index a42f47099..0f211e7c2 100644 --- a/manifests/type/gating/plan.yaml +++ b/manifests/type/gating/plan.yaml @@ -105,6 +105,8 @@ phases: # To get ConfigMap for this phase, execute `airshipctl phase render --source config -k ConfigMap` # and find ConfigMap with name kubectl-wait-cluster - name: kubectl-wait-cluster-target + # Power off Ephemeral baremetal host avoid DHCP conflict + - name: power-off-ephemeral # Create target k8s cluster resources - name: controlplane-target # List all nodes in target cluster @@ -117,11 +119,6 @@ phases: # To get ConfigMap for this phase, execute `airshipctl phase render --source config -k ConfigMap` # and find ConfigMap with name kubectl-get-pods - name: kubectl-get-pods-target - # all vms. This can be removed once sushy tool is fixed - # Scripts for this phase placed in manifests/function/phase-helpers/virsh-destroy-vms/ - # To get ConfigMap for this phase, execute `airshipctl phase render --source config -k ConfigMap` - # and find ConfigMap with name virsh-destroy-vms - - name: virsh-destroy-vms # Deploy worker node - name: workers-target # Waiting for node to be provisioned