Add +k8s:maxBytes and +k8s:minBytes OpenAPI representation#578
Add +k8s:maxBytes and +k8s:minBytes OpenAPI representation#578BasavarajBankolli wants to merge 3 commits into
Conversation
Signed-off-by: Basavaraj PB <basavarajbankolli76@gmail.com>
|
Welcome @BasavarajBankolli! |
|
/assign @aaron-prindle Will pass this onto the declarative validation folks. |
|
Thanks! Appreciate you routing this to the declarative validation folks. |
|
Sweeping open PRs, is this something we want merged @aaron-prindle @jpbetz? |
|
I'll defer to @aaron-prindle who is tracking how we map JSONSchema/OpenAPI with k8s: tags. |
|
Currently only maxBytes is implemented upstream in k/k, this PR would have to wait until minBytes is also implemented |
|
Can you also add test cases for this in |
|
Thanks for the PR here @BasavarajBankolli. Currently the PR here opts to map The initial issue here: kubernetes/kubernetes#137613 left the OpenAPI representation as an explicit open design question ("new x-kubernetes tag? CEL rule?" which has not gotten consensus as you noted here: kubernetes/kubernetes#137613 (comment)). We likely want to get consensus on this before implementation here. I've added some comments here assuming the CEL method but realistically we want to get some sig-apimachinery folks to confirm on the issue there the approach before implementing. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: BasavarajBankolli The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Thanks for the detailed feedback! Updated the PR to:
|
What this PR does
Adds support for the
+k8s:maxBytesand+k8s:minBytesvalidation markers in kube-openapi.These markers are mapped to OpenAPI
maxLengthandminLengthrespectively, allowing byte-based validation constraints to be expressed in API definitions.Implementation
MaxBytesandMinBytesfields tocommentTagsmaxLengthwithmaxBytesandminLengthwithminBytesFixes: kubernetes/kubernetes#137613