Skip to content

CORS-4524: Enable GCP custom universe domain support for CCO - #1068

Open
patrickdillon wants to merge 6 commits into
openshift:masterfrom
patrickdillon:custom-endpoints-v2
Open

CORS-4524: Enable GCP custom universe domain support for CCO#1068
patrickdillon wants to merge 6 commits into
openshift:masterfrom
patrickdillon:custom-endpoints-v2

Conversation

@patrickdillon

@patrickdillon patrickdillon commented Jul 20, 2026

Copy link
Copy Markdown

This PR adds plumbing to set universe domain on GCP clients as well as updating assumptions on service account name formatting. Doing this enables openshift operation on Google Cloud Dedicated, GCP's sovereign cloud offering.

Additionally, this PR updates the relevant packages to move off of deprecated functions that were being used for authentication.

For more details, check the relevant commit messages.

For testing, we can check GCP e2e for any regressions. For testing GCD, once all the operator PRs are open, which should happen very soon, we can use /testwith to test in the environment.

Due to the priority of this, we intend to backport this functionality to 4.22.

See openshift/enhancements#1977 for more details.

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added support for Google Cloud “universe domains” in the GCP client.
  • Bug Fixes

    • Fixed service account email formatting for domain-scoped project identifiers.
    • Improved credential handling by deriving/preserving credential types when loading JSON credentials.
  • Tests

    • Added unit tests for domain-aware service account email formatting.
    • Updated GCP client mocks and related tests to include universe domain lookups.
  • Chores

    • Updated local build to Go 1.26 and refreshed Go dependency versions.

Sets the universe domain when initializing GCP clients in order
to support running in environments with non-default universe domains
such as Google Cloud Dedicated, GCP's sovereign cloud offering.

CCO will always use JSON-based creds, either service account with
key or WIF. We must utilize the WithAuthCredentialsJSON function
because it will use self-signed JWTs rather than oauth token
exchange which fails in GCD.

The authentication falls back to WithCredentials, as ccoctl can
authenticate via the metadata server (obtaining credentials from
the service account attached to a VM).
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 20, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

@patrickdillon: This pull request references CORS-4524 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

This PR adds plumbing to set universe domain on GCP clients as well as updating assumptions on service account name formatting. Doing this enables openshift operation on Google Cloud Dedicated, GCP's sovereign cloud offering.

Additionally, this PR updates the relevant packages to move off of deprecated functions that were being used for authentication.

For more details, check the relevant commit messages.

For testing, we can check GCP e2e for any regressions. For testing GCD, once all the operator PRs are open, which should happen very soon, we can use /testwith to test in the environment.

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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Walkthrough

The change preserves credential JSON types, propagates GCP universe domains through clients, formats service-account emails for domain-scoped projects, updates related mocks and tests, and refreshes the local Go builder and dependencies.

Changes

GCP credential and domain support

Layer / File(s) Summary
Credential-aware GCP client initialization
pkg/cmd/provisioning/gcp/credentials.go, pkg/gcp/client.go, pkg/gcp/mock/client_generated.go, pkg/operator/credentialsrequest/credentialsrequest_controller_gcp_test.go
Credential loaders preserve JSON credential types; GCP clients propagate universe domains through shared authentication options; mocks and controller expectations include the new client method.
Domain-scoped service-account resource names
pkg/gcp/actuator/serviceaccount.go, pkg/gcp/actuator/serviceaccount_test.go
Service-account resource names use domain-aware formatting for colon-scoped project IDs, with table-driven coverage.
Local build and dependency refresh
Dockerfile.local, go.mod
The local builder uses Go 1.26, and existing Google, Envoy, and OpenTelemetry dependencies are upgraded.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CredentialLoader
  participant GCPClient
  participant GCPServices
  CredentialLoader->>GCPClient: parse credential type and create credentials
  GCPClient->>GCPClient: derive universe domain and assemble auth options
  GCPClient->>GCPServices: initialize services with auth options
Loading

