Skip to content

OCPBUGS-100140: bracket IPv6 in OAuth issuer and callback URLs - #9120

Open
andrej1991 wants to merge 2 commits into
openshift:mainfrom
andrej1991:fix-ipv6-oauth-urls
Open

OCPBUGS-100140: bracket IPv6 in OAuth issuer and callback URLs#9120
andrej1991 wants to merge 2 commits into
openshift:mainfrom
andrej1991:fix-ipv6-oauth-urls

Conversation

@andrej1991

@andrej1991 andrej1991 commented Jul 27, 2026

Copy link
Copy Markdown

Go's url.Parse rejects unbracketed IPv6 host:port strings, which made kube-apiserver CrashLoop on NodePort OAuth metadata and left HostedControlPlane not Ready.

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • Bug Fixes

    • Corrected OAuth callback and OAuth metadata endpoint URL formatting (issuer, authorization endpoint, token endpoint) for IPv4, IPv6, and hostname-based setups.
    • Ensured host:port URL construction properly handles IPv6 literals with brackets across ignition and API server endpoint generation.
  • Tests

    • Expanded OAuth metadata tests to cover IPv4, IPv6, and hostname cases with assertions for generated endpoint URLs.
    • Added unit tests for OAuth client redirect URI formatting for IPv4 and IPv6.

@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 Jul 27, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

OAuth callback templates, OAuth metadata endpoints, OAuth client redirect URIs, ignition endpoints, and API server URLs now use net.JoinHostPort for correct IPv6 formatting. Tests cover IPv4, IPv6, and hostname inputs across these endpoint types.

Suggested reviewers: jparrill, csrwng, bryan-cox

