✨ Add support for k8s:enum markers#1352
✨ Add support for k8s:enum markers#1352alvaroaleman wants to merge 2 commits intokubernetes-sigs:mainfrom
Conversation
|
@alvaroaleman: GitHub didn't allow me to assign the following users: lalitc375. Note that only kubernetes-sigs members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. DetailsIn response to this:
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. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
| ValidationAtMostOneOfPrefix = validationPrefix + "AtMostOneOf" | ||
| ValidationAtLeastOneOfPrefix = validationPrefix + "AtLeastOneOf" | ||
|
|
||
| // K8sEnumTag indicates that the given type is an enum; all const values of this type are considered values in the enum |
There was a problem hiding this comment.
@lalitc375 Do you know in DV if there would be a way to gate a new value within an enum based on some combination of +k8s:ifEnabled?
| // - "Forbid": forbids concurrent runs, skipping next run if previous run hasn't finished yet; | ||
| // - "Replace": cancels currently running job and replaces it with a new one | ||
| // +optional | ||
| K8sConcurrencyPolicy K8sConcurrencyPolicy `json:"k8sConcurrencyPolicy,omitempty"` |
There was a problem hiding this comment.
Are folks likely to put the tag on a field, does the generator error in that case?
| testEnv = &envtest.Environment{} | ||
| testEnv = &envtest.Environment{ | ||
| CRDInstallOptions: envtest.CRDInstallOptions{ | ||
| Paths: []string{"testdata.kubebuilder.io_enums.yaml"}, |
There was a problem hiding this comment.
What do we do for other test suites? They must also install schemas right?
|
|
||
| // infoToSchema creates a schema for the type in the given set of type information. | ||
| func infoToSchema(ctx *schemaContext) *apiextensionsv1.JSONSchemaProps { | ||
| if ctx.info.Markers.Get(crdmarkers.K8sEnumTag) != nil { |
There was a problem hiding this comment.
This is surprisingly early in the flow of the types to schema conversion
Does this make sense here vs in somewhere like typeToSchema? What's the flow for the existing enum marker?
This change adds support for the k8s:enum marker as described in the kep.
It is a rebase of #1250 plus a test
Closes #1250
/assign @JoelSpeed @lalitc375