Skip to content

Commit

Permalink
Merge pull request #9081 from shiftstack/mtu-validation-fix
Browse files Browse the repository at this point in the history
OCPBUGS-41785: Validate MTU when controlPlanePort uses FixedIPs
  • Loading branch information
openshift-merge-bot[bot] authored Oct 8, 2024
2 parents 7534652 + 3ab8bca commit e61b787
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions pkg/asset/installconfig/openstack/validation/cloudinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,15 @@ func (ci *CloudInfo) getNetwork(ctx context.Context, controlPlanePort *openstack
networkName := controlPlanePort.Network.Name
networkID := controlPlanePort.Network.ID
if networkName == "" && networkID == "" {
return nil, nil
if len(ci.ControlPlanePortSubnets) > 0 && ci.ControlPlanePortSubnets[0].NetworkID != "" {
networkID = ci.ControlPlanePortSubnets[0].NetworkID
} else {
return nil, nil
}
}
opts := networks.ListOpts{}
if networkID != "" {
opts.ID = controlPlanePort.Network.ID
opts.ID = networkID
}
if networkName != "" {
opts.Name = controlPlanePort.Network.Name
Expand Down
6 changes: 3 additions & 3 deletions pkg/asset/installconfig/openstack/validation/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ func validateControlPlanePort(p *openstack.Platform, n *types.Networking, ci *Cl
} else if ci.ControlPlanePortNetwork.ID != networkID {
allErrs = append(allErrs, field.Invalid(fldPath.Child("controlPlanePort").Child("network"), networkDetail, "network must contain subnets"))
}
if hasIPv6Subnet && ci.ControlPlanePortNetwork.MTU < minimumMTUv6 {
allErrs = append(allErrs, field.InternalError(fldPath.Child("controlPlanePort").Child("network"), fmt.Errorf("network should have an MTU of at least %d", minimumMTUv6)))
}
}
if hasIPv6Subnet && ci.ControlPlanePortNetwork != nil && ci.ControlPlanePortNetwork.MTU < minimumMTUv6 {
allErrs = append(allErrs, field.InternalError(fldPath.Child("controlPlanePort").Child("network"), fmt.Errorf("network should have an MTU of at least %d", minimumMTUv6)))
}
return allErrs
}
Expand Down

0 comments on commit e61b787

Please sign in to comment.