From 1d5a91400960f365fae14fa709f118eba2207de1 Mon Sep 17 00:00:00 2001 From: karmab Date: Sun, 13 Oct 2024 00:09:36 +0200 Subject: [PATCH] remove baremetal_macs use --- README.md | 1 - agent-config.yaml | 4 ++-- envfiles/bashrc | 2 +- kcli_pre.sh | 5 ----- paramfiles/lab.yml | 5 ----- paramfiles/lab_ipv6.yml | 5 ----- plans/kcli_plan_default.yml | 5 +---- plans/kcli_plan_infra.yml | 6 +++--- plans/kcli_plan_infra_default.yml | 2 +- samples/parameters_virtual.yml | 4 ---- scripts/07_deploy_hub.sh | 2 +- ztp/scripts/siteconfig.sample.yml | 2 +- 12 files changed, 10 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index de051941..30771cda 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,6 @@ Note that you can use the baseplan `kcli_plan_infra.yml` to deploy the infrastru |apps |[] | |apps_install_cr |False | |baremetal_cidr |None | -|baremetal_macs |[] | |baseplan |kcli_plan_infra.yml | |bmc_password |calvin | |bmc_reset |False | diff --git a/agent-config.yaml b/agent-config.yaml index 901b2fc7..55c9ffe2 100644 --- a/agent-config.yaml +++ b/agent-config.yaml @@ -27,7 +27,7 @@ apiVersion: v1alpha1 kind: AgentConfig metadata: name: {{ cluster }} -rendezvousIP: {{ rendezvous_ip|default(static_ips[0]) }} +rendezvousIP: {{ rendezvous_ip or static_ips[0] }} hosts: {% for host in hosts %} - hostname: {{ host['name']|default(cluster + "-" + loop.index0|string) }}.{{ domain }} @@ -48,7 +48,7 @@ hosts: deviceName: "/dev/{{ default_disk|basename }}" {% endif %} interfaces: - - macAddress: {{ host['mac']|default(baremetal_macs[loop.index]) }} + - macAddress: {{ host['mac']|default("%s:%0.2d" % (virtual_mac_prefix, loop.index)) }} name: {{ host['nic']|default('ens3') }} {% if 'ip' in host %} networkConfig: diff --git a/envfiles/bashrc b/envfiles/bashrc index abdbe93a..8a066f52 100644 --- a/envfiles/bashrc +++ b/envfiles/bashrc @@ -15,4 +15,4 @@ export PATH=/usr/local/bin:/root/bin:$PATH export REGISTRY_PASSWORD={{ disconnected_password }} export REGISTRY_USER={{ disconnected_user }} export PYTHONUNBUFFERED=true -export AI_URL={{ rendezvous_ip|default(static_ips[0])|ipv6_wrap }}:8090 +export AI_URL={{ (rendezvous_ip or static_ips[0])|ipv6_wrap }}:8090 diff --git a/kcli_pre.sh b/kcli_pre.sh index bc9fbc16..a91ea0e2 100755 --- a/kcli_pre.sh +++ b/kcli_pre.sh @@ -218,11 +218,6 @@ exit 1 {% endif %} {% endfor %} -{% if baremetal_macs|length + baremetal_nodes_macs|length < total_hub_nodes_number + total_spoke_nodes_number.value %} -echo You need to populate baremetal_macs with the complete list of mac addresses including your spokes or put that info in baremetal_nodes arrays -exit 1 -{% endif %} - {% if prega %} if [ "$(grep quay.io/prega {{ pull_secret }})" == "" ] ; then echo prega requires a valid pull secret entry diff --git a/paramfiles/lab.yml b/paramfiles/lab.yml index 6a67c38e..22a02da7 100644 --- a/paramfiles/lab.yml +++ b/paramfiles/lab.yml @@ -15,11 +15,6 @@ static_ips: - 192.168.130.21 - 192.168.130.22 - 192.168.130.23 -baremetal_macs: -- aa:aa:aa:aa:bb:01 -- aa:aa:aa:aa:bb:02 -- aa:aa:aa:aa:bb:03 -- aa:aa:aa:aa:bb:04 disconnected: true spoke_wait: true diff --git a/paramfiles/lab_ipv6.yml b/paramfiles/lab_ipv6.yml index e9a20af2..ac73eba9 100644 --- a/paramfiles/lab_ipv6.yml +++ b/paramfiles/lab_ipv6.yml @@ -19,11 +19,6 @@ static_ips: - 2620:52:0:1302::21 - 2620:52:0:1302::22 - 2620:52:0:1302::23 -baremetal_macs: -- aa:aa:aa:aa:bb:01 -- aa:aa:aa:aa:bb:02 -- aa:aa:aa:aa:bb:03 -- aa:aa:aa:aa:bb:04 spokes: - name: mgmt-spoke1 diff --git a/plans/kcli_plan_default.yml b/plans/kcli_plan_default.yml index a0e9fd25..25e21023 100644 --- a/plans/kcli_plan_default.yml +++ b/plans/kcli_plan_default.yml @@ -9,9 +9,7 @@ info: | default network type is OVNKubernetes but you can also specify OpenShiftSDN You can also use ca and imagecontentsources to customize your environments or drop specific manifests in the manifests directory If using virtual ctlplanes, the ctlplanes array can be omitted. - For virtual ctlplanes, You can - - force the baremetal macs of your ctlplanes using baremetal_macs variable. If you put more entries than your ctlplanes number, they will be used for virtual workers. - - set a pattern for their provisioning macs when you plan to host several cluster with virtual ctlplanes on the same hypervisor + For virtual hub, You can force the mac of your ctlplanes and workers version can be set to stable, nightly, dev-preview or ci , along with tag, to gather the binary from public sources. The ci registry is targetted with the openshift_image variable. To skip the hub installation, KUBECONFIG variable can be pointed to an existing kubeconfig file @@ -40,7 +38,6 @@ bmc_user: root bmc_password: calvin bmc_reset: false baremetal_cidr: -baremetal_macs: [] static_ips: [] pull_secret: openshift_pull.json notifyscript: scripts/notify.sh diff --git a/plans/kcli_plan_infra.yml b/plans/kcli_plan_infra.yml index ff327dca..9ae142f5 100644 --- a/plans/kcli_plan_infra.yml +++ b/plans/kcli_plan_infra.yml @@ -26,7 +26,7 @@ memory: {{ ctlplane_memory or memory }} nets: - name: {{ baremetal_net }} - mac: {{ baremetal_macs[num] }} + mac: {{ "%s:%0.2d" % (virtual_mac_prefix, num + 1) }} disks: {{ virtual_disks }} {% endfor %} {% endif %} @@ -46,7 +46,7 @@ memory: {{ worker_memory or memory }} nets: - name: {{ baremetal_net }} - mac: {{ baremetal_macs[ctlplanes + num] }} + mac: {{ "%s:%0.2d" % (virtual_mac_prefix, ctlplanes + num + 1) }} disks: {{ virtual_disks }} {% endfor %} {% endif %} @@ -80,7 +80,7 @@ memory: {{ spoke_memory }} nets: - name: {{ baremetal_net }} - mac: {{ baremetal_macs[ctlplanes + workers + total_number.value + num] }} + mac: {{ "%s:%0.2d" % (virtual_mac_prefix, ctlplanes + workers + total_number.value + num + 1) }} disks: - size: {{ spoke_disk_size }} interface: {{ spoke_disk_interface }} diff --git a/plans/kcli_plan_infra_default.yml b/plans/kcli_plan_infra_default.yml index 8e4ea768..30861e1b 100644 --- a/plans/kcli_plan_infra_default.yml +++ b/plans/kcli_plan_infra_default.yml @@ -19,7 +19,7 @@ disk_interface: scsi extra_disks: [] baremetal_net: baremetal baremetal_cidr: -baremetal_macs: [] +virtual_mac_prefix: aa:aa:aa:aa:bb static_ips: [] baremetal_ctlplanes: [] baremetal_workers: [] diff --git a/samples/parameters_virtual.yml b/samples/parameters_virtual.yml index f5cd6749..2880505b 100644 --- a/samples/parameters_virtual.yml +++ b/samples/parameters_virtual.yml @@ -10,7 +10,3 @@ bmc_password: mcfly baremetal_cidr: 11.0.0.0/24 api_ip: 11.0.0.2 ingress_ip: 11.0.0.4 -baremetal_macs: -- aa:bb:cc:dd:ab:01 -- aa:bb:cc:dd:ab:02 -- aa:bb:cc:dd:ab:03 diff --git a/scripts/07_deploy_hub.sh b/scripts/07_deploy_hub.sh index d9ced8fc..73f6791c 100755 --- a/scripts/07_deploy_hub.sh +++ b/scripts/07_deploy_hub.sh @@ -80,7 +80,7 @@ kcli start baremetal-host -P url={{ url }} -P user={{ user }} -P password={{ pas {% endfor %} {% if hosts|length == 1 %} -SNO_IP={{ rendezvous_ip|default(static_ips[0]) }} +SNO_IP={{ rendezvous_ip or static_ips[0] }} sed -i /api.{{ cluster }}.{{ domain }}/d /etc/hosts echo $SNO_IP api.{{ cluster }}.{{ domain }} >> /etc/hosts {% endif %} diff --git a/ztp/scripts/siteconfig.sample.yml b/ztp/scripts/siteconfig.sample.yml index cd19dc1e..0484d716 100644 --- a/ztp/scripts/siteconfig.sample.yml +++ b/ztp/scripts/siteconfig.sample.yml @@ -101,7 +101,7 @@ spec: {% if 'mac' in node %} {% set mac = node['mac'] %} {% else %} -{% set mac = baremetal_macs[ctlplanes + workers + total_number.value + num] %} +{% set mac = "%s:%0.2d" % (virtual_mac_prefix, ctlplanes + workers + total_number.value + num + 1) %} {% endif %} - hostName: {{ cluster }}-{{ spoke_name }}-node-{{ num }} role: {{ "master" if num < max_ctlplanes else "worker" }}