Suggested reviewers: dlom, jstuever

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding custom GCP universe domain support for CCO.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed All added/updated test titles are static table-driven strings; no It/Describe/Context/When names use dynamic values.
Test Structure And Quality ✅ Passed The only new test is a simple isolated table-driven unit test; no cluster setup, waits, or cleanup issues, and the other touched test only updates mocks.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the new test is a plain Go unit test, so the MicroShift compatibility check is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the changed tests are plain unit tests and show no multi-node or SNO-specific assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed Changed files only update GCP auth plumbing, universe-domain handling, service-account email formatting, and tests; no deployment or scheduling/topology logic was introduced.
Ote Binary Stdout Contract ✅ Passed No stdout writes were added in init/main/suite setup paths; the only new init() just sets log level.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the touched tests are standard Go unit tests and show no IPv4 or external-network assumptions.
No-Weak-Crypto ✅ Passed No weak-crypto APIs or secret comparisons were added; the touched files only change GCP auth wiring, universe-domain handling, and service-account email formatting.
Container-Privileges ✅ Passed Only Dockerfile.local changed, and the diff contains no privileged, hostPID/Network/IPC, SYS_ADMIN, or allowPrivilegeEscalation settings in any manifest.
No-Sensitive-Data-In-Logs ✅ Passed No new logs expose secrets or PII; credential content is redacted and added test mocks don’t print sensitive values.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@openshift-ci
openshift-ci Bot requested review from dlom and jstuever July 20, 2026 14:28

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
pkg/gcp/actuator/serviceaccount.go (1)

159-165: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add coverage for domain-scoped project IDs.

Add table-driven assertions for both project and eu0:openshift, including the full IAM resource name. The supplied test change only models the conventional format.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/gcp/actuator/serviceaccount.go` around lines 159 - 165, Extend the tests
covering the service-account email/resource-name construction to use
table-driven cases for both conventional project ID “project” and domain-scoped
ID “eu0:openshift”. Assert the complete expected IAM resource name for each
case, including the reversed “openshift.eu0” email domain produced by the
project-name formatting logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Dockerfile.local`:
- Line 1: Pin the Docker builder image in the FROM declaration for the builder
stage by replacing the mutable golang:1.26 tag with its immutable registry
digest, while preserving the golang 1.26 image and the builder stage name.

---

Nitpick comments:
In `@pkg/gcp/actuator/serviceaccount.go`:
- Around line 159-165: Extend the tests covering the service-account
email/resource-name construction to use table-driven cases for both conventional
project ID “project” and domain-scoped ID “eu0:openshift”. Assert the complete
expected IAM resource name for each case, including the reversed “openshift.eu0”
email domain produced by the project-name formatting logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

Comment thread Dockerfile.local
@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 17.02128% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.21%. Comparing base (672b790) to head (a6a3575).

Files with missing lines Patch % Lines
pkg/gcp/client.go 0.00% 30 Missing ⚠️
pkg/gcp/mock/client_generated.go 37.50% 5 Missing ⚠️
pkg/cmd/provisioning/gcp/credentials.go 0.00% 4 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1068      +/-   ##
==========================================
- Coverage   47.30%   47.21%   -0.09%     
==========================================
  Files          97       97              
  Lines       12614    12650      +36     
==========================================
+ Hits         5967     5973       +6     
- Misses       5987     6017      +30     
  Partials      660      660              
Files with missing lines Coverage Δ
pkg/gcp/actuator/serviceaccount.go 84.93% <100.00%> (+0.64%) ⬆️
pkg/cmd/provisioning/gcp/credentials.go 0.00% <0.00%> (ø)
pkg/gcp/mock/client_generated.go 83.18% <37.50%> (-1.11%) ⬇️
pkg/gcp/client.go 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@patrickdillon

Copy link
Copy Markdown
Author

Added a link in the description to openshift/enhancements#1977

@patrickdillon

Copy link
Copy Markdown
Author

cc @barbacbd @rochacbruno

Comment thread pkg/gcp/client.go Outdated
Comment thread pkg/gcp/actuator/serviceaccount.go
Comment thread pkg/gcp/actuator/serviceaccount.go
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 20, 2026
@patrickdillon

Copy link
Copy Markdown
Author

ug screwed up the rebase

@openshift-ci

openshift-ci Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: patrickdillon
Once this PR has been reviewed and has the lgtm label, please assign dlom for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
Validation Failed: {"resource":"IssueComment","code":"custom","field":"body","message":"body is too long (maximum is 65536 characters)"} - https://docs.github.com/rest/issues/comments#update-an-issue-comment

In some cases, such as Google Dedicated Cloud, service accounts
take on a different format. When the project has the format
eu0:PROJECT_ID, the service account has the format:

serviceAccount:SERVICE_ACCOUNT_NAME@PROJECT_ID.eu0.iam.gserviceaccount.com

