X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=deploy%2Fmetal3-vm%2F03_launch_mgmt_cluster.sh;h=b72a30b6737f164fd6a1e694aa6601b2eaa077eb;hb=e3be88235a3456ea1b7fd34460d21d894ba21871;hp=7ebad78a3d253f341c83227d53b114ae2558cea5;hpb=31a860f56b53eb51a7dc4189e6959a004733115e;p=icn.git diff --git a/deploy/metal3-vm/03_launch_mgmt_cluster.sh b/deploy/metal3-vm/03_launch_mgmt_cluster.sh index 7ebad78..b72a30b 100755 --- a/deploy/metal3-vm/03_launch_mgmt_cluster.sh +++ b/deploy/metal3-vm/03_launch_mgmt_cluster.sh @@ -62,7 +62,7 @@ function launch_baremetal_operator { # documentation for the values below may be found at # https://cloudinit.readthedocs.io/en/latest/topics/modules.html -create_userdata() { +function create_userdata { name="$1" COMPUTE_NODE_FQDN="$name.akraino.icn.org" printf "#cloud-config\n" > $name-userdata.yaml @@ -84,10 +84,32 @@ create_userdata() { fi cat $HOME/.ssh/id_rsa.pub >> $name-userdata.yaml + cloud_init_scripts >> $name-userdata.yaml printf "\n" >> $name-userdata.yaml } -apply_userdata_credential() { +function cloud_init_scripts { + # set_dhcp_indentifier.sh: + # The IP address assigned to the provisioning NIC will change + # due to IPA using the MAC address as the client ID and systemd + # using a different ID. Tell systemd to use the MAC as the + # client ID. We can't do this in the network data as only the + # JSON format is supported by metal3, and the JSON format does + # not support the dhcp-identifier field. + cat << 'EOF' +write_files: +- path: /var/lib/cloud/scripts/per-instance/set_dhcp_identifier.sh + owner: root:root + permissions: '0777' + content: | + #!/usr/bin/env bash + set -eux -o pipefail + sed -i -e '/dhcp4: true$/!b' -e 'h;s/\S.*/dhcp-identifier: mac/;H;g' /etc/netplan/50-cloud-init.yaml + netplan apply +EOF +} + +function apply_userdata_credential { name="$1" cat < ./$name-user-data-credential.yaml apiVersion: v1 @@ -102,12 +124,12 @@ EOF kubectl apply -n metal3 -f $name-user-data-credential.yaml } -create_networkdata() { +function create_networkdata { name="$1" node_networkdata $name > $name-networkdata.json } -apply_networkdata_credential() { +function apply_networkdata_credential { name="$1" cat < ./$name-network-data-credential.yaml apiVersion: v1