-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Open
Labels
sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.Categorizes an issue or PR as relevant to SIG API Machinery.triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
Description
Currently, Kubernetes CRD formats lack consistent mapping to corresponding CEL types for commonly used data types like CIDR, Quantity, and Semver, despite CEL having native support for them.
This is inconsistent with types like "date" and "duration" that have a format that is mapped to a CEL type.
For unmapped types, CRD authors must perform manual validation and casting within CEL expressions.
For mapped types, the fields are automatically validated against the format, and are typed according to the format in CEL expressions (without the need for a cast).
One way to think about this: Missing formats for CRD forces in "imperative" validation of fields, using CEL. Adding formats makes "declarative validation" of field possible.
Proposal
- Add new CRD formats: "cidr" "quantity" and "semver"
- Map these new formats to their corresponding CEL types.
- Somehow deal with cases where a format and CEL type both exist but are not mapped ("ipv4," "ipv6," and "uri.")
- Consider introducing new, distinct formats (e.g. "ip4", "ip6", "url") to represent the desired CEL IP and URL types without breaking existing CRDs.
liggitt
Metadata
Metadata
Assignees
Labels
sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.Categorizes an issue or PR as relevant to SIG API Machinery.triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
Type
Projects
Status
No status