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

Fix VPA code generation #6834

Merged
merged 6 commits into from
Jul 19, 2024
Merged

Conversation

voelzmo
Copy link
Contributor

@voelzmo voelzmo commented May 15, 2024

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Seems like code generation wasn't working for a while, as the dependency for hack/update-codegen.sh wasn't vendored. This script wasn't executed in a while, although there were changes in the API recently. So in this PR, we switch to using kube-codegen instead of the deprecated generate-groups and make sure the dependency k8s.io/code-generator is actually installed.

This PR proceeds step-wise, separated into individual commits, so it is more convenient to review:

  • introduce a new file hack/tools.go to pull in k8s.io/code-generator and have it correctly versioned in go.mod
  • changing the commandline for generate-groups.sh from all to client,deepcopy,informer,lister. This excludes applyconfiguration, which we currently don't generate, but would be included in all
  • actually run hack/update-codegen.sh to generate the deepcopy files and client-related files with the most recent API changes
  • switch to kube-codegen.sh, as generate-groups.sh was showing a deprecation warning
  • run hack/update-codegen.sh again, to see that there are no notable diffs after switching the generation script – the only changes seem to be concerned with the order of certain functions/variables

Special notes for your reviewer:

  • should we consider dropping versions other than v1, especially v1alpha1 and v1beta1, maybe even v1beta2? All those versions don't work with the newer k8s releases and the recent VPA releases don't work with older k8s releases.
  • should we consider generating applyconfigurations, as discussed in Make enum fields on the VPA API not pointers #5503?
  • Considering we already released 1.1 without re-generating these code parts
    • how problematic is this? Do we need to cherry-pick this into 1.1 and cut a new release?
    • should we consider making hack/verify-codegen.sh a presubmit check?

Does this PR introduce a user-facing change?

Re-generated deepcopy and client files to include the recent API changes.

@k8s-ci-robot k8s-ci-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label May 15, 2024
@k8s-ci-robot k8s-ci-robot added area/vertical-pod-autoscaler cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 15, 2024
Copy link
Contributor

@nikimanoledaki nikimanoledaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Left a couple comments 👍

vertical-pod-autoscaler/go.mod Outdated Show resolved Hide resolved
vertical-pod-autoscaler/hack/tools.go Outdated Show resolved Hide resolved
@voelzmo voelzmo force-pushed the fix/vpa-codegen branch 2 times, most recently from 1fa1df9 to c3470b5 Compare May 17, 2024 08:12
Copy link
Contributor

@nikimanoledaki nikimanoledaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@voelzmo
Copy link
Contributor Author

voelzmo commented May 27, 2024

rebased on recent master to re-trigger github action tests – somehow they were red although I didn't change anything related to the test?

@voelzmo
Copy link
Contributor Author

voelzmo commented May 27, 2024

rebased on recent master to re-trigger github action tests – somehow they were red although I didn't change anything related to the test?

Turned out I was wrong: the boilerplate was missing for tools.go. There were just so many Error: lines in the test output that were unrelated to my change that I didn't see the very first line that actually was helpful 🙈

@voelzmo
Copy link
Contributor Author

voelzmo commented Jun 3, 2024

/assign kwiesmueller

@kwiesmueller
Copy link
Member

/assign @raywainman
Ray do you want to take a look first?

@raywainman
Copy link
Contributor

/lgtm

Should we tweak the PR description to fix the following:

changing the commandline for generate-groups.sh from all to client,deepcopy,informer,lister. This excludes applyconfiguration, which we currently don't generate, but would be included in all

Looks like kube_codegen.sh takes care of a bunch of this for us, minus applyconfiguration which needs to be passed as a flag to the client generation?


Some of my thoughts on the open questions:

  1. +1 to dropping versions if we no longer support them.
  2. Makes sense - maybe we do this in a separate PR? Looks like it should be easy thanks to this change :)
  3. Are there any functional reasons we would want to do that (my understanding is this wouldn't generate any behavioral changes)? Do we know if anyone has asked for this?

Thanks @voelzmo!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 3, 2024
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 26, 2024
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 19, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nikimanoledaki, voelzmo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 19, 2024
@voelzmo
Copy link
Contributor Author

voelzmo commented Jul 19, 2024

@raywainman I've rebase the PR and adapted the description a bit. Thanks for the review!

I'll open follow-up PRs to remove the no longer supported API versions and for generating applyconfiguration

@raywainman
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 19, 2024
@k8s-ci-robot k8s-ci-robot merged commit 8dbe8ac into kubernetes:master Jul 19, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/vertical-pod-autoscaler cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants