IMAGE_URL=http://172.22.0.1/images/${BM_IMAGE}
IMAGE_CHECKSUM=http://172.22.0.1/images/${BM_IMAGE}.md5sum
+function clone_repos {
+ mkdir -p "${M3PATH}"
+ if [[ -d ${BMOPATH} && "${FORCE_REPO_UPDATE}" == "true" ]]; then
+ rm -rf "${BMOPATH}"
+ fi
+ if [ ! -d "${BMOPATH}" ] ; then
+ pushd "${M3PATH}"
+ git clone "${BMOREPO}"
+ popd
+ fi
+ pushd "${BMOPATH}"
+ git checkout "${BMOBRANCH}"
+ git pull -r || true
+ popd
+}
+
function get_default_interface_ipaddress {
local _ip=$1
local _default_interface=$(awk '$2 == 00000000 { print $1 }' /proc/net/route)
function deprovision_compute_node {
name="$1"
- kubectl patch baremetalhost $name -n metal3 --type merge \
- -p '{"spec":{"image":{"url":"","checksum":""}}}'
+ 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 set_compute_ssh_config {
}
function launch_baremetal_operator {
- docker pull integratedcloudnative/baremetal-operator:v1.0-icn
+ docker pull $IRONIC_BAREMETAL_IMAGE
kubectl apply -f bmo/namespace/namespace.yaml
kubectl apply -f bmo/rbac/service_account.yaml -n metal3
kubectl apply -f bmo/rbac/role.yaml -n metal3
printf "\n checksum: ""%s" "$IMAGE_CHECKSUM" >> $name-bm-node.yaml
printf "\n userData:" >> $name-bm-node.yaml
printf "\n name: ""%s" "$name""-user-data" >> $name-bm-node.yaml
- printf "\n namespace: metal3\n" >> $name-bm-node.yaml
+ printf "\n namespace: metal3" >> $name-bm-node.yaml
+ printf "\n rootDeviceHints:" >> $name-bm-node.yaml
+ printf "\n minSizeGigabytes: 48\n" >> $name-bm-node.yaml
kubectl apply -f $name-bm-node.yaml -n metal3
done
}
function cleanup {
while IFS=',' read -r name ipmi_username ipmi_password ipmi_address os_username os_password os_image_name; do
- kubectl delete bmh $name -n metal3
- kubectl delete secrets $name-bmc-secret -n metal3
- kubectl delete secrets $name-user-data -n metal3
+ kubectl delete --ignore-not-found=true bmh $name -n metal3
+ kubectl delete --ignore-not-found=true secrets $name-bmc-secret -n metal3
+ kubectl delete --ignore-not-found=true secrets $name-user-data -n metal3
if [ -f $name-bm-node.yaml ]; then
rm -rf $name-bm-node.yaml
fi
}
if [ "$1" == "launch" ]; then
+ clone_repos
launch_baremetal_operator
exit 0
fi