Skip to content

OCPBUGS-81312: fix(cpo): use KubeAPIServerDNSName for OAuth LoginURL when set - #8433

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
amasolov:fix/oauth-token-display-fqdn
Jun 26, 2026
Merged

OCPBUGS-81312: fix(cpo): use KubeAPIServerDNSName for OAuth LoginURL when set#8433
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
amasolov:fix/oauth-token-display-fqdn

Conversation

@amasolov

@amasolov amasolov commented May 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • When spec.kubeAPIServerDNSName is set, the OAuth token display page now shows the custom FQDN in oc login --server= instead of the LoadBalancer IP address
  • The IBMCloud login URL override annotation retains highest priority
  • Adds unit tests for adaptOAuthConfig covering all LoginURL derivation paths

Fixes: https://issues.redhat.com/browse/OCPBUGS-81312

Details

The OAuth server config's LoginURL determines the --server= value shown on the token display page (the "Copy login command" page in the console). Previously, LoginURL always used ControlPlaneEndpoint.Host, which is derived from the infrastructure LoadBalancer status and resolves to an IP when the LB ingress only has an IP address (common with MetalLB and on-premises environments).

When a user configures spec.kubeAPIServerDNSName to set a custom FQDN for accessing the API server, this FQDN was correctly used for the custom kubeconfig but was not reflected in the OAuth token display page. Users would see oc login --server=https://10.x.x.x:6443 instead of oc login --server=https://api.custom.example.com:6443.

This change makes adaptOAuthConfig prefer KubeAPIServerDNSName for the LoginURL host when set, while preserving the existing IBMCloud login URL override annotation (oauth.hypershift.openshift.io/login-url-override) as the highest-priority override.

Test plan

  • Unit tests pass (go test ./control-plane-operator/controllers/hostedcontrolplane/v2/oauth/... -v)
  • Verify on a HCP cluster with KubeAPIServerDNSName set that the token display page shows the FQDN
  • Verify behaviour is unchanged when KubeAPIServerDNSName is not set
  • Verify IBMCloud login URL override annotation still takes precedence

Made with Cursor

Summary by CodeRabbit

  • New Features

    • OAuth login URL generation now uses the control-plane host and port, respects a customized control‑plane DNS name and explicit login‑URL overrides, and correctly handles IPv4 and IPv6 formats.
  • Tests

    • Added comprehensive tests validating OAuth URL generation across DNS overrides, annotation precedence, IP endpoints, and IPv6 formatting.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@coderabbitai

coderabbitai Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: e1c1b01c-4e21-4bb4-b9f4-39a72d01f113

📥 Commits

Reviewing files that changed from the base of the PR and between bded456 and 4a0d650.

📒 Files selected for processing (2)
  • control-plane-operator/controllers/hostedcontrolplane/v2/oauth/config.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/oauth/config_test.go

📝 Walkthrough

Walkthrough

adaptOAuthConfig now computes the OAuth LoginURL host from HCP.Status.ControlPlaneEndpoint.Host and, if set, overrides that host with HCP.Spec.KubeAPIServerDNSName; the LoginURL uses that host with the control plane endpoint port. MasterURL and MasterPublicURL continue to be built from the control plane endpoint host/port. A new table-driven test, TestAdaptOAuthConfig, validates LoginURL, MasterURL, and MasterPublicURL across scenarios including default DNS, KubeAPIServerDNSName override, control plane endpoint IPs, precedence of the OauthLoginURL override annotation, and IPv6 bracketing.

🚥 Pre-merge checks | ✅ 10 | ❌ 2

