Skip to content

Commit

Permalink
Remove optional param CtlplaneNetmask
Browse files Browse the repository at this point in the history
This change removes the CtlplaneNetmask parameter since it is not
required since we're using CIDR's.

Signed-off-by: Brendan Shephard <bshephar@redhat.com>
  • Loading branch information
bshephar authored and rabi committed Jan 10, 2025
1 parent 0fd6a2a commit 6cefc79
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 27 deletions.
4 changes: 0 additions & 4 deletions api/bases/baremetal.openstack.org_openstackbaremetalsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions api/v1beta1/openstackbaremetalset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 1 addition & 16 deletions pkg/openstackbaremetalset/baremetalhost.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 6cefc79

Please sign in to comment.