Closed everesio closed 4 days ago
Welcome @everesio!
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:
Hi @everesio. 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.
/ok-to-test
@everesio Do you have time to address the findings above?
@sbueringer Sorry, I thought the remarks were directed at the other reviewers. I can address the findings. Let's clarify the issues:
I am just wondering if there is a regression, as the generated specification creates more differences than expected. This issue also occurs on the main branch without my changes.
The binary was built with make release-binary
and later in the pkg/crd/testdata
the command ../../../out/controller-gen crd paths=. output:dir=.
was invoked
See result https://github.com/everesio/controller-tools/commit/fa0ae906c2fc6f89db426af0480bfe2dc5be9d66
Generated output with warnings:
➜ testdata git:(selectable-field-test) ../../../out/controller-gen crd paths=. output:dir=.
/home/michal/go/src/sigs.k8s.io/controller-tools/pkg/crd/testdata/cronjob_types.go:273:23: found float, the usage of which is highly discouraged, as support for them varies across languages. Please consider serializing your float as string instead. If you are really sure you want to use them, re-run with crd:allowDangerousTypes=true
/home/michal/go/src/sigs.k8s.io/controller-tools/pkg/crd/testdata/cronjob_types.go:273:2: must apply multipleof to a numeric value, found
/home/michal/go/src/sigs.k8s.io/controller-tools/pkg/crd/testdata/cronjob_types.go:273:2: must apply minimum to a numeric value, found
/home/michal/go/src/sigs.k8s.io/controller-tools/pkg/crd/testdata/cronjob_types.go:273:2: must apply maximum to a numeric value, found
/home/michal/go/src/sigs.k8s.io/controller-tools/pkg/crd/testdata/cronjob_types.go:278:25: found float, the usage of which is highly discouraged, as support for them varies across languages. Please consider serializing your float as string instead. If you are really sure you want to use them, re-run with crd:allowDangerousTypes=true
/home/michal/go/src/sigs.k8s.io/controller-tools/pkg/crd/testdata/cronjob_types.go:278:2: must apply minimum to a numeric value, found
/home/michal/go/src/sigs.k8s.io/controller-tools/pkg/crd/testdata/cronjob_types.go:278:2: must apply maximum to a numeric value, found
/home/michal/go/src/sigs.k8s.io/controller-tools/pkg/crd/testdata/cronjob_types.go:278:2: must apply multipleof to a numeric value, found
/home/michal/go/src/sigs.k8s.io/controller-tools/pkg/crd/testdata/cronjob_types.go:291:2: encountered struct field "unexportedField" without JSON tag in type "CronJobSpec"
/home/michal/go/src/sigs.k8s.io/controller-tools/pkg/crd/testdata/cronjob_types.go:423:2: encountered struct field "bar" without JSON tag in type "unexportedStruct"
/home/michal/go/src/sigs.k8s.io/controller-tools/pkg/crd/testdata/cronjob_types.go:431:2: encountered struct field "qux" without JSON tag in type "ExportedStruct"
Error: not all generators ran successfully
@sbueringer Sorry, I thought the remarks were directed at the other reviewers. I can address the findings. Let's clarify the issues:
No worries!
- Do you want to have some test which will the "if selectableFields == nil" check ? If similar test exists for printcolumn i can do it analogically.
I was mostly wondering when this case would happen. But it seems like it's just a safeguard against a case that should never happen in practice. I think let's leave it as is and also not try to add test coverage for it
I am just wondering if there is a regression, as the generated specification creates more differences than expected. This issue also occurs on the main branch without my changes.
Not sure I have a good answer to that. What I did in the past was to modify cronjob_types.go and then run the tests in parser_integration_test.go. The resulting output than made it clear how the YAML with the CRD has to be modified.
I would propose to do the same here to unblock this PR and then maybe open a separate issue to investigate why these testdata YAMLs differ from the ones that controller-gen would produce.
Test added. I've modified cronjob_types.go and testdata.kubebuilder.io_cronjobs.yaml
Thank you!!
/lgtm /approve
LGTM label has been added.
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: everesio, sbueringer
The full list of commands accepted by this bot can be found here.
The pull request process is described here
Add support for selectable fields for custom resources https://github.com/kubernetes-sigs/controller-tools/issues/1039