-
Notifications
You must be signed in to change notification settings - Fork 447
🐛 Applyconfiguration: register CRD markers #1221
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
🐛 Applyconfiguration: register CRD markers #1221
Conversation
|
Welcome @alexymantha! |
Hi @alexymantha. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
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.
/ok-to-test
@@ -72,6 +72,10 @@ func (Generator) RegisterMarkers(into *markers.Registry) error { | |||
return err | |||
} | |||
|
|||
if err := crdmarkers.Register(into); err != 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.
Thanks. Could you please change the test in pkg/applyconfiguration/applyconfiguration_integration_test.go to use this RegisterMarkers
rather than manually registering markers so we have a chance to find issues like this in CI?
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 RegisterMarkers
is already being called indirectly on this line:
Expect(optionsRegistry.Register(markers.Must(markers.MakeDefinition("applyconfiguration", markers.DescribesPackage, Generator{})))).To(Succeed()) |
because the markers specific to applyconfiguration
do not seem to be registered manually anywhere in the tests, that's the only registering I could find.
I will try to add some tests to cover this though
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.
On a side note, this didn't get caught by the tests because the tests are also registering the CRD generator in the same registry: https://github.com/kubernetes-sigs/controller-tools/blob/9afcc17b313ee6acb64e840a5aefba3414a345fb/pkg/applyconfiguration/applyconfiguration_integration_test.go#L109C24-L109C25
So the necessary markers were indirectly being registered
Signed-off-by: Alexy Mantha <[email protected]>
3755816
to
db11bcd
Compare
Expect(optionsRegistry.Register(markers.Must(markers.MakeDefinition("applyconfiguration", markers.DescribesPackage, Generator{})))).To(Succeed()) | ||
|
||
rt, err := genall.FromOptions(optionsRegistry, []string{ | ||
"crd:allowDangerousTypes=true,ignoreUnexportedFields=true", // Run another generator first to make sure they don't interfere; see also: the comment on cronjob_types.go:UntypedBlob |
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.
Split this up into another test that will run both generators. That way the tests covers both when applyconfiguration
runs standalone and when it runs with other generators.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alexymantha, alvaroaleman 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 |
LGTM label has been added. Git tree hash: df414be764aebac24ffc73713f2fbcac773110cd
|
It seems the markers collector will only collect markers which have been explicitly registered to the markers registry. Since
groupName
is never registered, it always fails withbecause the marker will not be in the map of markers despite the marker being set on the package.
This registers the CRD markers (
groupName
,versionName
, etc) so they can be collected and used to infer the group version.Fixes #1218