Add openapi-gen to client packages#7872
Add openapi-gen to client packages#7872cert-manager-prow[bot] merged 2 commits intocert-manager:masterfrom
Conversation
|
@erikgb: The label(s) 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. |
5c22ecc to
2508af6
Compare
|
/kind bug |
4a55abf to
5d46a60
Compare
fdeeb3f to
6fd8842
Compare
a6d541e to
049110a
Compare
Signed-off-by: Erik Godding Boye <egboye@gmail.com>
Signed-off-by: Erik Godding Boye <egboye@gmail.com>
There was a problem hiding this comment.
Once we deal with the violations here we should add it to gitignore and create a validation target to run openapigen and validate no new violations crop up
There was a problem hiding this comment.
Yes, we should fix most of these violations. But I didn't want to do it in the same PR.
|
Thanks for moving the package internal - I can see us dropping this in the future if we can generate the structured merge config that powers the fake client without it. |
|
/approve To allow me to continue on the fake clientsets migration. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: erikgb 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 |
Pull Request Motivation
In this "small" PR, I propose to enable openapi-gen for all our client packages. The purpose of this is to get something that knows how generate the OpenAPI YAMLs fed to applyconfiguration-gen. This will generate new fake clientsets that actually work, and unblock #7869. I have tested this PR on top of the changes here, and most tests are passing. Failures seem to be caused by SSA support in the new fake client, and test updates are needed.
In addition to fix the fake clientsets, adding openapi generation makes applyconfiguration-gen generate useful
Extractfunctions that is useful to create new apply configuration structs from the standard resource API struct.The PR consists of two commits, where the second commit isn't strictly required. But running the generated OpenAPI v2 (Swagger) through https://editor.swagger.io/, I discovered that adding a few more packages to the
openapi-geninput eliminates a lot of warnings. But it doesn't change the generated code we actually care for, so could get dropped.The solution to generate the OpenAPI YAMLs is quite hacky and was copied from kubernetes-sigs/kueue#5940. There is an upstream issue for this, but the issue seems to be stuck: kubernetes/kubernetes#126850.
Apart from adding/updating a lot of generated code and a helper command, I had to make some minor adjustments:
+k8s:openapi-gen=truemarkers to the package level in user-facing client packages. Adding them to each and every type doesn't scale IMO.imagePullSecrets. It already had JSON tags for it, and the tooling forced me to do this minor change to make the build succeed. We should review all these markers in a follow-up PR, especially for array fields. The generated openapi report added in this PR gives us a list of our current violations.Blocks #7869.
Kind
/kind cleanup
Release Note