kubernetes-sigs / controller-tools

Tools to use with the controller-runtime libraries
Apache License 2.0
721 stars 416 forks source link

Support +enum tags in k8s APIs #933

Open tenzen-y opened 5 months ago

tenzen-y commented 5 months ago

What do you want to happen?

Kubernetes APIs include an enum tag such as this one:

https://github.com/kubernetes/kubernetes/blob/be4b7176dc131ea842cab6882cd4a06dbfeed12a/staging/src/k8s.io/api/core/v1/types.go#L3506-L3507

which translates to the following OpenAPIv3:

          "effect": {
            "description": "Required. The effect of the taint on pods that do not tolerate the taint. Valid effects are NoSchedule, PreferNoSc>
            "type": "string",
            "default": "",
            "enum": [
              "NoExecute",
              "NoSchedule",
              "PreferNoSchedule"
            ]

However, kubebuilder doesn't recognize them when using these types in another project.

Example in Kueue, for the code in https://github.com/kubernetes-sigs/kueue/blob/34bfbe0f359b8439b737f07c3f3e5da92c7d0d67/apis/kueue/v1beta1/resourceflavor_types.go#L68 The rendered CRD lacks the enum information: https://github.com/kubernetes-sigs/kueue/blob/34bfbe0f359b8439b737f07c3f3e5da92c7d0d67/config/components/crd/bases/kueue.x-k8s.io_resourceflavors.yaml#L87-L89

Extra Labels

No response

Originally posted by @alculquicondor in https://github.com/kubernetes-sigs/kubebuilder/issues/3861

k8s-triage-robot commented 2 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

tenzen-y commented 2 months ago

/remove-lifecycle stale

sbueringer commented 2 months ago

Sounds good to me! (we also already support e.g. +default)