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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 6 additions & 56 deletions cluster-autoscaler/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ require (
github.com/jmattheis/goverter v1.4.0
github.com/jmespath/go-jmespath v0.4.0
github.com/json-iterator/go v1.1.12
github.com/onsi/ginkgo/v2 v2.21.0
github.com/onsi/gomega v1.35.1
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.22.0
github.com/spf13/pflag v1.0.6
Expand All @@ -48,20 +46,18 @@ require (
k8s.io/apiserver v0.34.0-alpha.1
k8s.io/autoscaler/cluster-autoscaler/apis v0.0.0-20240627115740-d52e4b9665d7
k8s.io/client-go v0.34.0-alpha.1
k8s.io/cloud-provider v0.30.1
k8s.io/cloud-provider v0.34.0-alpha.1
k8s.io/cloud-provider-aws v1.27.0
k8s.io/cloud-provider-gcp/providers v0.28.2
k8s.io/code-generator v0.34.0-alpha.1
k8s.io/component-base v0.34.0-alpha.1
k8s.io/component-helpers v0.34.0-alpha.1
k8s.io/dynamic-resource-allocation v0.0.0
k8s.io/dynamic-resource-allocation v0.34.0-alpha.1
k8s.io/klog/v2 v2.130.1
k8s.io/kubelet v0.34.0-alpha.1
k8s.io/kubernetes v1.34.0-alpha.1
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
sigs.k8s.io/cloud-provider-azure v1.29.4
sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.0.13
sigs.k8s.io/structured-merge-diff/v4 v4.7.0
sigs.k8s.io/yaml v1.4.0
)

Expand Down Expand Up @@ -158,6 +154,8 @@ require (
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/onsi/ginkgo/v2 v2.21.0 // indirect
github.com/onsi/gomega v1.35.1 // indirect
github.com/opencontainers/cgroups v0.0.1 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
Expand Down Expand Up @@ -205,6 +203,7 @@ require (
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.0.0 // indirect
k8s.io/code-generator v0.34.0-alpha.1 // indirect
k8s.io/controller-manager v0.34.0-alpha.1 // indirect
k8s.io/cri-api v0.34.0-alpha.1 // indirect
k8s.io/cri-client v0.0.0 // indirect
Expand All @@ -219,74 +218,25 @@ require (
sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.0.4 // indirect
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.7.0 // indirect
)

replace github.com/aws/aws-sdk-go/service/eks => github.com/aws/aws-sdk-go/service/eks v1.38.49

replace github.com/digitalocean/godo => github.com/digitalocean/godo v1.27.0

replace github.com/rancher/go-rancher => github.com/rancher/go-rancher v0.1.0

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

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.


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

replace k8s.io/cli-runtime => k8s.io/cli-runtime v0.34.0-alpha.1

replace k8s.io/client-go => k8s.io/client-go v0.34.0-alpha.1

replace k8s.io/cloud-provider => k8s.io/cloud-provider v0.34.0-alpha.1

replace k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.34.0-alpha.1

replace k8s.io/code-generator => k8s.io/code-generator v0.34.0-alpha.1

replace k8s.io/component-base => k8s.io/component-base v0.34.0-alpha.1

replace k8s.io/component-helpers => k8s.io/component-helpers v0.34.0-alpha.1

replace k8s.io/controller-manager => k8s.io/controller-manager v0.34.0-alpha.1

replace k8s.io/cri-api => k8s.io/cri-api v0.34.0-alpha.2

replace k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.34.0-alpha.1

replace k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.34.0-alpha.1

replace k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.34.0-alpha.1

replace k8s.io/kube-proxy => k8s.io/kube-proxy v0.34.0-alpha.1

replace k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.34.0-alpha.1

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

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

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

replace k8s.io/mount-utils => k8s.io/mount-utils v0.34.0-alpha.2

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

replace k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.34.0-alpha.1

replace k8s.io/sample-controller => k8s.io/sample-controller v0.34.0-alpha.1

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

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

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

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

replace k8s.io/autoscaler/cluster-autoscaler/apis => ./apis

replace k8s.io/cri-client => k8s.io/cri-client v0.34.0-alpha.1

replace k8s.io/externaljwt => k8s.io/externaljwt v0.34.0-alpha.2
Loading