Skip to content

Conversation

alexymantha
Copy link
Contributor

@alexymantha alexymantha commented Jun 20, 2025

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 with

could not infer groupVersion for package - Is the `// +groupName` marker set?
Error: not all generators ran successfully
run `controller-gen applyconfiguration paths=./api/v1beta1/ -w` to see all available markers, or `controller-gen applyconfiguration paths=./api/v1beta1/ -h` for usage

because 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

Copy link

linux-foundation-easycla bot commented Jun 20, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: alexymantha / name: Alexy Mantha (db11bcd)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jun 20, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @alexymantha!

It looks like this is your first PR to kubernetes-sigs/controller-tools 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/controller-tools has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jun 20, 2025
Copy link
Member

@alvaroaleman alvaroaleman left a 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 {
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 20, 2025
@alexymantha alexymantha force-pushed the fix/register-crd-markers branch from 3755816 to db11bcd Compare June 20, 2025 17:59
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 20, 2025
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
Copy link
Contributor Author

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.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 20, 2025
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: df414be764aebac24ffc73713f2fbcac773110cd

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 20, 2025
@k8s-ci-robot k8s-ci-robot merged commit 692f5e3 into kubernetes-sigs:main Jun 20, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants