Modernize code generation #3000
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This "modernizes" code generation setup to make it simpler to run and have less implicit dependencies. It does so in the following way:
tools.gohack)make toolsdirective as it will be implicitly working just when running go.hack/update-codegen.shto not depend on a bash-script from the code-gen toolchain, instead run with the pure go implementing such that the tooling can be fully managed ingo.modk8s.io/code-generatorfromv0.25.9tov0.32.9(This is the same version used for other k8s libraries, and required for the modernization to work).k8s.io/code-generatorversion update.returnin error cases when updating status incluster.goandsync.go. This is needed because the newer version of the generated code doesn't returnnilfor the object on error, soif pgUpdatedStatus != nilchecks are no longer valid to detect if it was not set. The right thing is to do this check as part of the error checking which is done byreturningthere.go mod vendorwhich is not needed with the use ofgo tool.make depstarget as it's not needed to be explicitly called.