🚥 Pre-merge checks | ✅ 11
✅ Passed checks (11 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: bracketing IPv6 in OAuth issuer and callback URL construction.
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 No Ginkgo titles were added; all new/modified subtest names are static, descriptive strings without runtime data or generated identifiers.
Test Structure And Quality ✅ Passed Added tests are small table-driven unit tests, each case covers one behavior; no cluster setup, cleanup, or wait timeouts are involved, and the repo uses the same assertion style.
Topology-Aware Scheduling Compatibility ✅ Passed Changes are limited to URL formatting/tests with net.JoinHostPort; no deployment, affinity, nodeSelector, replica, or topology logic was added.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo/e2e tests were added; the changes are plain unit tests and URL-format fixes, with no public internet or disconnected-network dependency.
No-Weak-Crypto ✅ Passed Diff only changes URL/host formatting via net.JoinHostPort and retains existing crypto/rand token generation; no weak algorithms or secret comparisons added.
Container-Privileges ✅ Passed No changed manifest contains privileged/root/hostNetwork/etc.; patch only updates Go URL formatting/tests, and keyword search on changed files found nothing.
No-Sensitive-Data-In-Logs ✅ Passed Touched code only changes host/port URL formatting and tests; no new logging or sensitive-data emissions were added in modified paths.
✨ 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 Nirshal and csrwng July 27, 2026 12:41
@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 Jul 27, 2026

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

🧹 Nitpick comments (2)
control-plane-operator/controllers/hostedcontrolplane/v2/kas/oauth_test.go (1)

41-79: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the required “When ... it should ...” test-name format.

Rename the three new cases to include it should, for example: When OAuth host is IPv6, it should bracket the address.

As per coding guidelines, **/*_test.go: Always use “When ... it should ...” format for describing test cases when creating unit tests.

Proposed rename
- name: "When OAuth host is IPv4, issuer URLs should not use brackets",
+ name: "When OAuth host is IPv4, it should leave issuer URLs unbracketed",

- name: "When OAuth host is IPv6, issuer URLs should bracket the address",
+ name: "When OAuth host is IPv6, it should bracket the address",

- name: "When OAuth host is a hostname, issuer URLs should remain unbracketed",
+ name: "When OAuth host is a hostname, it should leave issuer URLs unbracketed",
🤖 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/kas/oauth_test.go`
around lines 41 - 79, Rename the three new test cases in the OAuth test table so
each follows the required “When ..., it should ...” format: the IPv4 case should
state it should not use brackets, the IPv6 case should state it should bracket
the address, and the hostname case should state it should remain unbracketed.
Keep the test logic and expectations unchanged.

Source: Coding guidelines

control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go (1)

765-767: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add or confirm unit coverage for the callback template.

The supplied tests cover adaptOauthMetadata, but do not exercise this controller branch. Verify that an existing controller test covers an IPv6 OAuthHost; otherwise add one to prevent regressions in OAuthCallbackURLTemplate.

As per coding guidelines, **/*_test.go: Unit test any code changes and additions.

🤖 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/hostedcontrolplane_controller.go`
around lines 765 - 767, Add or update a unit test for the controller branch
assigning OAuthCallbackURLTemplate, using an IPv6 infraStatus.OAuthHost and
verifying the resulting URL brackets the host and includes the OAuth port. Reuse
existing controller test setup and confirm the expected callback path and
identity-provider placeholder.

Source: Coding guidelines

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

Nitpick comments:
In
`@control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go`:
- Around line 765-767: Add or update a unit test for the controller branch
assigning OAuthCallbackURLTemplate, using an IPv6 infraStatus.OAuthHost and
verifying the resulting URL brackets the host and includes the OAuth port. Reuse
existing controller test setup and confirm the expected callback path and
identity-provider placeholder.

In `@control-plane-operator/controllers/hostedcontrolplane/v2/kas/oauth_test.go`:
- Around line 41-79: Rename the three new test cases in the OAuth test table so
each follows the required “When ..., it should ...” format: the IPv4 case should
state it should not use brackets, the IPv6 case should state it should bracket
the address, and the hostname case should state it should remain unbracketed.
Keep the test logic and expectations unchanged.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: ec9e07c8-82f1-41f6-af9f-c5c171a31fe8

📥 Commits

Reviewing files that changed from the base of the PR and between 02c0659 and 53fc430.

📒 Files selected for processing (3)
  • control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/kas/oauth.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/kas/oauth_test.go

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 44.66%. Comparing base (872a7e8) to head (010d0f3).
⚠️ Report is 47 commits behind head on main.

Files with missing lines Patch % Lines
...trollers/hostedcluster/hostedcluster_controller.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9120      +/-   ##
==========================================
+ Coverage   44.51%   44.66%   +0.14%     
==========================================
  Files         774      775       +1     
  Lines       96997    97114     +117     
==========================================
+ Hits        43179    43373     +194     
+ Misses      50830    50744      -86     
- Partials     2988     2997       +9     
Files with missing lines Coverage Δ
...ostedcontrolplane/hostedcontrolplane_controller.go 46.06% <100.00%> (+0.04%) ⬆️
...tor/controllers/hostedcontrolplane/v2/kas/oauth.go 19.76% <100.00%> (+12.53%) ⬆️
...goperator/controllers/resources/oauth/reconcile.go 81.53% <100.00%> (+43.44%) ⬆️
support/globalconfig/infrastructure.go 100.00% <100.00%> (ø)
...trollers/hostedcluster/hostedcluster_controller.go 54.68% <0.00%> (ø)

... and 14 files with indirect coverage changes

Flag Coverage Δ
cmd-support 38.39% <100.00%> (+<0.01%) ⬆️
cpo-hostedcontrolplane 47.29% <100.00%> (+0.07%) ⬆️
cpo-other 45.51% <100.00%> (+0.26%) ⬆️
hypershift-operator 54.55% <0.00%> (+0.09%) ⬆️
other 33.30% <ø> (+0.66%) ⬆️

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.

Go's url.Parse rejects unbracketed IPv6 host:port strings, which made
kube-apiserver CrashLoop on NodePort OAuth metadata and left HostedControlPlane not Ready.

Co-authored-by: Cursor <cursoragent@cursor.com>
@andrej1991
andrej1991 force-pushed the fix-ipv6-oauth-urls branch from 53fc430 to 3615091 Compare July 27, 2026 13:31
@andrej1991 andrej1991 changed the title fix(cpo): bracket IPv6 in OAuth issuer and callback URLs NO-ISSUE: bracket IPv6 in OAuth issuer and callback URLs Jul 28, 2026
@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 28, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@andrej1991: This pull request explicitly references no jira issue.

Details

In response to this:

Go's url.Parse rejects unbracketed IPv6 host:port strings, which made kube-apiserver CrashLoop on NodePort OAuth metadata and left HostedControlPlane not Ready.

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • Bug Fixes

  • Corrected OAuth callback and OAuth metadata endpoint URLs (issuer, authorization endpoint, and token endpoint) across IPv4, IPv6, and hostname-based setups.

  • Ensures IPv6 addresses are formatted with the required brackets for correct OAuth behavior.

  • Tests

  • Expanded OAuth metadata tests to cover IPv4, IPv6, and hostname cases, including validation of the generated endpoint URLs.

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.

@andrej1991 andrej1991 changed the title NO-ISSUE: bracket IPv6 in OAuth issuer and callback URLs MGMT-24693: bracket IPv6 in OAuth issuer and callback URLs Jul 28, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 28, 2026

Copy link
Copy Markdown

@andrej1991: This pull request references MGMT-24693 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 task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Go's url.Parse rejects unbracketed IPv6 host:port strings, which made kube-apiserver CrashLoop on NodePort OAuth metadata and left HostedControlPlane not Ready.

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • Bug Fixes

  • Corrected OAuth callback and OAuth metadata endpoint URLs (issuer, authorization endpoint, and token endpoint) across IPv4, IPv6, and hostname-based setups.

  • Ensures IPv6 addresses are formatted with the required brackets for correct OAuth behavior.

  • Tests

  • Expanded OAuth metadata tests to cover IPv4, IPv6, and hostname cases, including validation of the generated endpoint URLs.

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.

@csrwng csrwng added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 29, 2026
@jparrill

Copy link
Copy Markdown
Contributor

/cc

@openshift-ci
openshift-ci Bot requested a review from jparrill July 29, 2026 09:31
@andrej1991 andrej1991 changed the title MGMT-24693: bracket IPv6 in OAuth issuer and callback URLs OCPBUGS-100140: bracket IPv6 in OAuth issuer and callback URLs Jul 29, 2026
@openshift-ci-robot openshift-ci-robot added the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Jul 29, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@andrej1991: This pull request references Jira Issue OCPBUGS-100140, 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:

Go's url.Parse rejects unbracketed IPv6 host:port strings, which made kube-apiserver CrashLoop on NodePort OAuth metadata and left HostedControlPlane not Ready.

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • Bug Fixes

  • Corrected OAuth callback and OAuth metadata endpoint URLs (issuer, authorization endpoint, and token endpoint) across IPv4, IPv6, and hostname-based setups.

  • Ensures IPv6 addresses are formatted with the required brackets for correct OAuth behavior.

  • Tests

  • Expanded OAuth metadata tests to cover IPv4, IPv6, and hostname cases, including validation of the generated endpoint URLs.

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.

@andrej1991

Copy link
Copy Markdown
Author

/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 Jul 29, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@andrej1991: This pull request references Jira Issue OCPBUGS-100140, 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.

@jparrill

Copy link
Copy Markdown
Contributor

/label acknowledge-critical-fixes-only

@openshift-ci openshift-ci Bot added the acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. label Jul 29, 2026
@jparrill

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 29, 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
/test unit
/test verify

@jparrill

Copy link
Copy Markdown
Contributor

/retest-required

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

Missing fix in HCCO OAuth clients

Nice fix! We're aware this wasn't part of the original issue scope, but it looks like ReconcileBrowserClient and ReconcileChallengingClient in control-plane-operator/hostedclusterconfigoperator/controllers/resources/oauth/reconcile.go (lines 25, 32) have the same fmt.Sprintf("https://%s:%d/...", ...) pattern that will produce invalid redirect URIs for IPv6 OAuth hosts. The externalHost value ultimately comes from InfraStatus.OAuthHost via the --oauth-address flag.

Would you mind extending the fix to cover these two call sites as well? It would be great to have all the IPv6 bracketing handled in one PR. Thanks!

wantErr: true,
errSubstr: "failed to unmarshal oauth metadata",
},
{

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.

nit: the project convention for test names is "When ..., it should ...". For example:

  • "When OAuth host is IPv6, it should bracket the address"
  • "When OAuth host is IPv4, it should leave issuer URLs unbracketed"

}
if util.HCPOAuthEnabled(hostedControlPlane) {
hostedControlPlane.Status.OAuthCallbackURLTemplate = fmt.Sprintf("https://%s:%d/oauth2callback/[identity-provider-name]", infraStatus.OAuthHost, infraStatus.OAuthPort)
// JoinHostPort brackets IPv6 literals so url.Parse accepts the callback template.

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.

nit: JoinHostPort already conveys the intent — the comment could be dropped per project conventions (no comments on self-explanatory code).

@andrej1991

Copy link
Copy Markdown
Author

/hold

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 29, 2026
@openshift-ci openshift-ci Bot added area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release and removed lgtm Indicates that a PR is ready to be merged. labels Jul 29, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@andrej1991: This pull request references Jira Issue OCPBUGS-100140, which is valid.

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 POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

Go's url.Parse rejects unbracketed IPv6 host:port strings, which made kube-apiserver CrashLoop on NodePort OAuth metadata and left HostedControlPlane not Ready.

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • Bug Fixes

  • Corrected OAuth callback and OAuth metadata endpoint URL formatting (issuer, authorization endpoint, token endpoint) for IPv4, IPv6, and hostname-based setups.

  • Ensured host:port URL construction properly handles IPv6 literals with brackets across ignition and API server endpoint generation.

  • Tests

  • Expanded OAuth metadata tests to cover IPv4, IPv6, and hostname cases with assertions for generated endpoint URLs.

  • Added unit tests for OAuth client redirect URI formatting for IPv4 and IPv6.

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.

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

lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 29, 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-4-22
/test e2e-aws-4-22
/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
/test unit
/test verify

@openshift-ci

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by: andrej1991, Nirshal

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

@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

🤖 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 `@hypershift-operator/controllers/hostedcluster/hostedcluster_controller.go`:
- Line 1118: Add test coverage for both reconciler paths using a raw IPv6
serviceStrategy.NodePort.Address, verifying the generated IgnitionEndpoint is
correctly bracketed by net.JoinHostPort. Cover the hostedcluster_controller.go
site at lines 1118-1118 and reconcile_legacy.go site at lines 799-799; update
tests only, with no direct production-code change required.
🪄 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: cc0c86e7-cfec-4aa8-bdfa-09f6607aa7f4

📥 Commits

Reviewing files that changed from the base of the PR and between 3615091 and 010d0f3.

📒 Files selected for processing (8)
  • control-plane-operator/controllers/hostedcontrolplane/v2/kas/oauth_test.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/resources/oauth/reconcile.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/resources/oauth/reconcile_test.go
  • hypershift-operator/controllers/hostedcluster/hostedcluster_controller.go
  • hypershift-operator/controllers/hostedcluster/internal/platform/agent/agent_test.go
  • hypershift-operator/controllers/hostedcluster/reconcile_legacy.go
  • support/globalconfig/infrastructure.go
  • support/globalconfig/infrastructure_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • control-plane-operator/controllers/hostedcontrolplane/v2/kas/oauth_test.go

}
if err == nil && serviceFirstNodePortAvailable(ignitionService) {
hcluster.Status.IgnitionEndpoint = fmt.Sprintf("%s:%d", serviceStrategy.NodePort.Address, ignitionService.Spec.Ports[0].NodePort)
hcluster.Status.IgnitionEndpoint = net.JoinHostPort(serviceStrategy.NodePort.Address, strconv.Itoa(int(ignitionService.Spec.Ports[0].NodePort)))

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.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- hostedcluster_controller.go around line 1118 ---'
sed -n '1088,1135p' hypershift-operator/controllers/hostedcluster/hostedcluster_controller.go

echo
echo '--- reconcile_legacy.go around line 799 ---'
sed -n '770,825p' hypershift-operator/controllers/hostedcluster/reconcile_legacy.go

echo
echo '--- search tests for IgnitionEndpoint / IPv6 / NodePort Address ---'
rg -n "IgnitionEndpoint|NodePort.Address|JoinHostPort|IPv6|bracket" hypershift-operator/controllers/hostedcluster -g '*_test.go'

Repository: openshift/hypershift

Length of output: 10823


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n "2001:|IPv6|JoinHostPort|IgnitionEndpoint|NodePort.Address" hypershift-operator/controllers/hostedcluster -g '*_test.go' -A 4 -B 4

Repository: openshift/hypershift

Length of output: 38286


🏁 Script executed:

#!/bin/bash
set -euo pipefail
git ls-files hypershift-operator/controllers/hostedcluster/*_test.go

Repository: openshift/hypershift

Length of output: 894


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- NodePort-related tests in hostedcluster_controller_test.go ---'
rg -n "NodePort|ignition service|ignition proxy service|IgnitionEndpoint|JoinHostPort|Address" hypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.go -A 6 -B 6

echo
echo '--- Legacy reconcile test search in hostedcluster controller tests ---'
rg -n "legacy|reconcile_legacy|IgnitionEndpoint" hypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.go -A 3 -B 3

Repository: openshift/hypershift

Length of output: 28937


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- exact NodePort.Address usages in tests ---'
rg -n "NodePort\.Address|IgnitionEndpoint.*JoinHostPort|JoinHostPort\(serviceStrategy\.NodePort\.Address|serviceStrategy\.NodePort\.Address" hypershift-operator -g '*_test.go' -A 4 -B 4

echo
echo '--- any reconcile_legacy test file or legacy-path-specific test references ---'
rg -n "reconcile_legacy|legacy path|IgnitionEndpoint" hypershift-operator -g '*_test.go' -A 2 -B 2

Repository: openshift/hypershift

Length of output: 205


Add raw IPv6 NodePort coverage for both reconciler paths. The current tests don’t exercise net.JoinHostPort(serviceStrategy.NodePort.Address, ...) with a raw IPv6 address, so an unbracketed endpoint regression would still slip through.

  • hypershift-operator/controllers/hostedcluster/hostedcluster_controller.go#L1118-L1118
  • hypershift-operator/controllers/hostedcluster/reconcile_legacy.go#L799-L799
📍 Affects 2 files
  • hypershift-operator/controllers/hostedcluster/hostedcluster_controller.go#L1118-L1118 (this comment)
  • hypershift-operator/controllers/hostedcluster/reconcile_legacy.go#L799-L799
🤖 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 `@hypershift-operator/controllers/hostedcluster/hostedcluster_controller.go` at
line 1118, Add test coverage for both reconciler paths using a raw IPv6
serviceStrategy.NodePort.Address, verifying the generated IgnitionEndpoint is
correctly bracketed by net.JoinHostPort. Cover the hostedcluster_controller.go
site at lines 1118-1118 and reconcile_legacy.go site at lines 799-799; update
tests only, with no direct production-code change required.

Source: Coding guidelines

@cwbotbot

cwbotbot commented Jul 29, 2026

Copy link
Copy Markdown

Test Results

e2e-aws

e2e-aks

@andrej1991

Copy link
Copy Markdown
Author

/unhold

@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 29, 2026
@andrej1991

Copy link
Copy Markdown
Author

/test e2e-aks

@andrej1991

Copy link
Copy Markdown
Author

/test e2e-aks-4-22

@openshift-ci

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

@andrej1991: 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.

@gamli75

gamli75 commented Jul 29, 2026

Copy link
Copy Markdown

/verified later

@openshift-ci-robot

Copy link
Copy Markdown

@gamli75: /verified later <@username> requires at least one GitHub @username to be specified (it can be a comma delimited list). It indicates the engineer(s) that will be performing the verification. See https://docs.ci.openshift.org/docs/architecture/jira/#premerge-verification for more information.

Details

In response to this:

/verified later

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.

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

Labels

acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. 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 area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants