diff --git a/manifests/function/phase-helper/annotate_node_for_hostconfig_operator/kubectl_annotate_node.sh b/manifests/function/phase-helper/annotate_node_for_hostconfig_operator/kubectl_annotate_node.sh new file mode 100644 index 000000000..e455ecb94 --- /dev/null +++ b/manifests/function/phase-helper/annotate_node_for_hostconfig_operator/kubectl_annotate_node.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +# 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 -xe + +hosts=$(kubectl \ + --context $KCTL_CONTEXT \ + --request-timeout 10s get nodes -o name) + +# Annotate node for hostconfig-operator +for host in $hosts +do + kubectl \ + --context $KCTL_CONTEXT \ + --request-timeout 10s \ + annotate --overwrite $host \ + secret=hco-ssh-auth +done diff --git a/manifests/function/phase-helper/annotate_node_for_hostconfig_operator/kustomization.yaml b/manifests/function/phase-helper/annotate_node_for_hostconfig_operator/kustomization.yaml new file mode 100644 index 000000000..89c1cc3e4 --- /dev/null +++ b/manifests/function/phase-helper/annotate_node_for_hostconfig_operator/kustomization.yaml @@ -0,0 +1,6 @@ +configMapGenerator: +- name: kubectl-annotate-node-for-hostconfig-operator + options: + disableNameSuffixHash: true + files: + - script=kubectl_annotate_node.sh diff --git a/manifests/function/phase-helper/kustomization.yaml b/manifests/function/phase-helper/kustomization.yaml index 542924436..ab1da6de3 100644 --- a/manifests/function/phase-helper/kustomization.yaml +++ b/manifests/function/phase-helper/kustomization.yaml @@ -1,2 +1,3 @@ resources: -- calicoctl \ No newline at end of file +- calicoctl +- annotate_node_for_hostconfig_operator diff --git a/manifests/type/airship-core/phases/executors.yaml b/manifests/type/airship-core/phases/executors.yaml new file mode 100644 index 000000000..85849c172 --- /dev/null +++ b/manifests/type/airship-core/phases/executors.yaml @@ -0,0 +1,11 @@ +apiVersion: airshipit.org/v1alpha1 +kind: GenericContainer +metadata: + name: kubectl-annotate-node-for-hostconfig-operator +spec: + image: quay.io/airshipit/toolbox:latest + hostNetwork: true +configRef: + kind: ConfigMap + name: kubectl-annotate-node-for-hostconfig-operator + apiVersion: v1 \ No newline at end of file diff --git a/manifests/type/airship-core/phases/kustomization.yaml b/manifests/type/airship-core/phases/kustomization.yaml index 8f934f6f4..8e942fb39 100644 --- a/manifests/type/airship-core/phases/kustomization.yaml +++ b/manifests/type/airship-core/phases/kustomization.yaml @@ -2,5 +2,9 @@ resources: - ../../../../../airshipctl/manifests/phases/ - lma-infra-target.yaml - validation-config.yaml + - ../../../function/phase-helper/ + - executors.yaml + - phases.yaml + - plan.yaml transformers: - ../../../../../airshipctl/manifests/function/validator diff --git a/manifests/type/airship-core/phases/phases.yaml b/manifests/type/airship-core/phases/phases.yaml new file mode 100644 index 000000000..7fe2459b5 --- /dev/null +++ b/manifests/type/airship-core/phases/phases.yaml @@ -0,0 +1,10 @@ +apiVersion: airshipit.org/v1alpha1 +kind: Phase +metadata: + name: kubectl-annotate-node-for-hostconfig-operator-target + clusterName: target-cluster +config: + executorRef: + apiVersion: airshipit.org/v1alpha1 + kind: GenericContainer + name: kubectl-annotate-node-for-hostconfig-operator \ No newline at end of file diff --git a/manifests/type/airship-core/phases/plan.yaml b/manifests/type/airship-core/phases/plan.yaml new file mode 100644 index 000000000..b657d51b0 --- /dev/null +++ b/manifests/type/airship-core/phases/plan.yaml @@ -0,0 +1,149 @@ +apiVersion: airshipit.org/v1alpha1 +kind: PhasePlan +metadata: + name: deploy-aiship-core-gating +description: "Phase plan for airship-core deployment on gating" +phases: + # Deploy ephemeral node using redfish with iso + - name: remotedirect-ephemeral + # Wait for apiserver to become available + # Scripts for this phase placed in manifests/function/phase-helpers/wait_node/ + # To get ConfigMap for this phase, execute `airshipctl phase render --source config -k ConfigMap` + # and find ConfigMap with name kubectl-wait-node + - name: kubectl-wait-node-ephemeral + # Waiting for any pods to be available + # Scripts for this phase placed in manifests/function/phase-helpers/wait_pods_any/ + # To get ConfigMap for this phase, execute `airshipctl phase render --source config -k ConfigMap` + # and find ConfigMap with name kubectl-wait-pods-any + - name: kubectl-wait-pods-any-ephemeral + # Deploy calico using tigera operator + - name: initinfra-networking-ephemeral + # Wait for Calico to be deployed using tigera + # Scripts for this phase placed in manifests/function/phase-helpers/wait_tigera/ + # To get ConfigMap for this phase, execute `airshipctl phase render --source config -k ConfigMap` + # and find ConfigMap with name kubectl-wait_tigera + - name: kubectl-wait-tigera-ephemeral + # Deploy metal3.io components to ephemeral node + - name: initinfra-ephemeral + # Getting pods as debug information" + # Scripts for this phase placed in manifests/function/phase-helpers/get_pods/ + # 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-ephemeral + # Deploy cluster-api components to ephemeral node + - name: clusterctl-init-ephemeral + # Waiting for clusterapi pods to come up + # Scripts for this phase placed in manifests/function/phase-helpers/wait_deploy/ + # To get ConfigMap for this phase, execute `airshipctl phase render --source config -k ConfigMap` + # and find ConfigMap with name kubectl-wait-deploy + - name: kubectl-wait-deploy-ephemeral + # Scripts for this phase placed in manifests/function/phase-helpers/get_pods/ + # 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-ephemeral + # TODO (dukov) this is needed due to sushy tools inserts cdrom image to + # all vms. This can be removed once sushy tool is fixed + # Scripts for this phase placed in manifests/function/phase-helpers/virsh-eject-cdrom-images/ + # To get ConfigMap for this phase, execute `airshipctl phase render --source config -k ConfigMap` + # and find ConfigMap with name virsh-eject-cdrom-images + - name: virsh-eject-cdrom-images + # Create target k8s cluster resources + - name: controlplane-ephemeral + # List all nodes in target cluster + # Scripts for this phase placed in manifests/function/phase-helpers/get_node/ + # To get ConfigMap for this phase, execute `airshipctl phase render --source config -k ConfigMap` + # and find ConfigMap with name kubectl-get-node + - name: kubectl-get-node-target + # List all pods in target cluster + # Scripts for this phase placed in manifests/function/phase-helpers/get_pods/ + # 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 + # Deploy calico using tigera operator + - name: initinfra-networking-target + # Wait for Calico to be deployed using tigera + # Scripts for this phase placed in manifests/function/phase-helpers/wait_tigera/ + # To get ConfigMap for this phase, execute `airshipctl phase render --source config -k ConfigMap` + # and find ConfigMap with name kubectl-wait-tigera + - name: kubectl-wait-tigera-target + # Deploy infra to cluster + - name: initinfra-target + # List all pods + # Scripts for this phase placed in manifests/function/phase-helpers/get_pods/ + # 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 + # Annotate node for hostconfig-operator + # Scripts for this phase placed in manifests/function/phase-helpers/annotate_node_for_hostconfig_operator/ + # To get ConfigMap for this phase, execute `airshipctl phase render --source config -k ConfigMap` + # and find ConfigMap with name kubectl-annotate-node-for-hostconfig-operator + - name: kubectl-annotate-node-for-hostconfig-operator-target + # Deploy CAPI components to target cluster + - name: clusterctl-init-target + # Waiting for pods to be ready + # Scripts for this phase placed in manifests/function/phase-helpers/wait_pods_ready/ + # To get ConfigMap for this phase, execute `airshipctl phase render --source config -k ConfigMap` + # and find ConfigMap with name kubectl-wait-pods-ready + - name: kubectl-wait-pods-ready-target + # Scripts for this phase placed in manifests/function/phase-helpers/get_pods/ + # 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 + # Move Cluster Object to Target Cluster + - name: clusterctl-move + # Waiting for pods to be ready + # Scripts for this phase placed in manifests/function/phase-helpers/wait_pods_ready/ + # To get ConfigMap for this phase, execute `airshipctl phase render --source config -k ConfigMap` + # and find ConfigMap with name kubectl-wait-pods-ready + - name: kubectl-wait-pods-ready-target + # Scripts for this phase placed in manifests/function/phase-helpers/get_pods/ + # 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 + # Wait till crds are created + # Scripts for this phase placed in manifests/function/phase-helpers/wait_cluster/ + # 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 + # (TODO) Need to add manifests for controlplane-targer phase + # Create target k8s cluster resources + # - name: controlplane-target + # List all nodes in target cluster + # Scripts for this phase placed in manifests/function/phase-helpers/get_node/ + # To get ConfigMap for this phase, execute `airshipctl phase render --source config -k ConfigMap` + # and find ConfigMap with name kubectl-get-node + # - name: kubectl-get-node-target + # List all pods in target cluster + # Scripts for this phase placed in manifests/function/phase-helpers/get_pods/ + # 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 + # Scripts for this phase placed in manifests/function/phase-helpers/wait_label_node/ + # To get ConfigMap for this phase, execute `airshipctl phase render --source config -k ConfigMap` + # and find ConfigMap with name kubectl-wait-label-node + - name: kubectl-wait-label-node-target + # Annotate node for hostconfig-operator + # Scripts for this phase placed in manifests/function/phase-helpers/annotate_node_for_hostconfig_operator/ + # To get ConfigMap for this phase, execute `airshipctl phase render --source config -k ConfigMap` + # and find ConfigMap with name kubectl-annotate-node-for-hostconfig-operator + - name: kubectl-annotate-node-for-hostconfig-operator-target + # Deploy workload + - name: workload-target + # Ensure we can reach ingress controller default backend + # Scripts for this phase placed in manifests/function/phase-helpers/check_ingress_ctrl/ + # To get ConfigMap for this phase, execute `airshipctl phase render --source config -k ConfigMap` + # and find ConfigMap with name kubectl-check-ingress-ctrl + - name: kubectl-check-ingress-ctrl-target + # (TODO) Need to verify these phases + # - name: lma-infra + # - name: lma-stack + # - name: lma-configs + # - name: deliver-network-policy diff --git a/playbooks/airship-treasuremap-gate-runner.yaml b/playbooks/airship-treasuremap-gate-runner.yaml index 0e54e3e3b..37e64bf77 100644 --- a/playbooks/airship-treasuremap-gate-runner.yaml +++ b/playbooks/airship-treasuremap-gate-runner.yaml @@ -25,14 +25,7 @@ - ./tools/deployment/airship-core/23_pull_documents.sh - ./tools/deployment/airship-core/23_generate_secrets.sh - ./tools/deployment/airship-core/24_build_images.sh - - ./tools/deployment/airship-core/25_deploy_ephemeral_node.sh - - ./tools/deployment/airship-core/26_deploy_capi_ephemeral_node.sh - - ./tools/deployment/airship-core/30_deploy_controlplane.sh - - ./tools/deployment/airship-core/31_deploy_initinfra_target_node.sh - - ./tools/deployment/airship-core/32_cluster_init_target_node.sh - - ./tools/deployment/airship-core/33_cluster_move_target_node.sh - - ./tools/deployment/airship-core/35_deploy_worker_node.sh - - ./tools/deployment/airship-core/36_deploy_workload.sh + - ./tools/deployment/airship-core/25_deploy_gating.sh - name: "Run gate scripts" include_role: diff --git a/tools/deployment/airship-core/25_deploy_ephemeral_node.sh b/tools/deployment/airship-core/25_deploy_ephemeral_node.sh deleted file mode 120000 index ea3301727..000000000 --- a/tools/deployment/airship-core/25_deploy_ephemeral_node.sh +++ /dev/null @@ -1 +0,0 @@ -../common/25_deploy_ephemeral_node.sh \ No newline at end of file diff --git a/tools/deployment/airship-core/40_deploy_lma.sh b/tools/deployment/airship-core/25_deploy_gating.sh similarity index 79% rename from tools/deployment/airship-core/40_deploy_lma.sh rename to tools/deployment/airship-core/25_deploy_gating.sh index e224207ea..7880e4ba2 100755 --- a/tools/deployment/airship-core/40_deploy_lma.sh +++ b/tools/deployment/airship-core/25_deploy_gating.sh @@ -14,7 +14,4 @@ set -xe -echo "Deploying LMA stack" -airshipctl phase run --debug lma-infra -airshipctl phase run --debug lma-stack -airshipctl phase run --debug lma-configs +airshipctl plan run deploy-aiship-core-gating --debug diff --git a/tools/deployment/airship-core/26_deploy_capi_ephemeral_node.sh b/tools/deployment/airship-core/26_deploy_capi_ephemeral_node.sh deleted file mode 120000 index 787d3de94..000000000 --- a/tools/deployment/airship-core/26_deploy_capi_ephemeral_node.sh +++ /dev/null @@ -1 +0,0 @@ -../common/26_deploy_capi_ephemeral_node.sh \ No newline at end of file diff --git a/tools/deployment/airship-core/30_deploy_controlplane.sh b/tools/deployment/airship-core/30_deploy_controlplane.sh deleted file mode 120000 index 3c196bd80..000000000 --- a/tools/deployment/airship-core/30_deploy_controlplane.sh +++ /dev/null @@ -1 +0,0 @@ -../common/30_deploy_controlplane.sh \ No newline at end of file diff --git a/tools/deployment/airship-core/31_deploy_initinfra_target_node.sh b/tools/deployment/airship-core/31_deploy_initinfra_target_node.sh deleted file mode 120000 index 6d96ef432..000000000 --- a/tools/deployment/airship-core/31_deploy_initinfra_target_node.sh +++ /dev/null @@ -1 +0,0 @@ -../common/31_deploy_initinfra_target_node.sh \ No newline at end of file diff --git a/tools/deployment/airship-core/32_cluster_init_target_node.sh b/tools/deployment/airship-core/32_cluster_init_target_node.sh deleted file mode 120000 index 4cefb277d..000000000 --- a/tools/deployment/airship-core/32_cluster_init_target_node.sh +++ /dev/null @@ -1 +0,0 @@ -../common/32_cluster_init_target_node.sh \ No newline at end of file diff --git a/tools/deployment/airship-core/33_cluster_move_target_node.sh b/tools/deployment/airship-core/33_cluster_move_target_node.sh deleted file mode 120000 index 05c452bc2..000000000 --- a/tools/deployment/airship-core/33_cluster_move_target_node.sh +++ /dev/null @@ -1 +0,0 @@ -../common/33_cluster_move_target_node.sh \ No newline at end of file diff --git a/tools/deployment/airship-core/34_deploy_controlplane_target.sh b/tools/deployment/airship-core/34_deploy_controlplane_target.sh deleted file mode 120000 index 38a3ae942..000000000 --- a/tools/deployment/airship-core/34_deploy_controlplane_target.sh +++ /dev/null @@ -1 +0,0 @@ -../common/34_deploy_controlplane_target.sh \ No newline at end of file diff --git a/tools/deployment/airship-core/35_deploy_worker_node.sh b/tools/deployment/airship-core/35_deploy_worker_node.sh deleted file mode 120000 index a9fabf211..000000000 --- a/tools/deployment/airship-core/35_deploy_worker_node.sh +++ /dev/null @@ -1 +0,0 @@ -../common/35_deploy_worker_node.sh \ No newline at end of file diff --git a/tools/deployment/airship-core/36_deploy_workload.sh b/tools/deployment/airship-core/36_deploy_workload.sh deleted file mode 120000 index 3c61c979d..000000000 --- a/tools/deployment/airship-core/36_deploy_workload.sh +++ /dev/null @@ -1 +0,0 @@ -../common/36_deploy_workload.sh \ No newline at end of file diff --git a/tools/deployment/airship-core/37_verify_hwcc_profiles.sh b/tools/deployment/airship-core/37_verify_hwcc_profiles.sh deleted file mode 120000 index e8410dc5c..000000000 --- a/tools/deployment/airship-core/37_verify_hwcc_profiles.sh +++ /dev/null @@ -1 +0,0 @@ -../common/37_verify_hwcc_profiles.sh \ No newline at end of file diff --git a/tools/deployment/airship-core/40_deploy_network_policies.sh b/tools/deployment/airship-core/40_deploy_network_policies.sh deleted file mode 120000 index 039e8b862..000000000 --- a/tools/deployment/airship-core/40_deploy_network_policies.sh +++ /dev/null @@ -1 +0,0 @@ -../common/40_deploy_network_policies.sh \ No newline at end of file diff --git a/tools/deployment/common/25_deploy_ephemeral_node.sh b/tools/deployment/common/25_deploy_ephemeral_node.sh index 2e0bb4fb8..cbd8435d4 100755 --- a/tools/deployment/common/25_deploy_ephemeral_node.sh +++ b/tools/deployment/common/25_deploy_ephemeral_node.sh @@ -18,3 +18,4 @@ set -xe cd ${AIRSHIPCTL_PROJECT} ./tools/deployment/25_deploy_ephemeral_node.sh + diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index ed11fab09..4f88da823 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -75,14 +75,7 @@ - ./tools/deployment/airship-core/23_pull_documents.sh - ./tools/deployment/airship-core/23_generate_secrets.sh - ./tools/deployment/airship-core/24_build_images.sh - - ./tools/deployment/airship-core/25_deploy_ephemeral_node.sh - - ./tools/deployment/airship-core/26_deploy_capi_ephemeral_node.sh - - ./tools/deployment/airship-core/30_deploy_controlplane.sh - - ./tools/deployment/airship-core/31_deploy_initinfra_target_node.sh - - ./tools/deployment/airship-core/32_cluster_init_target_node.sh - - ./tools/deployment/airship-core/33_cluster_move_target_node.sh - - ./tools/deployment/airship-core/35_deploy_worker_node.sh - - ./tools/deployment/airship-core/36_deploy_workload.sh + - ./tools/deployment/airship-core/25_deploy_gating.sh serve_dir: /srv/images serve_port: 8099 voting: true diff --git a/zuul.d/projects.yaml b/zuul.d/projects.yaml index 54d44ff4f..2c24cd996 100644 --- a/zuul.d/projects.yaml +++ b/zuul.d/projects.yaml @@ -14,7 +14,7 @@ vars: # NOTE(drewwalters96): Set AIRSHIPCTL_REF to a commit SHA in order to pin # the cloned version of airshipctl to a known/compatible reference. - AIRSHIPCTL_REF: "c7d65d4114bf0f97bfbce3f02b6bf3d80d5ffe3e" + AIRSHIPCTL_REF: "16da661959b69ae54be83266cf7db0920083a2d4" sphinx_build_dir: docs/build check: jobs: