Skip to content

(CA) leaner go.mod configuration #8238

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jackfrancis
Copy link
Contributor

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

This PR optimizes the go.mod configuration for Cluster Autoscaler, specifically to remove a bunch of unnecessary replace directives. Some of the deletions are directives for packages that aren't actually present in the dependency graph, some are unnecessary because they match the exact version already declared in the require set.

These changes produce no changes in the resultant go.sum outcome.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 11, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jackfrancis

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 11, 2025
@jackfrancis
Copy link
Contributor Author

/assign @BigDarkClown

@jackfrancis
Copy link
Contributor Author

/test pull-cluster-autoscaler-e2e-azure-master

@jackfrancis
Copy link
Contributor Author

/assign @towca @gjtempleton @x13n

replace k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.34.0-alpha.0

replace k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.34.0-alpha.0

replace k8s.io/kms => k8s.io/kms v0.34.0-alpha.0
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this one also a no-op?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, thanks!

@x13n
Copy link
Member

x13n commented Jul 4, 2025

Thanks for cleaning this up! Judging from file contents I think one more line might be dropped, so adding a hold. LGTM otherwise.

/lgtm
/hold

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. 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. labels Jul 4, 2025
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot k8s-ci-robot removed 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. labels Jul 26, 2025
@jackfrancis
Copy link
Contributor Author

@x13n this is ready for another review round, thank you!

replace k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.34.0-alpha.1

replace k8s.io/apimachinery => k8s.io/apimachinery v0.34.0-alpha.1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, I'm pretty sure the replaces for k/k staging modules were here intentionally, to cover a corner case where CA starts depending on a new k/k staging module.

More specifically, this is my understanding:

  1. We want to keep CA's k/k dependencies (k8s.io/kuberentes + the k/k staging modules) in sync, all pinned to one kubernetes version.
  2. The replaces guarantee that we always use the pinned kubernetes version. Requirements just specify the minimum version, and a higher one could be picked when building. So we need both a require and a replace for every k/k dependency.
  3. All of the k/k dependencies are updated via a script which adds both a require and a replace for them.
  4. What happens if we add a new k/k dependency to CA? We need to either remember/mandate adding the replace as well, or remember/mandate running the dependency-upgrading script which adds the replace. But we can avoid the remembering/mandating if we add replaces for all possible k/k dependencies when running the script.

What was the criteria by which you removed the k/k replaces? Maybe points 1. or 2. are not actually true/no longer apply?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Main criteria is making the go.mod easier to reason about (arguably the replaces aren't that much overhead), and setting it up for automated dependabot maintenance going forward.

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/cluster-autoscaler cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants