Skip to content

Commit

Permalink
Merge pull request #241 from bshephar/no-default-netmask
Browse files Browse the repository at this point in the history
Remove optional param CtlplaneNetmask
  • Loading branch information
openshift-merge-bot[bot] authored Jan 10, 2025
2 parents 1753545 + 6cefc79 commit df38233
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 @@ -81,9 +81,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 df38233

Please sign in to comment.