Repository navigation
Add model name generator - #563
Conversation
052f613 to
9ea3e5e
Compare
6572856 to
d411358
Compare
|
@BenTheElder @Jefftree @thockin I've moved the codegen part of this into openapi-gen. This is a backward compatible change that enables us to switch away from go package name reflection in k8s. |
Signed-off-by: Joe Betz <jpbetz@google.com>
Signed-off-by: Joe Betz <jpbetz@google.com>
d411358 to
11cd495
Compare
| "the base Go import-path under which to generate results") | ||
| fs.StringVar(&args.OutputFile, "output-file", "generated.openapi.go", | ||
| "the name of the file to be generated") | ||
| fs.StringVar(&args.OutputModelNameFile, "output-model-name-file", "", |
There was a problem hiding this comment.
Why not output to the same file?
EDIT: Oh I see. 1 Generator -> 1 file. Probably not worth changing, but IMO outputting to a single file would be cleaner, if we run across similar things in other generators. Unless there's a reason this is better that I am missing.
There was a problem hiding this comment.
There is one file for the generated openapi definition, and there are N files for all the zz_geneated.model_name.go files, one for each package containing types that need this function added. Those files are very similar to deep copy generated files.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jpbetz, thockin 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 |
The generation needs to be adapted due to kubernetes/kube-openapi#563
The generation needs to be adapted due to kubernetes/kube-openapi#563
The generation needs to be adapted due to kubernetes/kube-openapi#563
The generation needs to be adapted due to kubernetes/kube-openapi#563
…`v0.23.1`, `sigs.k8s.io/controller-tools` to `v0.20.0` (#13982) * `make tidy && make generate` * Solve `OpenTelemetry-Operator` dependency issue The `OpenTelemetry-Operator` includes dependencies to an older version of `sigs.k8s.io/controller-runtime` which is incompatible with the version (v0.23) used in Gardener. Copying the API packages solves the dependency conflict for now. See open-telemetry/opentelemetry-operator#4667 for more information. * Adapt to incompatible changes * Adapt `OpenAPI` generation The generation needs to be adapted due to kubernetes/kube-openapi#563 * Migrate to `k8s.io/client-go/tools/events` Motivated by kubernetes-sigs/controller-runtime#3262 * Refactor: Remove obsolete `rest.Config` constructor * Add `ReconciliationTimeout` panel Add `ReconciliationTimeout` panel to the controller details dashboard. The uses the newly introduced `controller_runtime_reconcile_timeouts_total metric` metric (see kubernetes-sigs/controller-runtime#3382). * Change `NodeAgentAuthorizer` integration test Don't use the event recorder to test patch permissions. We've seen cases where the event recorder drops events if they are recorded too quickly.
This moves from a reflection based approach to OpenAPI model naming to a declarative approach.
OpenAPIModelName()receiver functions to access OpenAPI model names of API types are generated intozz_generated.model_name.gofiles. This allows API authors to declare the desired OpenAPI model packages when the model name derived from the go package path is not desirable.This PR also migrates the kubernetes API to use this generator (all OpenAPI model names remain the same).
For example:
Generates: