Skip to content

chore: drop cloud-provider-gcp dependency and fork NewAltTokenSource#18274

Merged
k8s-ci-robot merged 3 commits intokubernetes:masterfrom
hakman:drop-cloud-provider-gcp
May 5, 2026
Merged

chore: drop cloud-provider-gcp dependency and fork NewAltTokenSource#18274
k8s-ci-robot merged 3 commits intokubernetes:masterfrom
hakman:drop-cloud-provider-gcp

Conversation

@hakman
Copy link
Copy Markdown
Member

@hakman hakman commented May 5, 2026

The kOps Cloud DNS provider only used k8s.io/cloud-provider-gcp for one helper: gce.NewAltTokenSource, an OAuth2 TokenSource that mints access tokens by POSTing to a configurable URL. That single function pulled in:

  • k8s.io/cloud-provider-gcp/providers/gce (the whole GCE cloud-provider)
  • github.com/GoogleCloudPlatform/k8s-cloud-provider
  • google.golang.org/api/compute/v0.alpha and compute/v0.beta (only compute/v1 is actually used by kOps)
  • assorted helpers from k8s.io/cloud-provider/volume, google.golang.org/api/{container,networkservices,tpu}, etc.

None of that machinery is used at runtime — NewAltTokenSource only needs oauth2, oauth2/google, googleapi, and client-go/util/flowcontrol, all of which kOps already depends on directly or transitively.

Following the convention from #18230 and #18272, fork NewAltTokenSource into third_party/forked/gcetokensource. The Prometheus counters and their legacyregistry registration are dropped (kOps doesn't expose component-base metrics from this path); everything else is preserved verbatim.

Impact

  • Source: dnsprovider/.../clouddns.go 4-line import/call swap
  • New forked package: ~390 lines (LICENSE + doc.go + token_source.go + tests)
  • Vendor: 84 files deleted, ~887k lines removed
  • Drops k8s.io/cloud-provider-gcp, github.com/GoogleCloudPlatform/k8s-cloud-provider, google.golang.org/api/compute/v0.alpha, google.golang.org/api/compute/v0.beta, plus various transitive helpers

Assisted by Claude Opus

/cc @rifelpet @justinsb

hakman added 2 commits May 5, 2026 08:32
clouddns is the only kops package that imports cloud-provider-gcp,
and it uses exactly one helper: gce.NewAltTokenSource. The full
module pulls in compute/v0.alpha and compute/v0.beta along with
k8s-cloud-provider, none of which kops touches.

Fork the AltTokenSource type from
k8s.io/cloud-provider-gcp/providers/gce/token_source.go at v32.4.0
into third_party/forked/gcetokensource. The Prometheus counters and
their legacyregistry registration are dropped; everything else is
preserved verbatim.

Signed-off-by: Ciprian Hacman <ciprian@hakman.dev>
clouddns is now the only kops consumer of the fork; cloud-provider-gcp
and the GoogleCloudPlatform/k8s-cloud-provider chain that came with it
fall out, and so do the unused google.golang.org/api/compute/v0.alpha
and v0.beta SDKs.

Signed-off-by: Ciprian Hacman <ciprian@hakman.dev>
@k8s-ci-robot k8s-ci-robot requested review from justinsb and rifelpet May 5, 2026 05:33
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 5, 2026
@hakman hakman changed the title Drop cloud-provider-gcp dependency and fork NewAltTokenSource chore: drop cloud-provider-gcp dependency and fork NewAltTokenSource May 5, 2026
`make gomod` propagates the dropped indirect deps from the main module
to the tests/e2e submodule.

Signed-off-by: Ciprian Hacman <ciprian@hakman.dev>
@hakman
Copy link
Copy Markdown
Member Author

hakman commented May 5, 2026

/retest

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 5, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rifelpet

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

The pull request process is described here

Details 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 May 5, 2026
@k8s-ci-robot k8s-ci-robot merged commit 0860954 into kubernetes:master May 5, 2026
28 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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants