controller-tools icon indicating copy to clipboard operation
controller-tools copied to clipboard

🌱 crd gen: handle type any

Open brekelj1 opened this issue 5 months ago • 17 comments

Handle Go1.18's any type in CRD generator.

Fixes https://github.com/kubernetes-sigs/controller-tools/issues/1251.

brekelj1 avatar Aug 05 '25 01:08 brekelj1

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: brekelj1 / name: Jasper (2ebad8e74f467742a435366738eee4daa08b799c, f82cc1f522b434aec57e069349317343d3bb8d26, 7049f31ce2fa59837e473913d1ca3270777464a5)

Welcome @brekelj1!

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. :smiley:

k8s-ci-robot avatar Aug 05 '25 01:08 k8s-ci-robot

Hi @brekelj1. 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 avatar Aug 05 '25 01:08 k8s-ci-robot

It appears at the moment that we are generating a schema with the any type, I was somewhat expecting to return an error from the generator to say you can't use any or something more helpful than that tbh

I'm not sure if returning an empty schema is correct here, I don't know how the API server reacts to that

/hold we need to explore what the correct behaviour is here

JoelSpeed avatar Aug 05 '25 15:08 JoelSpeed

I updated the approach to always error on interface types (instead of also allowing empty interfaces): https://github.com/kubernetes-sigs/controller-tools/pull/1252#discussion_r2255587767

Also made updates for the other comments.

@JoelSpeed please rereview

brekelj1 avatar Aug 06 '25 02:08 brekelj1

/lgtm

@sbueringer @alvaroaleman I think this is a step in the right direction for avoiding panics when we come across any types. I know there are other open threads about potentially support any without an error, but until we come to a conclusion on the appropriate course there, I think this helps

Any concerns?

JoelSpeed avatar Aug 08 '25 09:08 JoelSpeed

LGTM label has been added.

Git tree hash: c98381fff1ecc0b9ab610c6ae079b545f433ae78

k8s-ci-robot avatar Aug 08 '25 09:08 k8s-ci-robot

/ok-to-test /hold cancel

JoelSpeed avatar Aug 08 '25 09:08 JoelSpeed

/assign

I'll take a look

sbueringer avatar Aug 11 '25 19:08 sbueringer

Thank you very much!!

/lgtm

/assign @JoelSpeed

For a final look

sbueringer avatar Aug 20 '25 14:08 sbueringer

LGTM label has been added.

Git tree hash: 70ecd588cfe2f431b32135284fc1960c9d52f7b1

k8s-ci-robot avatar Aug 20 '25 14:08 k8s-ci-robot

Need a final review / approval please @JoelSpeed

brekelj1 avatar Sep 16 '25 01:09 brekelj1

/approve

JoelSpeed avatar Sep 16 '25 11:09 JoelSpeed

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brekelj1, JoelSpeed

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 avatar Sep 16 '25 11:09 k8s-ci-robot

PR needs rebase.

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 avatar Sep 16 '25 11:09 k8s-ci-robot

@brekelj1: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-controller-tools-test-main f82cc1f522b434aec57e069349317343d3bb8d26 link unknown /test pull-controller-tools-test-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

k8s-ci-robot avatar Sep 16 '25 12:09 k8s-ci-robot

@brekelj1 please rebase the PR, thx!

sbueringer avatar Oct 21 '25 05:10 sbueringer

@brekelj1 reminder :)

sbueringer avatar Dec 18 '25 13:12 sbueringer