🐛 Applyconfiguration: register CRD markers#1221
🐛 Applyconfiguration: register CRD markers#1221k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
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. DetailsInstructions 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. |
| return err | ||
| } | ||
|
|
||
| if err := crdmarkers.Register(into); err != nil { |
There was a problem hiding this comment.
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.
I think RegisterMarkers is already being called indirectly on this line:
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.
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 <alexy@mantha.dev>
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.
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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
LGTM label has been added. DetailsGit tree hash: df414be764aebac24ffc73713f2fbcac773110cd |
It seems the markers collector will only collect markers which have been explicitly registered to the markers registry. Since
groupNameis 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