From 95ca9e9192a22bb3172c373cdb611297fef5cfd6 Mon Sep 17 00:00:00 2001 From: Todd Malsbary Date: Fri, 21 Jan 2022 16:53:23 -0800 Subject: [PATCH] Remove BPA from Makefile Signed-off-by: Todd Malsbary Change-Id: I0aeae33f88181dbad679e6a4ca50bda2490df64f --- Makefile | 71 ++------------ Vagrantfile | 11 --- deploy/metal3/scripts/01_metal3.sh | 93 ------------------ deploy/metal3/scripts/02_verify.sh | 72 -------------- deploy/metal3/scripts/03_verify_deprovisioning.sh | 78 --------------- deploy/metal3/scripts/nodes.json.sample | 112 ---------------------- env/metal3/05_dhcp.conf.sample | 7 -- tools/vagrant/create_nodes_json_sample.sh | 66 ------------- tools/vagrant/create_provisioning_cr.sh | 41 -------- 9 files changed, 6 insertions(+), 545 deletions(-) delete mode 100755 deploy/metal3/scripts/01_metal3.sh delete mode 100755 deploy/metal3/scripts/02_verify.sh delete mode 100755 deploy/metal3/scripts/03_verify_deprovisioning.sh delete mode 100644 deploy/metal3/scripts/nodes.json.sample delete mode 100644 env/metal3/05_dhcp.conf.sample delete mode 100755 tools/vagrant/create_nodes_json_sample.sh delete mode 100755 tools/vagrant/create_provisioning_cr.sh diff --git a/Makefile b/Makefile index 3c61317..dce20d0 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,8 @@ SHELL:=/bin/bash ENV:=$(CURDIR)/env BMDIR:=$(CURDIR)/env/metal3 -METAL3DIR:=$(CURDIR)/deploy/metal3/scripts -BPA_OPERATOR:=$(CURDIR)/cmd/bpa-operator/ KUD_PATH:=$(CURDIR)/deploy/kud SDWAN_VERIFIER_PATH:=$(CURDIR)/sdwan/test -BPA_REST_API:=$(CURDIR)/cmd/bpa-restapi-agent BOOTLOADER_ENV:=$(CURDIR)/env/ubuntu/bootloader-env help: @@ -17,16 +14,13 @@ help: @echo " unit -- run the unit tests" @echo " help -- this help output" -install: jump_server \ - bmh_provision +install: jump_server jump_server: package_prerequisite \ kud_bm_deploy_mini \ bmh_install \ capi_install \ - flux_install \ - bpa_op_install \ - bpa_rest_api_install + flux_install clean_jump_server: bmh_clean_host \ kud_bm_reset \ @@ -35,12 +29,6 @@ clean_jump_server: bmh_clean_host \ package_prerequisite: pushd $(BMDIR) && ./01_install_package.sh && popd -bmh_clean: bmh_deprovision bmo_clean - -bmh_deprovision: - pushd $(METAL3DIR) && ./01_metal3.sh deprovision && \ - ./03_verify_deprovisioning.sh && ./01_metal3.sh clean && popd - bmo_clean: ./deploy/baremetal-operator/baremetal-operator.sh clean @@ -55,29 +43,13 @@ clean_bm_packages: pushd $(BOOTLOADER_ENV) && \ ./02_clean_bootloader_package_req.sh --bm-cleanall && popd -bmh_preinstall: +bmh_install: source user_config.sh && env && \ pushd $(BMDIR) && ./02_configure.sh && popd && \ - ./deploy/ironic/ironic.sh deploy - -bmh_install: bmh_preinstall + ./deploy/ironic/ironic.sh deploy && \ ./deploy/cert-manager/cert-manager.sh deploy && \ ./deploy/baremetal-operator/baremetal-operator.sh deploy -bmh_provision: - source user_config.sh && env && \ - pushd $(METAL3DIR) && ./01_metal3.sh provision && \ - ./02_verify.sh && popd - -clean_all: bmh_clean \ - clean_jump_server - -cluster_provision: - pushd $(BPA_OPERATOR) && make provision && popd - -cluster: bmh_provision \ - cluster_provision - kud_bm_deploy_mini: source user_config.sh && \ pushd $(KUD_PATH) && ./kud_bm_launch.sh minimal v1 && popd @@ -100,39 +72,8 @@ capi_install: flux_install: ./deploy/flux/flux.sh deploy -bpa_op_install: - pushd $(BPA_OPERATOR) && make docker && make deploy && popd - -bpa_op_install_e2e: - pushd $(BPA_OPERATOR) && make docker_e2e && make deploy && popd - -bpa_op_delete: - pushd $(BPA_OPERATOR) && make delete && popd - -bpa_op_e2e_bmh: - pushd $(BPA_OPERATOR) && make e2etest_bmh && popd - -bpa_op_unit: - pushd $(BPA_OPERATOR) && make unit_test && popd - -bpa_op_bmh_verifier: bpa_op_install_e2e bpa_op_e2e_bmh - -bpa_rest_api_install: - pushd $(BPA_REST_API) && make deploy && popd - -bpa_rest_api_uninstall: - pushd $(BPA_REST_API) && make clean && popd - -bpa_rest_api_verifier: - pushd $(BPA_REST_API) && make e2e_test && popd - -bpa_rest_api_unit: - pushd $(BPA_REST_API) && make unit_test && popd - unit: prerequisite \ - bashate \ - bpa_op_unit \ - bpa_rest_api_unit + bashate bashate: bashate -i E006,E003,E002,E010,E011,E042,E043 `find . -type f -not -path './cmd/bpa-operator/vendor/*' -not -path './ci/jjb/shell/*' -name "*.sh"` @@ -180,4 +121,4 @@ kud_bm_verifier: prerequisite \ kud_bm_reset \ clean_bm_packages -.PHONY: all bm_preinstall bm_install bashate +.PHONY: all bashate diff --git a/Vagrantfile b/Vagrantfile index dc20d15..abc29f1 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -175,17 +175,6 @@ Vagrant.configure("2") do |config| trigger.name = 'Removing machine from IPMI network' trigger.run = {inline: "./tools/vagrant/remove_machine_from_vbmc.sh #{site} #{machine_name} #{bmc_port}"} end - - # Create configuration for ICN provisioning - legacy_machine_args = "#{legacy_machine_args} #{machine_name} #{bmc_port}" - m.trigger.after [:up] do |trigger| - trigger.info = 'Creating nodes.json.sample describing the machines' - trigger.run = {inline: "./tools/vagrant/create_nodes_json_sample.sh #{site} #{legacy_machine_args}"} - end - m.trigger.after [:up] do |trigger| - trigger.info = 'Creating Provisioning resource describing the cluster' - trigger.run = {inline: "./tools/vagrant/create_provisioning_cr.sh #{site} #{legacy_machine_args}"} - end end end end diff --git a/deploy/metal3/scripts/01_metal3.sh b/deploy/metal3/scripts/01_metal3.sh deleted file mode 100755 index 0b0d564..0000000 --- a/deploy/metal3/scripts/01_metal3.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env bash -set -eu -o pipefail - -SCRIPTDIR="$(readlink -f $(dirname ${BASH_SOURCE[0]}))" -LIBDIR="$(dirname $(dirname $(dirname ${SCRIPTDIR})))/env/lib" - -eval "$(go env)" - -source $LIBDIR/common.sh - -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root" - exit 1 -fi - -function deprovision_compute_node { - name="$1" - if kubectl get baremetalhost $name -n metal3 &>/dev/null; then - kubectl patch baremetalhost $name -n metal3 --type merge \ - -p '{"spec":{"image":{"url":"","checksum":""}}}' - fi -} - -function make_bm_hosts { - while IFS=',' read -r name ipmi_username ipmi_password ipmi_address boot_mac os_username os_password os_image_name; do - node_machine_values >${SCRIPTDIR}/${name}-values.yaml - helm -n metal3 install ${name} ${SCRIPTDIR}/../../machine --create-namespace -f ${SCRIPTDIR}/${name}-values.yaml - - done -} - -function configure_nodes { - if [ ! -d $IRONIC_DATA_DIR ]; then - mkdir -p $IRONIC_DATA_DIR - fi - - #make sure nodes.json file in /opt/ironic/ are configured - if [ ! -f $NODES_FILE ]; then - cp ${SCRIPTDIR}/nodes.json.sample $NODES_FILE - fi -} - -function deprovision_bm_hosts { - while IFS=',' read -r name ipmi_username ipmi_password ipmi_address boot_mac os_username os_password os_image_name; do - deprovision_compute_node $name - done -} - -function clean_bm_hosts { - while IFS=',' read -r name ipmi_username ipmi_password ipmi_address boot_mac os_username os_password os_image_name; do - helm -n metal3 uninstall ${name} - rm -rf ${SCRIPTDIR}/${name}-values.yaml - done -} - -function clean_all { - list_nodes | clean_bm_hosts - if [ -f $NODES_FILE ]; then - rm -rf $NODES_FILE - fi -} - -function apply_bm_hosts { - list_nodes | make_bm_hosts -} - -function deprovision_all_hosts { - list_nodes | deprovision_bm_hosts -} - -if [ "$1" == "deprovision" ]; then - configure_nodes - deprovision_all_hosts - exit 0 -fi - -if [ "$1" == "provision" ]; then - configure_nodes - apply_bm_hosts - exit 0 -fi - -if [ "$1" == "clean" ]; then - configure_nodes - clean_all - exit 0 -fi - -echo "Usage: metal3.sh" -echo "provision - provision baremetal node as specified in common.sh" -echo "deprovision - deprovision baremetal node as specified in common.sh" -echo "clean - clean all the bmh resources" -exit 1 diff --git a/deploy/metal3/scripts/02_verify.sh b/deploy/metal3/scripts/02_verify.sh deleted file mode 100755 index cc2a87d..0000000 --- a/deploy/metal3/scripts/02_verify.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env bash -set -eu -o pipefail - -LIBDIR="$(dirname "$(dirname "$(dirname "$PWD")")")" - -eval "$(go env)" - -source $LIBDIR/env/lib/common.sh - -declare -i timeout=60 -declare -i interval=60 - -function check_provisioned { - declare -i prev_host_state=0 - declare -i j=0 - echo "Baremetal state: 1 means provisioned & 0 means not yet provisioned" - while IFS=',' read -r name ipmi_username ipmi_password ipmi_address boot_mac os_username os_password os_image_name; do - declare -i current_host_state=0 - state=$(kubectl get baremetalhosts $name -n metal3 -o json | jq -r '.status.provisioning.state') - echo "Baremetal host metal3 state - "$name" : "$state - - if [ "$state" == "provisioned" ];then - current_host_state=1 - fi - - echo "Baremetal $name current_host_state : "$current_host_state - echo "Previous Baremetals prev_host_state : "$prev_host_state - - if [ $j -eq 0 ]; then - prev_host_state=$current_host_state - ((j+=1)) - continue - fi - - if [ $current_host_state -eq 1 ] && [ $prev_host_state -eq 1 ]; then - prev_host_state=1 - else - prev_host_state=0 - fi - - echo "All Baremetal hosts aggregated state - prev_host_state:"$prev_host_state - ((j+=1)) - done - return $prev_host_state -} - -function warm_up_time { - echo "Wait for 240s for all baremetal hosts to reboot and network is up" - sleep 4m -} - -function wait_for_provisioned { - declare -i k=1 - while ((timeout > 0)); do - echo "Try $k iteration : Wait for $interval seconds to check all bmh state" - sleep $interval - if ! list_nodes | check_provisioned; then - echo "All the Baremetal hosts are provisioned - success" - warm_up_time - exit 0 - fi - ((timeout-=1)) - ((k+=1)) - done - exit 1 -} - -function verify_bm_hosts { - wait_for_provisioned -} - -verify_bm_hosts diff --git a/deploy/metal3/scripts/03_verify_deprovisioning.sh b/deploy/metal3/scripts/03_verify_deprovisioning.sh deleted file mode 100755 index 7ffcc01..0000000 --- a/deploy/metal3/scripts/03_verify_deprovisioning.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env bash -set -eu -o pipefail - -LIBDIR="$(dirname "$(dirname "$(dirname "$PWD")")")" - -eval "$(go env)" - -source $LIBDIR/env/lib/common.sh - -declare -i timeout=60 -declare -i interval=60 - -function check_deprovisioned { - declare -i prev_host_state=0 - declare -i j=0 - echo "Baremetal state: 1 means deprovisioned & 0 means not yet deprovisioned" - while IFS=',' read -r name ipmi_username ipmi_password ipmi_address boot_mac os_username os_password os_image_name; do - declare -i current_host_state=0 - if kubectl get baremetalhost $name -n metal3 &>/dev/null; then - state=$(kubectl get baremetalhosts $name -n metal3 -o json | jq -r '.status.provisioning.state') - else - # When the named BareMetalHost is not found, assume its deprovisioned - state="ready" - fi - echo "Baremetal host metal3 state - "$name" : "$state - - if [ "$state" == "ready" ];then - current_host_state=1 - fi - - echo "Baremetal $name current_host_state : "$current_host_state - echo "Previous Baremetals prev_host_state : "$prev_host_state - - if [ $j -eq 0 ]; then - prev_host_state=$current_host_state - ((j+=1)) - continue - fi - - if [ $current_host_state -eq 1 ] && [ $prev_host_state -eq 1 ]; then - prev_host_state=1 - else - prev_host_state=0 - fi - - echo "All Baremetal hosts aggregated state - prev_host_state:"$prev_host_state - ((j+=1)) - done - return $prev_host_state -} - -function warm_up_time { - echo "Wait for 240s for all baremetal hosts to reboot and network is up" - sleep 4m -} - -function wait_for_deprovisioned { - declare -i k=1 - while ((timeout > 0)); do - echo "Try $k iteration : Wait for $interval seconds to check all bmh state" - sleep $interval - if ! list_nodes | check_deprovisioned; then - echo "All the Baremetal hosts are deprovisioned - success" - warm_up_time - exit 0 - fi - ((timeout-=1)) - ((k+=1)) - done - exit 1 -} - - -function verify_bm_hosts_cleanup { - wait_for_deprovisioned -} - -verify_bm_hosts_cleanup diff --git a/deploy/metal3/scripts/nodes.json.sample b/deploy/metal3/scripts/nodes.json.sample deleted file mode 100644 index ce2402a..0000000 --- a/deploy/metal3/scripts/nodes.json.sample +++ /dev/null @@ -1,112 +0,0 @@ -{ - "nodes": [ - { - "name": "pod11-node2", - "ipmi_driver_info": { - "username": "root", - "password": "root", - "address": "10.10.110.12" - }, - "os": { - "image_name": "focal-server-cloudimg-amd64.img", - "username": "ubuntu", - "password": "mypasswd" - }, - "net": { - "links": [ - { - "id": "baremetal_nic", - "ethernet_mac_address": "00:1e:67:fe:f4:19", - "type": "phy" - }, - { - "id": "provisioning_nic", - "ethernet_mac_address": "00:1e:67:fe:f4:1a", - "type": "phy" - }, - { - "id": "sriov_nic", - "ethernet_mac_address": "00:1e:67:f8:6a:41", - "type": "phy" - } - ], - "networks": [ - { - "id": "baremetal", - "link": "baremetal_nic", - "type": "ipv4", - "ip_address": "10.10.110.22/24", - "gateway": "10.10.110.1", - "dns_nameservers": ["8.8.8.8"] - }, - { - "id": "provisioning", - "link": "provisioning_nic", - "type": "ipv4_dhcp" - }, - { - "id": "sriov", - "link": "sriov_nic", - "type": "ipv4", - "ip_address": "10.10.113.3/24" - } - ], - "services": [] - } - }, - { - "name": "pod11-node3", - "ipmi_driver_info": { - "username": "root", - "password": "root", - "address": "10.10.110.13" - }, - "os": { - "image_name": "focal-server-cloudimg-amd64.img", - "username": "ubuntu", - "password": "mypasswd" - }, - "net": { - "links": [ - { - "id": "baremetal_nic", - "ethernet_mac_address": "00:1e:67:f1:5b:90", - "type": "phy" - }, - { - "id": "provisioning_nic", - "ethernet_mac_address": "00:1e:67:f1:5b:91", - "type": "phy" - }, - { - "id": "sriov_nic", - "ethernet_mac_address": "00:1e:67:f8:69:81", - "type": "phy" - } - ], - "networks": [ - { - "id": "baremetal", - "link": "baremetal_nic", - "type": "ipv4", - "ip_address": "10.10.110.203/24", - "gateway": "10.10.110.1", - "dns_nameservers": ["8.8.8.8"] - }, - { - "id": "provisioning", - "link": "provisioning_nic", - "type": "ipv4_dhcp" - }, - { - "id": "sriov", - "link": "sriov_nic", - "type": "ipv4", - "ip_address": "10.10.113.4/24" - } - ], - "services": [] - } - } - ] -} diff --git a/env/metal3/05_dhcp.conf.sample b/env/metal3/05_dhcp.conf.sample deleted file mode 100644 index c9a4689..0000000 --- a/env/metal3/05_dhcp.conf.sample +++ /dev/null @@ -1,7 +0,0 @@ -default-lease-time 3600; -max-lease-time 7200; -authoritative; -subnet 172.31.1.0 netmask 255.255.255.0 { - option subnet-mask 255.255.255.0; - range 172.31.1.201 172.31.1.254; -} diff --git a/tools/vagrant/create_nodes_json_sample.sh b/tools/vagrant/create_nodes_json_sample.sh deleted file mode 100755 index 4729edb..0000000 --- a/tools/vagrant/create_nodes_json_sample.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -set -eu -o pipefail - -site=$1; shift - -nodes_json_path="deploy/metal3/scripts/nodes.json.sample" -ipmi_host=$(virsh -c qemu:///system net-dumpxml ${site}-baremetal | xmlstarlet sel -t -v "//network/ip/@address") - -cat <${nodes_json_path} -{ - "nodes": [ -EOF - -while (("$#")); do - name=$1; shift - ipmi_port=$1; shift - baremetal_mac=$(virsh -c qemu:///system dumpxml "${site}-${name}" | xmlstarlet sel -t -v "//interface[source/@network='${site}-baremetal']/mac/@address") - provisioning_mac=$(virsh -c qemu:///system dumpxml "${site}-${name}" | xmlstarlet sel -t -v "//interface[source/@network='${site}-provisioning']/mac/@address") - if (("$#")); then comma=","; else comma=""; fi - cat <>${nodes_json_path} - { - "name": "${name}", - "ipmi_driver_info": { - "username": "admin", - "password": "password", - "address": "${ipmi_host}:${ipmi_port}" - }, - "os": { - "image_name": "focal-server-cloudimg-amd64.img", - "username": "ubuntu", - "password": "mypasswd" - }, - "net": { - "links": [ - { - "id": "baremetal_nic", - "ethernet_mac_address": "${baremetal_mac}", - "type": "phy" - }, - { - "id": "provisioning_nic", - "ethernet_mac_address": "${provisioning_mac}", - "type": "phy" - } - ], - "networks": [ - { - "id": "baremetal", - "link": "baremetal_nic", - "type": "ipv4_dhcp" - }, - { - "id": "provisioning", - "link": "provisioning_nic", - "type": "ipv4_dhcp" - } - ], - "services": [] - } - }${comma} -EOF -done -cat <>${nodes_json_path} - ] -} -EOF diff --git a/tools/vagrant/create_provisioning_cr.sh b/tools/vagrant/create_provisioning_cr.sh deleted file mode 100755 index 917245d..0000000 --- a/tools/vagrant/create_provisioning_cr.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -set -eu -o pipefail - -site=$1; shift - -provisioning_cr_path="cmd/bpa-operator/e2etest/test_bmh_provisioning_cr.yaml" - -name=$1; shift -ipmi_port=$1; shift -provisioning_mac=$(virsh -c qemu:///system dumpxml "${site}-${name}" | xmlstarlet sel -t -v "//interface[source/@network='${site}-provisioning']/mac/@address") -cat <${provisioning_cr_path} -apiVersion: bpa.akraino.org/v1alpha1 -kind: Provisioning -metadata: - name: provisioning-test-bmh - labels: - cluster: test-bmh-cluster - owner: tester -spec: - masters: - - ${name}: - mac-address: ${provisioning_mac} -EOF -if (("$#")); then - cat <>${provisioning_cr_path} - workers: -EOF - while (("$#")); do - name=$1; shift - ipmi_port=$1; shift - provisioning_mac=$(virsh -c qemu:///system dumpxml "${site}-${name}" | xmlstarlet sel -t -v "//interface[source/@network='${site}-provisioning']/mac/@address") - cat <>${provisioning_cr_path} - - ${name}: - mac-address: ${provisioning_mac} -EOF - done -fi -cat <>${provisioning_cr_path} - KUDPlugins: - - emco -EOF -- 2.16.6