New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug 1957809: Validation of platform.openstack.machineSubnet #4917
Bug 1957809: Validation of platform.openstack.machineSubnet #4917
Conversation
If the user provides an UUID under platform.openstack.machinesSubnet of a subnet which does not exist, the installer should not fail with a backtrace. Instead, the installer should exit gracefully and provide the correct error to the user.
@adduarte: This pull request references Bugzilla bug 1957809, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
No GitHub users were found matching the public email listed for the QA contact in Bugzilla (juriarte@redhat.com), skipping review request. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one suggestion. And also it would be nice to have a unit test for this case.
@@ -38,7 +38,7 @@ func validateMachinesSubnet(p *openstack.Platform, n *types.Networking, ci *Clou | |||
if len(p.ExternalDNS) > 0 { | |||
allErrs = append(allErrs, field.Invalid(fldPath.Child("externalDNS"), p.ExternalDNS, "externalDNS is set, externalDNS is not supported when machinesSubnet is set")) | |||
} | |||
if !validUUIDv4(p.MachinesSubnet) { | |||
if !validUUIDv4(p.MachinesSubnet) || ci.MachinesSubnet == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to differentiate these errors. If there is no machine subnet with provided id, then we should generate NotFound error.
if !validUUIDv4(p.MachinesSubnet) {
allErrs = append(allErrs, field.InternalError(fldPath.Child("machinesSubnet"), errors.New("invalid subnet ID")))
} else if ci.MachinesSubnet == nil {
allErrs = append(allErrs, field.NotFound(fldPath.Child("machinesSubnet"), p.MachinesSubnet))
} else if n.MachineNetwork[0].CIDR.String() != ci.MachinesSubnet.CIDR {
allErrs = append(allErrs, field.InternalError(fldPath.Child("machinesSubnet"), fmt.Errorf("the first CIDR in machineNetwork, %s, doesn't match the CIDR of the machineSubnet, %s", n.MachineNetwork[0].CIDR.String(), ci.MachinesSubnet.CIDR)))
}
/label platform/openstack |
Co-authored-by: Martin André <m.andre@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mandre The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Please review the full test history for this PR and help us cut down flakes. |
2 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
@adduarte: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
@adduarte: All pull requests linked via external trackers have merged: Bugzilla bug 1957809 has been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
If the user provides an UUID under platform.openstack.machinesSubnet
of a subnet which does not exist, the installer should not fail with a
backtrace.
Instead, the installer should exit gracefully and provide the correct error
to the user.