-
Notifications
You must be signed in to change notification settings - Fork 551
OCPBUGS-54287: MachineOSConfig name should match MachineConfigPool #2399
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
base: master
Are you sure you want to change the base?
Conversation
Hello @umohnani8! Some important instructions when contributing to openshift/api: |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: umohnani8 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Add a restriction where the name of the MachineOSConfig object must be the same as the MachineConfigPool it is created for. This will ensure that we only have one MOSC per MCP. Signed-off-by: Urvashi <[email protected]>
@umohnani8: This pull request references Jira Issue OCPBUGS-54287, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. 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 openshift-eng/jira-lifecycle-plugin repository. |
/jira refresh |
@umohnani8: This pull request references Jira Issue OCPBUGS-54287, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
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 openshift-eng/jira-lifecycle-plugin repository. |
@umohnani8: 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-sigs/prow repository. I understand the commands that are listed here. |
@@ -18,6 +18,7 @@ import ( | |||
// MachineOSConfig describes the configuration for a build process managed by the MCO | |||
// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). | |||
// +openshift:compatibility-gen:level=1 | |||
// +kubebuilder:validation:XValidation:rule="self.metadata.name == self.spec.machineConfigPool.name", message="MachineOSConfig name must match the referenced MachineConfigPool name; can only have one MachineOSConfig per MachineConfigPool" |
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.
Is it possible in any circumstance for either of these fields to be omitted? As that would then cause an error here? Perhaps adding a test that reports that spec is missing and is required will show what the full error message becomes in this case?
To make this safe you could
// +kubebuilder:validation:XValidation:rule="self.metadata.name == self.spec.machineConfigPool.name", message="MachineOSConfig name must match the referenced MachineConfigPool name; can only have one MachineOSConfig per MachineConfigPool" | |
// +kubebuilder:validation:XValidation:rule="self.?metadata.name.orValue(\"\") == self.?spec.machineConfigPool.name.orValue(\"\")", message="MachineOSConfig name must match the referenced MachineConfigPool name; can only have one MachineOSConfig per MachineConfigPool" |
And then the error messages would be cleaner (assuming this does throw an error as I expect)
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.
Looks like spec.machineConfigPool.name
is required all the way down the chain, but metadata is an optional field.
Please add a selection of integration tests based on the readme in the |
Add a restriction where the name of the MachineOSConfig object must be the same as the MachineConfigPool it is created for. This will ensure that we only have one MOSC per MCP.
Fixes https://issues.redhat.com/browse/OCPBUGS-54287