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:
@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 \
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
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
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"`
kud_bm_reset \
clean_bm_packages
-.PHONY: all bm_preinstall bm_install bashate
+.PHONY: all bashate
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
+++ /dev/null
-#!/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
+++ /dev/null
-#!/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
+++ /dev/null
-#!/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
+++ /dev/null
-{
- "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": []
- }
- }
- ]
-}
+++ /dev/null
-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;
-}
+++ /dev/null
-#!/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 <<EOF >${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 <<EOF >>${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 <<EOF >>${nodes_json_path}
- ]
-}
-EOF
+++ /dev/null
-#!/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 <<EOF >${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 <<EOF >>${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 <<EOF >>${provisioning_cr_path}
- - ${name}:
- mac-address: ${provisioning_mac}
-EOF
- done
-fi
-cat <<EOF >>${provisioning_cr_path}
- KUDPlugins:
- - emco
-EOF