❌ Failed checks (2 warnings)

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.
Test Structure And Quality ⚠️ Warning Test missing assertion messages. Codebase pattern shows assertions should include meaningful failure messages (e.g., "APIHost mismatch"). Current test has bare assertions without context messages. Add failure messages to assertions (lines 120-122). Example: g.Expect(cfg.OAuthConfig.LoginURL).To(Equal(tc.expectedLoginURL), "unexpected LoginURL"). Also consider adding t.Parallel() for consistency with similar tests in repo.
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: using KubeAPIServerDNSName for OAuth LoginURL when set, which is the primary objective of this fix.
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 Test names are stable and deterministic. Uses standard Go testing, not Ginkgo. All test names are hardcoded static strings with no dynamic content.
Microshift Test Compatibility ✅ Passed No Ginkgo e2e tests were added. The added test (config_test.go) is a standard Go unit test using testing.T and Gomega, not Ginkgo e2e tests. This check applies only to Ginkgo e2e tests.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The PR adds a standard Go unit test, not a Ginkgo e2e test. The custom check applies only to Ginkgo tests with It(), Describe(), Context(), When() patterns.
Topology-Aware Scheduling Compatibility ✅ Passed This PR modifies only OAuth server configuration logic (URLs), not deployment manifests or scheduling constraints. No topology-unaware scheduling constraints are introduced.
Ote Binary Stdout Contract ✅ Passed No OTE Binary Stdout Contract violations found. The PR modifies oauth config functions and adds a standard Go unit test. No stdout writes in process-level code, logging config, or initializers.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Added test is a standard Go unit test (testing.T), not a Ginkgo e2e test. Custom check applies only to Ginkgo e2e tests. Not applicable here.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci
openshift-ci Bot requested review from clebs and sdminonne May 6, 2026 01:48
@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 6, 2026
@openshift-ci

openshift-ci Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

Hi @amasolov. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@openshift-ci openshift-ci Bot added area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release and removed do-not-merge/needs-area labels May 6, 2026
@bshirren

bshirren commented May 6, 2026

Copy link
Copy Markdown

/ok-to-test

@openshift-ci openshift-ci Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 6, 2026
@codecov

codecov Bot commented May 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 41.87%. Comparing base (c35f662) to head (7404745).
⚠️ Report is 136 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8433      +/-   ##
==========================================
+ Coverage   41.84%   41.87%   +0.03%     
==========================================
  Files         759      759              
  Lines       94073    94085      +12     
==========================================
+ Hits        39361    39400      +39     
+ Misses      51956    51926      -30     
- Partials     2756     2759       +3     
Files with missing lines Coverage Δ
.../controllers/hostedcontrolplane/v2/oauth/config.go 46.42% <100.00%> (+46.42%) ⬆️
Flag Coverage Δ
cmd-support 35.13% <ø> (ø)
cpo-hostedcontrolplane 44.31% <100.00%> (+0.20%) ⬆️
cpo-other 43.45% <ø> (ø)
hypershift-operator 52.02% <ø> (ø)
other 31.56% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@amasolov
amasolov force-pushed the fix/oauth-token-display-fqdn branch from 833ab6a to ea9ccf9 Compare May 6, 2026 02:51
@bshirren

bshirren commented May 6, 2026

Copy link
Copy Markdown

/ok-to-test

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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)
control-plane-operator/controllers/hostedcontrolplane/v2/oauth/config_test.go (1)

27-66: ⚡ Quick win

Add an IPv6 endpoint scenario to lock in LoginURL formatting behavior.

Please include a case with cpEndpointHost (or kasDNSName) as IPv6 and expected bracketed URL (e.g. https://[2001:db8::1]:6443) to prevent regressions.

🤖 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
`@control-plane-operator/controllers/hostedcontrolplane/v2/oauth/config_test.go`
around lines 27 - 66, Add a new test case to the existing table in
config_test.go that uses an IPv6 address for cpEndpointHost (or kasDNSName) to
ensure LoginURL is formatted with brackets; for example set cpEndpointHost to
"2001:db8::1", cpEndpointPort to 6443, and expectedLoginURL to
"https://[2001:db8::1]:6443" while keeping expectedMasterURL appropriate (e.g.
"https://oauth.example.com:443"); ensure the test case also covers interactions
with loginURLOverride and KubeAPIServerDNSName precedence if relevant so the
code paths in the functions that produce LoginURL (the logic under test in this
file) handle IPv6 bracketed host formatting.
🤖 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 `@control-plane-operator/controllers/hostedcontrolplane/v2/oauth/config.go`:
- Around line 76-80: The MasterURL and cfg.OAuthConfig.LoginURL are being
formatted with fmt.Sprintf("https://%s:%d", ...) which breaks IPv6 literals;
change both constructions to build the host:port with net.JoinHostPort and
construct the full URL via url.URL (e.g., set Scheme to "https", Host to
net.JoinHostPort(loginHost, strconv.Itoa(controlPlaneEndpoint.Port)) and use
url.String()) so IPv6 addresses are correctly wrapped in brackets; update the
places that set masterUrl and cfg.OAuthConfig.LoginURL accordingly (referencing
the masterUrl assignment and cfg.OAuthConfig.LoginURL).

---

Nitpick comments:
In
`@control-plane-operator/controllers/hostedcontrolplane/v2/oauth/config_test.go`:
- Around line 27-66: Add a new test case to the existing table in config_test.go
that uses an IPv6 address for cpEndpointHost (or kasDNSName) to ensure LoginURL
is formatted with brackets; for example set cpEndpointHost to "2001:db8::1",
cpEndpointPort to 6443, and expectedLoginURL to "https://[2001:db8::1]:6443"
while keeping expectedMasterURL appropriate (e.g.
"https://oauth.example.com:443"); ensure the test case also covers interactions
with loginURLOverride and KubeAPIServerDNSName precedence if relevant so the
code paths in the functions that produce LoginURL (the logic under test in this
file) handle IPv6 bracketed host formatting.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 5d6ff01a-7e2b-40bf-a6b7-c147857082c5

📥 Commits

Reviewing files that changed from the base of the PR and between 833ab6a and ea9ccf9.

📒 Files selected for processing (2)
  • control-plane-operator/controllers/hostedcontrolplane/v2/oauth/config.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/oauth/config_test.go

Comment thread control-plane-operator/controllers/hostedcontrolplane/v2/oauth/config.go Outdated
@vsolanki12

Copy link
Copy Markdown
Contributor

/retitle OCPBUGS-81312: fix(cpo): use KubeAPIServerDNSName for OAuth LoginURL when set

@openshift-ci openshift-ci Bot changed the title fix(cpo): use KubeAPIServerDNSName for OAuth LoginURL when set OCPBUGS-81312: fix(cpo): use KubeAPIServerDNSName for OAuth LoginURL when set May 7, 2026
@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels May 7, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@amasolov: This pull request references Jira Issue OCPBUGS-81312, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Summary

  • When spec.kubeAPIServerDNSName is set, the OAuth token display page now shows the custom FQDN in oc login --server= instead of the LoadBalancer IP address
  • The IBMCloud login URL override annotation retains highest priority
  • Adds unit tests for adaptOAuthConfig covering all LoginURL derivation paths

Fixes: https://issues.redhat.com/browse/OCPBUGS-81312

Details

The OAuth server config's LoginURL determines the --server= value shown on the token display page (the "Copy login command" page in the console). Previously, LoginURL always used ControlPlaneEndpoint.Host, which is derived from the infrastructure LoadBalancer status and resolves to an IP when the LB ingress only has an IP address (common with MetalLB and on-premises environments).

When a user configures spec.kubeAPIServerDNSName to set a custom FQDN for accessing the API server, this FQDN was correctly used for the custom kubeconfig but was not reflected in the OAuth token display page. Users would see oc login --server=https://10.x.x.x:6443 instead of oc login --server=https://api.custom.example.com:6443.

This change makes adaptOAuthConfig prefer KubeAPIServerDNSName for the LoginURL host when set, while preserving the existing IBMCloud login URL override annotation (oauth.hypershift.openshift.io/login-url-override) as the highest-priority override.

Test plan

  • Unit tests pass (go test ./control-plane-operator/controllers/hostedcontrolplane/v2/oauth/... -v)
  • Verify on a HCP cluster with KubeAPIServerDNSName set that the token display page shows the FQDN
  • Verify behaviour is unchanged when KubeAPIServerDNSName is not set
  • Verify IBMCloud login URL override annotation still takes precedence

Made with Cursor

Summary by CodeRabbit

  • New Features

  • OAuth login URL generation now respects a customized control-plane DNS name (including overrides) and constructs the login endpoint using the control-plane host and port; works with both DNS names and IP endpoints and honors login URL override annotations.

  • Tests

  • Added comprehensive tests validating OAuth URL generation across override, DNS, IP, and annotation-precedence scenarios.

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.

@vsolanki12

Copy link
Copy Markdown
Contributor

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels May 7, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@vsolanki12: This pull request references Jira Issue OCPBUGS-81312, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh

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.

@clebs

clebs commented May 8, 2026

Copy link
Copy Markdown
Member

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 8, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-azure-self-managed
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws

@cwbotbot

cwbotbot commented May 8, 2026

Copy link
Copy Markdown

Test Results

e2e-aks

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-azure-v2-self-managed
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws
/test e2e-v2-gke

@amasolov

Copy link
Copy Markdown
Contributor Author

/retest-required

@amasolov

Copy link
Copy Markdown
Contributor Author

@vsolanki12 can i get a /lgtm on this one if everything looks good to you? thanks

@vsolanki12

Copy link
Copy Markdown
Contributor

@amasolov , I can't give lgtm from my end. Also, lgtm label is already attached this PR. It needs approve label and the CI jobs needs to be completed. I can see 3 CI jobs are failing. We have to retest to run these jobs as well. Once we have approval we can move this one for verified label. But I would like to know if you have tested the fix or not?

When KubeAPIServerDNSName is configured on a HostedControlPlane, the
OAuth token display page shows the ControlPlaneEndpoint host (typically
a LoadBalancer IP) in the oc login command instead of the custom FQDN.

The LoginURL in the OAuth server config determines what users see as
the --server value on the token display page. Previously it always used
ControlPlaneEndpoint.Host, which does not reflect a custom DNS name
set via spec.kubeAPIServerDNSName.

This change makes the OAuth config prefer KubeAPIServerDNSName for the
LoginURL when set, while preserving the existing IBMCloud login URL
override annotation as the highest-priority override.

Additionally, URL construction now uses net.JoinHostPort with url.URL
instead of fmt.Sprintf to correctly handle IPv6 literal addresses
(wrapping them in brackets as required by RFC 3986).

Signed-off-by: Alexey Masolov <amasolov@redhat.com>
Assisted-by: Claude (via Cursor)
Co-authored-by: Cursor <cursoragent@cursor.com>
@amasolov
amasolov force-pushed the fix/oauth-token-display-fqdn branch from 4a0d650 to 7404745 Compare June 17, 2026 23:50
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Jun 17, 2026
@bshirren

Copy link
Copy Markdown

/ok-to-test

@amasolov

Copy link
Copy Markdown
Contributor Author

Thanks @vsolanki12 . This was tested on a real cluster.

Test environment:

  • Management cluster: OCP 4.20
  • Hosted cluster: none platform, spec.kubeAPIServerDNSName: api.custom-test.example.com
  • ControlPlaneEndpoint resolved to 10.0.101.177:30688 (an IP, as expected)

Result (from the OAuth configmap generated by the CPO):

oauthConfig:
  loginURL: https://api.custom-test.example.com:30688
  masterPublicURL: https://10.0.101.177:31792
  masterURL: https://10.0.101.177:31792

loginURL correctly uses the custom DNS name instead of the ControlPlaneEndpoint IP. Without this fix, it would have been https://10.0.101.177:30688.

masterURL and masterPublicURL correctly continue to use the OAuthHost (infrastructure endpoint), which is expected.

I've also rebased on current main. @clebs could I get a /lgtm again? The force-push removed the previous label.

@muraee

muraee commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

/approve

@openshift-ci

openshift-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: amasolov, muraee

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 25, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@sdminonne: Only users can be targets for the /verified later command.

Details

In response to this:

/verified later by @amasolov

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.

@sdminonne

Copy link
Copy Markdown
Contributor

/verified later @amasolov

@openshift-ci-robot openshift-ci-robot added verified-later verified Signifies that the PR passed pre-merge verification criteria labels Jun 25, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@sdminonne: This PR has been marked to be verified later by @amasolov.

Details

In response to this:

/verified later @amasolov

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.

@sdminonne

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jun 25, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-azure-v2-self-managed
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws
/test e2e-v2-gke

@hypershift-jira-solve-ci

Copy link
Copy Markdown
Contributor

I have all the evidence I need. The failure is clear:

  • Only 1 test out of 616 failed: TestCreateClusterProxy
  • Root cause: AWS EC2 API rate limiting (RequestLimitExceeded) on ec2:CreateVpcEndpoint for AWS Account 820196288204
  • The failure is in infrastructure setup (creating VPC S3 endpoint), not in the test logic or the PR's code changes
  • All other 585 tests passed, 30 were skipped (for non-AWS platforms)
  • The PR changes OAuth LoginURL logic which is completely unrelated to VPC endpoint creation

Test Failure Analysis Complete

Job Information

Test Failure Analysis

Error

TestCreateClusterProxy (118.30s)
hypershift_framework.go:518: failed to create cluster, tearing down: failed to create infra:
cannot create VPC S3 endpoint: operation error EC2: CreateVpcEndpoint, exceeded maximum number
of attempts, 11, https response error StatusCode: 503, RequestID: a9316ff4-d501-4a01-bd22-345949d2a6ce,
api error RequestLimitExceeded: Request limit exceeded. Account 820196288204 has been throttled
on ec2:CreateVpcEndpoint because it exceeded its request rate limit.

Summary

The sole test failure (TestCreateClusterProxy) is caused by AWS EC2 API rate limiting — not by the PR's code changes. During cluster infrastructure setup, the ec2:CreateVpcEndpoint API call was throttled by AWS after 11 retry attempts (HTTP 503, RequestLimitExceeded) on account 820196288204. The cluster never got created, so the test immediately tore down and failed. This is a transient AWS infrastructure issue unrelated to the PR, which modifies OAuth LoginURL logic in the control-plane-operator. All other 585 tests passed successfully.

Root Cause

AWS EC2 API Rate Limiting (Infrastructure / Flake)

The TestCreateClusterProxy test failed during its infrastructure provisioning phase, before any HyperShift-specific or OAuth-related code was exercised. The specific failure chain:

  1. The test called hypershift_framework.go:518 to create a new hosted cluster with proxy configuration
  2. As part of infrastructure creation, the framework attempted to create a VPC S3 endpoint via the AWS EC2 CreateVpcEndpoint API
  3. AWS returned HTTP 503 with error RequestLimitExceeded — the shared CI account 820196288204 was throttled on ec2:CreateVpcEndpoint because it exceeded its request rate limit
  4. The SDK retried 11 times (the maximum configured attempts) and all attempts failed
  5. The framework abandoned cluster creation and tore down the partial resources

This failure is completely unrelated to the PR's changes. PR #8433 modifies the control-plane-operator to use KubeAPIServerDNSName for the OAuth LoginURL — this code path is only reached after a hosted cluster is fully created and its control plane is running. The TestCreateClusterProxy test never got past infrastructure provisioning.

The e2e test suite ran 616 tests total: 585 passed, 30 were skipped (platform-specific tests for Azure, KubeVirt, OpenStack, etc.), and only this single infrastructure-level failure occurred. No tests related to OAuth, authentication, or the control-plane-operator failed.

Recommendations
  1. Rerun the job — This is a transient AWS rate limiting issue. A /retest or /test e2e-aws should succeed once the API rate limit window resets.

  2. No code changes needed — The PR's changes to OAuth LoginURL handling are not related to this failure. The failing test (TestCreateClusterProxy) tests proxy configuration during cluster creation, and failed at the AWS infrastructure level before any HyperShift code was invoked.

  3. If rate limiting persists across retries, it indicates high concurrent CI load on the shared AWS account. This would be a CI infrastructure issue to raise with the test-platform team, not a code issue.

Evidence
Evidence Detail
Failed Test TestCreateClusterProxy (1 of 616 tests)
Failure Location hypershift_framework.go:518 — infrastructure creation phase
AWS API ec2:CreateVpcEndpoint
AWS Error RequestLimitExceeded (HTTP 503)
AWS Account 820196288204
Retry Attempts 11 (maximum exceeded)
AWS Request ID a9316ff4-d501-4a01-bd22-345949d2a6ce
Test Duration 118.30s (mostly retries + teardown)
Passed Tests 585
Skipped Tests 30 (platform-specific: Azure, KubeVirt, OpenStack, etc.)
Failed Step e2e-aws-hypershift-aws-run-e2e-nested (1h9m12s)
Pre Phase All steps passed (management cluster created successfully)
Post Phase All steps passed (dump, cleanup completed successfully)
PR Scope OAuth LoginURL changes in control-plane-operator — unrelated to VPC endpoint creation

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD 652dbf2 and 2 for PR HEAD 7404745 in total

@vsolanki12

Copy link
Copy Markdown
Contributor

/ok-to-test

@openshift-ci

openshift-ci Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

@amasolov: all tests passed!

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.

@openshift-merge-bot
openshift-merge-bot Bot merged commit 3a77cc3 into openshift:main Jun 26, 2026
41 checks passed
@openshift-ci-robot

Copy link
Copy Markdown

@amasolov: Jira Issue OCPBUGS-81312: All pull requests linked via external trackers have merged:

This pull request has the verified-later tag and will need to be manually moved to VERIFIED after testing. Jira Issue OCPBUGS-81312 has been moved to the MODIFIED state.

Details

In response to this:

Summary

  • When spec.kubeAPIServerDNSName is set, the OAuth token display page now shows the custom FQDN in oc login --server= instead of the LoadBalancer IP address
  • The IBMCloud login URL override annotation retains highest priority
  • Adds unit tests for adaptOAuthConfig covering all LoginURL derivation paths

Fixes: https://issues.redhat.com/browse/OCPBUGS-81312

Details

The OAuth server config's LoginURL determines the --server= value shown on the token display page (the "Copy login command" page in the console). Previously, LoginURL always used ControlPlaneEndpoint.Host, which is derived from the infrastructure LoadBalancer status and resolves to an IP when the LB ingress only has an IP address (common with MetalLB and on-premises environments).

When a user configures spec.kubeAPIServerDNSName to set a custom FQDN for accessing the API server, this FQDN was correctly used for the custom kubeconfig but was not reflected in the OAuth token display page. Users would see oc login --server=https://10.x.x.x:6443 instead of oc login --server=https://api.custom.example.com:6443.

This change makes adaptOAuthConfig prefer KubeAPIServerDNSName for the LoginURL host when set, while preserving the existing IBMCloud login URL override annotation (oauth.hypershift.openshift.io/login-url-override) as the highest-priority override.

Test plan

  • Unit tests pass (go test ./control-plane-operator/controllers/hostedcontrolplane/v2/oauth/... -v)
  • Verify on a HCP cluster with KubeAPIServerDNSName set that the token display page shows the FQDN
  • Verify behaviour is unchanged when KubeAPIServerDNSName is not set
  • Verify IBMCloud login URL override annotation still takes precedence

Made with Cursor

Summary by CodeRabbit

  • New Features

  • OAuth login URL generation now uses the control-plane host and port, respects a customized control‑plane DNS name and explicit login‑URL overrides, and correctly handles IPv4 and IPv6 formats.

  • Tests

  • Added comprehensive tests validating OAuth URL generation across DNS overrides, annotation precedence, IP endpoints, and IPv6 formatting.

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-merge-robot

Copy link
Copy Markdown
Contributor

Fix included in release 5.0.0-0.nightly-2026-06-26-152608

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/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. verified Signifies that the PR passed pre-merge verification criteria verified-later

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants