OpenAPI Gen should fail for invalid x-kubernetes-map-type/keys/etc combinations
See https://github.com/kubernetes/kubernetes/pull/114585,
We've been able to generate a bogus OpenAPI with x-kubernetes-list-type=set for a list of non-atomic maps. And we haven't been able to detect that until after the type was released and people were trying to re-import that type and create CRDs for it. We should detect these errors as early as possible, ideally while generating the OpenAPI for these types.
/wg api-expression /priority important-soon
until we have automated scanning, have we checked manually that there are no other in-tree examples of this issue (in less popular types than podspec maybe no one tried to embed into a CRD)?
Hey @apelisse, I didn't understand what this issue this. Can you please guide me?
The behavior of the annotations, like x-kubernetes-list-type=set is described in the server-side apply documentation. You'll find there that the "set" type is meant to only work for primitive types. Unfortunately, the code that parses this in go files and generate the actual openapi does NOT verify that the types are indeed primitives (code mostly lives in https://github.com/kubernetes/kube-openapi/blob/master/pkg/generators/extension.go and https://github.com/kubernetes/kube-openapi/blob/master/pkg/generators/openapi.go). It'd be nice if we could notice that the annotation is mis-used and fail rather than ignore the mis-use.
Hey @apelisse, Sorry for the late response. The x-kubernetes-list-type=set was not present on this page. But only the x-kubernetes-list-type were present. One is present in line #55, one is present in line #78 and the last one is present in line #183. The second page does not contain x-kubernetes-list-type.
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle stale - Close this issue with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle rotten - Close this issue with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten