From 6cefc79a7478a6d43801097875ca23361bf5d900 Mon Sep 17 00:00:00 2001 From: Brendan Shephard Date: Mon, 9 Dec 2024 17:18:59 +1000 Subject: [PATCH] Remove optional param CtlplaneNetmask This change removes the CtlplaneNetmask parameter since it is not required since we're using CIDR's. Signed-off-by: Brendan Shephard --- ...al.openstack.org_openstackbaremetalsets.yaml | 4 ---- api/v1beta1/openstackbaremetalset_types.go | 3 --- ...al.openstack.org_openstackbaremetalsets.yaml | 4 ---- pkg/openstackbaremetalset/baremetalhost.go | 17 +---------------- 4 files changed, 1 insertion(+), 27 deletions(-) diff --git a/api/bases/baremetal.openstack.org_openstackbaremetalsets.yaml b/api/bases/baremetal.openstack.org_openstackbaremetalsets.yaml index a359a3f..8d88d54 100644 --- a/api/bases/baremetal.openstack.org_openstackbaremetalsets.yaml +++ b/api/bases/baremetal.openstack.org_openstackbaremetalsets.yaml @@ -143,10 +143,6 @@ spec: description: CtlplaneInterface - Interface on the provisioned nodes to use for ctlplane network type: string - ctlplaneNetmask: - description: 'CtlplaneNetmask - Netmask to use for ctlplane network - (TODO: acquire this is another manner?)' - type: string ctlplaneVlan: description: CtlplaneVlan - Vlan for ctlplane network type: integer diff --git a/api/v1beta1/openstackbaremetalset_types.go b/api/v1beta1/openstackbaremetalset_types.go index ac343c7..b57272f 100644 --- a/api/v1beta1/openstackbaremetalset_types.go +++ b/api/v1beta1/openstackbaremetalset_types.go @@ -80,9 +80,6 @@ type OpenStackBaremetalSetTemplateSpec struct { DeploymentSSHSecret string `json:"deploymentSSHSecret"` // CtlplaneInterface - Interface on the provisioned nodes to use for ctlplane network CtlplaneInterface string `json:"ctlplaneInterface"` - // +kubebuilder:validation:Optional - // CtlplaneNetmask - Netmask to use for ctlplane network (TODO: acquire this is another manner?) - CtlplaneNetmask string `json:"ctlplaneNetmask,omitempty"` // +kubebuilder:default=openshift-machine-api // +kubebuilder:validation:Optional // BmhNamespace Namespace to look for BaremetalHosts(default: openshift-machine-api) diff --git a/config/crd/bases/baremetal.openstack.org_openstackbaremetalsets.yaml b/config/crd/bases/baremetal.openstack.org_openstackbaremetalsets.yaml index a359a3f..8d88d54 100644 --- a/config/crd/bases/baremetal.openstack.org_openstackbaremetalsets.yaml +++ b/config/crd/bases/baremetal.openstack.org_openstackbaremetalsets.yaml @@ -143,10 +143,6 @@ spec: description: CtlplaneInterface - Interface on the provisioned nodes to use for ctlplane network type: string - ctlplaneNetmask: - description: 'CtlplaneNetmask - Netmask to use for ctlplane network - (TODO: acquire this is another manner?)' - type: string ctlplaneVlan: description: CtlplaneVlan - Vlan for ctlplane network type: integer diff --git a/pkg/openstackbaremetalset/baremetalhost.go b/pkg/openstackbaremetalset/baremetalhost.go index ed852e0..b0da8a1 100644 --- a/pkg/openstackbaremetalset/baremetalhost.go +++ b/pkg/openstackbaremetalset/baremetalhost.go @@ -99,22 +99,7 @@ func BaremetalHostProvision( // Check IP version and set template variables accordingly ipAddr, ipNet, err := net.ParseCIDR(ctlPlaneIP) if err != nil { - // TODO: Remove this conversion once all usage sets ctlPlaneIP in CIDR format. - ipAddr = net.ParseIP(ctlPlaneIP) - if ipAddr == nil { - return err - } - - var ipPrefix int - if ipAddr.To4() != nil { - ipPrefix, _ = net.IPMask(net.ParseIP(instance.Spec.CtlplaneNetmask).To4()).Size() - } else { - ipPrefix, _ = net.IPMask(net.ParseIP(instance.Spec.CtlplaneNetmask).To16()).Size() - } - _, ipNet, err = net.ParseCIDR(fmt.Sprintf("%s/%d", ipAddr, ipPrefix)) - if err != nil { - return err - } + return err } CtlplaneIPVersion := "ipv6"