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

    • Corrected service account email formatting for domain-scoped project identifiers.
    • Improved credential handling by deriving and preserving credential type from JSON inputs.
  • Tests

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

    • Updated local build to use 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 construction
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 store and propagate universe domains; 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 shared 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 and store universe domain
  GCPClient->>GCPServices: initialize services with auth options and universe domain
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 0.00% 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 accurately summarizes the main change: adding GCP custom 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 Changed test titles are static string literals; no runtime-derived or unstable names were found in the modified tests.
Test Structure And Quality ✅ Passed The changed tests are plain table-driven unit tests, not Ginkgo specs; they have one responsibility, no cluster waits/resources, and match existing repo assertion style.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the touched tests are plain testing.T unit tests and contain no MicroShift-unsupported APIs or skips to evaluate.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the touched tests are standard unit tests and contain no multi-node/SNO assumptions or missing SNO guards.
Topology-Aware Scheduling Compatibility ✅ Passed Touched files are GCP auth/service-account plumbing and tests; no manifests, node selectors, anti-affinity, PDBs, or topology-aware scheduling logic were added.
Ote Binary Stdout Contract ✅ Passed No stdout writes were added in any process-level code; searches of touched files found none, and the only init() just sets logrus level.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the touched test files are unit tests and contain no IPv4 or external-network assumptions.
No-Weak-Crypto ✅ Passed Touched files only add GCP auth plumbing and tests; no MD5/SHA1/DES/RC4/ECB, custom crypto, or secret comparisons appear in the changed code.
Container-Privileges ✅ Passed Only Dockerfile.local changed; no privileged, hostPID/Network/IPC, SYS_ADMIN, or allowPrivilegeEscalation settings appear in the patch.
No-Sensitive-Data-In-Logs ✅ Passed Only new logs are loader source/local path; JSON content is redacted and no secrets, PII, tokens, or hostnames are logged.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
Dockerfile.local

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'

go.mod

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


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 (5def0d7).

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.
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.

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
@@ -1,4 +1,4 @@
FROM golang:1.21 AS builder
FROM golang:1.26 AS builder

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major

Pin the non-Red Hat builder image by digest.

golang:1.26 is mutable, so local builds can consume unreviewed image contents over time. Replace it with golang:1.26@sha256:<verified-digest>. This repeats the previously withdrawn finding, but the current path instruction explicitly requires digest pinning.

🧰 Tools
🪛 Trivy (0.72.0)

[error] 1-1: Image user should not be 'root'

Specify at least 1 USER command in Dockerfile with non-root user as argument

Rule: DS-0002

Learn more

(IaC/Dockerfile)

🤖 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 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.

Source: Path instructions

Comment thread go.mod
golang.org/x/time v0.15.0
google.golang.org/api v0.288.0
google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7
google.golang.org/grpc v1.82.0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
osv-scanner scan source -r .

Repository: openshift/cloud-credential-operator

Length of output: 2760


🌐 Web query:

GHSA-hrxh-6v49-42gf google.golang.org/grpc v1.82.0 OSV

💡 Result:

GHSA-hrxh-6v49-42gf is a high-severity security advisory affecting the google.golang.org/grpc library [1][2]. It covers multiple vulnerabilities identified in the gRPC-Go implementation, specifically within the xDS RBAC authorization engine and the HTTP/2 transport server [2]. The vulnerabilities addressed are: 1. xDS RBAC Authorization Bypass (Fail-Open): Occurs when translating xDS RBAC policies containing Metadata or RequestedServerName fields [2]. 2. HTTP/2 Rapid Reset Denial of Service (DoS) Bypass: Involves a bypass of existing HTTP/2 Rapid Reset mitigations during client-initiated stream resets, leading to high CPU consumption [2]. 3. xDS RBAC Engine Server Panic: A DoS vulnerability triggered when parsing crafted xDS RBAC policies that include NOT rules around unsupported fields [2]. All affected versions of google.golang.org/grpc prior to 1.82.1 are vulnerable [3][1]. The issue is resolved in version 1.82.1, and users are advised to upgrade to this version or later to mitigate these risks [2][4].

Citations:


Upgrade google.golang.org/grpc to 1.82.1 or later. v1.82.0 is affected by GHSA-hrxh-6v49-42gf; bump to a patched release and update go.sum.

🧰 Tools
🪛 OSV Scanner (2.4.0)

[HIGH] 58-58: google.golang.org/grpc 1.82.0: gRPC-Go: xDS RBAC and HTTP/2 Vulnerabilities

(GHSA-hrxh-6v49-42gf)

🤖 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 `@go.mod` at 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.

Sources: Path instructions, Linters/SAST tools

@openshift-ci

openshift-ci Bot commented Jul 23, 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 5def0d7 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants