Skip to content
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

Kubebuilder doesn't respect +default #939

Closed
pmalek opened this issue May 3, 2024 · 1 comment · Fixed by #938
Closed

Kubebuilder doesn't respect +default #939

pmalek opened this issue May 3, 2024 · 1 comment · Fixed by #938

Comments

@pmalek
Copy link
Contributor

pmalek commented May 3, 2024

Problem statement

As per https://book.kubebuilder.io/reference/markers/crd-validation, kubebuilder respects its own +kubebuilder:default. It would be beneficial for end users to also respect +default.

Related issues/PRs

Proposed solution

  • Naive

    Add support in controller-tools:

    diff --git a/pkg/crd/markers/validation.go b/pkg/crd/markers/validation.go
    index 06d1cab6..aaae336c 100644
    --- a/pkg/crd/markers/validation.go
    +++ b/pkg/crd/markers/validation.go
    @@ -91,6 +91,8 @@ var FieldOnlyMarkers = []*definitionWithHelp{
     
        must(markers.MakeAnyTypeDefinition("kubebuilder:default", markers.DescribesField, Default{})).
      	  WithHelp(Default{}.Help()),
    +	must(markers.MakeAnyTypeDefinition("default", markers.DescribesField, Default{})).
    +		WithHelp(Default{}.Help()),
     
        must(markers.MakeAnyTypeDefinition("kubebuilder:example", markers.DescribesField, Example{})).
      	  WithHelp(Example{}.Help()),
@liggitt
Copy link
Contributor

liggitt commented May 3, 2024

Opened #938 to add this support

/transfer controller-tools

@k8s-ci-robot k8s-ci-robot transferred this issue from kubernetes-sigs/kubebuilder May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants