Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenAPI Gen should fail for invalid x-kubernetes-map-type/keys/etc combinations #343

Open
apelisse opened this issue Dec 20, 2022 · 7 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. wg/api-expression Categorizes an issue or PR as relevant to WG API Expression.

Comments

@apelisse
Copy link
Member

See kubernetes/kubernetes#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.

@apelisse
Copy link
Member Author

/wg api-expression
/priority important-soon

@k8s-ci-robot k8s-ci-robot added wg/api-expression Categorizes an issue or PR as relevant to WG API Expression. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Dec 20, 2022
@liggitt
Copy link
Member

liggitt commented Dec 20, 2022

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)?

@ibilalkayy
Copy link

Hey @apelisse, I didn't understand what this issue this. Can you please guide me?

@apelisse
Copy link
Member Author

apelisse commented Feb 4, 2023

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.

@ibilalkayy
Copy link

ibilalkayy commented Feb 6, 2023

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.

@k8s-triage-robot
Copy link

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 7, 2023
@k8s-triage-robot
Copy link

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. wg/api-expression Categorizes an issue or PR as relevant to WG API Expression.
Projects
Status: Backlog Authoring Controllers SSA
Development

No branches or pull requests

5 participants