This commit adds some simnple handling for this case.
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 20, 2026
@patrickdillon

Copy link
Copy Markdown
Author

/test ?

@patrickdillon

Copy link
Copy Markdown
Author

/test e2e-gcp

@patrickdillon

Copy link
Copy Markdown
Author

/test e2e-gcp e2e-gcp-manual-oidc

Regression testing only

@patrickdillon

Copy link
Copy Markdown
Author

/testwith openshift/installer/main/e2e-gcd-ovn-private-techpreview #1068 openshift/cluster-cloud-controller-manager-operator#493 openshift/installer#10687

@patrickdillon

Copy link
Copy Markdown
Author

/testwith openshift/installer/main/e2e-gcd-ovn-private-techpreview #1068 openshift/cluster-cloud-controller-manager-operator#493 openshift/installer#10687

Oops I meant to include cloud-provider-gcp, not the CCCMO PR. Will need to retry

@patrickdillon

Copy link
Copy Markdown
Author

/testwith openshift/installer/main/e2e-gcd-ovn-private-techpreview #1068 openshift/cloud-provider-gcp#131 openshift/installer#10687

Maybe we have enough quota for two runs...

@patrickdillon

Copy link
Copy Markdown
Author

/testwith openshift/installer/main/e2e-gcd-ovn-private-techpreview #1068 openshift/cloud-provider-gcp#131 openshift/installer#10687

@patrickdillon

Copy link
Copy Markdown
Author

/testwith openshift/installer/main/e2e-gcd-ovn-private-techpreview #1068 openshift/cloud-provider-gcp#131 openshift/installer#10706

@patrickdillon

Copy link
Copy Markdown
Author

ok, the most recent multi-pr looks like it is making it into the install process. This doesn't include all PRs, so install will not succeed (I will try that again soon), but verification for this PR would look like master nodes getting scheduled and credentialsrequests getting filled

Updates from CredentialsFromJSON -> CredentialsFromJSONWithType
to avoid using the deprecated function. This change is a no-op,
only intended to avoid deprecation warnings.

The new function takes a credential type parameter, which can be
used to limit accepted credentials types, which is useful for
validating credentials provided by external third parties.
For OpenShift, cluster credentials are coming from first party users
running clusters in their project, so we do not need to limit which
credentials are accepted; therefore we just pass the type through
from the credential to the function.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Dockerfile.local`:
- Line 1: Update the builder image reference in the Dockerfile’s FROM
instruction to pin golang:1.26 using the verified sha256 digest, preserving the
existing builder stage name.

In `@go.mod`:
- Line 58: Update the google.golang.org/grpc dependency from v1.82.0 to v1.82.1
or a later patched release, then regenerate go.sum so its checksums match the
upgraded module.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

Comment thread Dockerfile.local
Comment thread go.mod Outdated
Bump google api packages so we have most up-to-date authentication
libraries.
go mod tidy && go mod vendor
Needed for new GCP packages. Makes local consistent with Dockerfile.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
Dockerfile.local (1)

1-1: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Pin the non-Red Hat builder image by digest.

golang:1.26 is mutable. Replace it with a verified digest-pinned reference while retaining the 1.26 tag.

Proposed fix
-FROM golang:1.26 AS builder
+FROM golang:1.26@sha256:<verified-digest> AS builder
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile.local` at line 1, Update the Dockerfile builder image reference in
the FROM instruction to retain the golang:1.26 tag while appending a verified
immutable image digest. Do not change the builder stage name or use an
unverified digest.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@Dockerfile.local`:
- Line 1: Update the Dockerfile builder image reference in the FROM instruction
to retain the golang:1.26 tag while appending a verified immutable image digest.
Do not change the builder stage name or use an unverified digest.

@patrickdillon

Copy link
Copy Markdown
Author

This functionality is exercised by this multi-pr /testwith run

/verified by multi-pr test

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jul 28, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@patrickdillon: This PR has been marked as verified by multi-pr test.

Details

In response to this:

This functionality is exercised by this multi-pr /testwith run

/verified by multi-pr test

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci

openshift-ci Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@patrickdillon: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-azure-manual-oidc b651e8d link true /test e2e-azure-manual-oidc
ci/prow/e2e-gcp 13a4d15 link false /test e2e-gcp
ci/prow/security a6a3575 link true /test security

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants