Skip to content

fix: OCPBUGS-93456: changes NodePortPublishingStrategy.Port#9002

Open
mehabhalodiya wants to merge 1 commit into
openshift:mainfrom
mehabhalodiya:mce5-ho-bug
Open

fix: OCPBUGS-93456: changes NodePortPublishingStrategy.Port#9002
mehabhalodiya wants to merge 1 commit into
openshift:mainfrom
mehabhalodiya:mce5-ho-bug

Conversation

@mehabhalodiya

@mehabhalodiya mehabhalodiya commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

The fix changes NodePortPublishingStrategy.Port from int32 to *int32 across 16 files, so omitempty no longer drops port: 0 during serialization. This breaks the deadlock where the reconciler could never add its finalizer because the webhook rejected the round-tripped object as having mutated the immutable Services field.

What this PR does / why we need it:

Root cause: NodePortPublishingStrategy.Port was declared as int32 with json:"port,omitempty". Go's omitempty omits zero-valued integers, so when the UI creates a HostedCluster with nodePort.port: 0 (dynamic assignment), the reconciler's client.Update() serializes the struct without the port field. The webhook then rejects the update because Services appears to have changed — permanent deadlock, no finalizer can ever be added.

Fix: Changed Port from int32 to *int32 in hostedcluster_types.go:1105. With a pointer, omitempty only omits when the pointer is nil (field truly absent), not when the value is 0 (explicitly set to zero for dynamic assignment). This follows the API convention: "The only reason to use a pointer in a CRD is when the zero value is a valid, distinct user choice."

Which issue(s) this PR fixes:

Fixes https://redhat.atlassian.net/browse/OCPBUGS-93456

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

    • Made NodePort port values optional in the API, allowing Kubernetes to assign ports dynamically.
    • Updated service reconciliation and Ignition/OAuth service adaptation to safely handle missing NodePort ports (no nil dereferences).
    • Improved hosted cluster NodePort range validation and safer construction of external address:port outputs.
  • Tests

    • Updated NodePort-related test fixtures and expectations to use optional pointer-typed ports, covering dynamic and explicitly assigned scenarios.

@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

@openshift-ci-robot openshift-ci-robot added jira/severity-critical Referenced Jira bug's severity is critical for the branch this PR is targeting. 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 Jul 14, 2026
@openshift-ci-robot

Copy link
Copy Markdown

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

The fix changes NodePortPublishingStrategy.Port from int32 to *int32 across 16 files, so omitempty no longer drops port: 0 during serialization. This breaks the deadlock where the reconciler could never add its finalizer because the webhook rejected the round-tripped object as having mutated the immutable Services field.

What this PR does / why we need it:

Root cause: NodePortPublishingStrategy.Port was declared as int32 with json:"port,omitempty". Go's omitempty omits zero-valued integers, so when the UI creates a HostedCluster with nodePort.port: 0 (dynamic assignment), the reconciler's client.Update() serializes the struct without the port field. The webhook then rejects the update because Services appears to have changed — permanent deadlock, no finalizer can ever be added.

Fix: Changed Port from int32 to *int32 in hostedcluster_types.go:1105. With a pointer, omitempty only omits when the pointer is nil (field truly absent), not when the value is 0 (explicitly set to zero for dynamic assignment). This follows the API convention: "The only reason to use a pointer in a CRD is when the zero value is a valid, distinct user choice."

Which issue(s) this PR fixes:

Fixes https://redhat.atlassian.net/browse/OCPBUGS-93456

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.

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 14, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

NodePortPublishingStrategy.Port is now an optional *int32. Service reconcilers check for nil before assigning NodePorts. HostedCluster validation treats omitted ports as 0, and E2E API server address construction requires a non-nil, non-zero port. Related tests now construct port values with ptr.To.

Suggested reviewers: cblecker, clebs

🚥 Pre-merge checks | ✅ 11
✅ Passed checks (11 passed)
Check name Status Explanation
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 Touched tests use static table names; no new titles include generated names, timestamps, UUIDs, nodes, namespaces, or IPs.
Test Structure And Quality ✅ Passed Modified tests are table-driven unit tests with fake clients only; no cluster resources, Eventually/Consistently, or cleanup issues were introduced.
Topology-Aware Scheduling Compatibility ✅ Passed The patch only changes NodePort pointer handling and validation; no affinity, topology spread, replicas, nodeSelectors, or tolerations were added.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the only e2e change is a helper, and I found no It/Describe/Context/When blocks or external connectivity requirements.
No-Weak-Crypto ✅ Passed Touched files only change NodePort pointer handling; no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret-comparison code found.
Container-Privileges ✅ Passed Only Go API/service code and tests changed; no Kubernetes container manifests or privileged settings (privileged, hostPID/Network/IPC, SYS_ADMIN, allowPrivilegeEscalation) were added.
No-Sensitive-Data-In-Logs ✅ Passed Diff adds no logging calls or sensitive literals; changes only adjust pointer handling and validation.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: making NodePortPublishingStrategy.Port optional.
✨ 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 cblecker and clebs July 14, 2026 14:47
@openshift-ci openshift-ci Bot added area/api Indicates the PR includes changes for the API 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 and removed do-not-merge/needs-area labels Jul 14, 2026
@openshift-ci

openshift-ci Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mehabhalodiya
Once this PR has been reviewed and has the lgtm label, please assign enxebre 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

@openshift-ci openshift-ci Bot added the area/testing Indicates the PR includes changes for e2e testing label Jul 14, 2026
… to *int32

With this fix, omitempty no longer drops port: 0 during serialization.

Signed-off-by: mehabhalodiya <mehabhalodiya@gmail.com>

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
hypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.go (1)

5950-5961: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Cover omitted ports separately from explicit 0.

Port: ptr.To(int32(0)) does not exercise the new nil path. Add a table case with Port: nil to verify omitted ports are also accepted as dynamically assigned.

As per coding guidelines, “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
`@hypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.go`
around lines 5950 - 5961, Extend the table-driven tests around the “port 0 for
dynamic assignment” case with a separate NodePortPublishingStrategy case whose
Port is nil. Verify that an omitted port is accepted for dynamic assignment,
while retaining the existing explicit zero-port coverage.

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.

Outside diff comments:
In
`@hypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.go`:
- Around line 5950-5961: Extend the table-driven tests around the “port 0 for
dynamic assignment” case with a separate NodePortPublishingStrategy case whose
Port is nil. Verify that an omitted port is accepted for dynamic assignment,
while retaining the existing explicit zero-port coverage.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 6a2d7d9c-9aaa-44d9-8af6-e3d48de1414f

📥 Commits

Reviewing files that changed from the base of the PR and between a84834f and 10bc860.

⛔ Files ignored due to path filters (3)
  • api/hypershift/v1beta1/zz_generated.deepcopy.go is excluded by !**/zz_generated*.go, !**/zz_generated*
  • vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/hostedcluster_types.go is excluded by !vendor/**, !**/vendor/**
  • vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/zz_generated.deepcopy.go is excluded by !vendor/**, !**/vendor/**, !**/zz_generated*.go, !**/zz_generated*
📒 Files selected for processing (13)
  • api/hypershift/v1beta1/hostedcluster_types.go
  • control-plane-operator/controllers/hostedcontrolplane/kas/service.go
  • control-plane-operator/controllers/hostedcontrolplane/kas/service_test.go
  • control-plane-operator/controllers/hostedcontrolplane/oauth/service.go
  • control-plane-operator/controllers/hostedcontrolplane/oauth/service_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/ignitionserver/service.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/ignitionserver/service_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/ignitionserver_proxy/service.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/ignitionserver_proxy/service_test.go
  • hypershift-operator/controllers/hostedcluster/hostedcluster_controller.go
  • hypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.go
  • hypershift-operator/controllers/hostedcluster/network_policies_test.go
  • test/e2e/util/util.go

@mehabhalodiya mehabhalodiya changed the title OCPBUGS-93456: changes NodePortPublishingStrategy.Port fix: OCPBUGS-93456: changes NodePortPublishingStrategy.Port Jul 14, 2026
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.11%. Comparing base (845ed6f) to head (33bf9a3).
⚠️ Report is 34 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9002      +/-   ##
==========================================
+ Coverage   43.79%   44.11%   +0.31%     
==========================================
  Files         772      772              
  Lines       96037    96109      +72     
==========================================
+ Hits        42061    42399     +338     
+ Misses      51061    50767     -294     
- Partials     2915     2943      +28     
Files with missing lines Coverage Δ
...ator/controllers/hostedcontrolplane/kas/service.go 40.36% <100.00%> (ø)
...or/controllers/hostedcontrolplane/oauth/service.go 74.74% <100.00%> (ø)
...rs/hostedcontrolplane/v2/ignitionserver/service.go 90.32% <100.00%> (ø)
...tedcontrolplane/v2/ignitionserver_proxy/service.go 100.00% <100.00%> (ø)
...trollers/hostedcluster/hostedcluster_controller.go 54.72% <100.00%> (ø)

... and 19 files with indirect coverage changes

Flag Coverage Δ
cmd-support 38.28% <ø> (+0.85%) ⬆️
cpo-hostedcontrolplane 46.06% <100.00%> (+0.14%) ⬆️
cpo-other 45.16% <ø> (+0.04%) ⬆️
hypershift-operator 54.09% <100.00%> (+0.02%) ⬆️
other 32.12% <ø> (+0.03%) ⬆️

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.

@hypershift-jira-solve-ci

Copy link
Copy Markdown
Contributor

Now I have all the evidence needed. Here is the final analysis:

Test Failure Analysis Complete

Job Information

  • Prow Job: Red Hat Konflux / enterprise-contract-mce-50 / hypershift-cli-mce-50
  • Build ID: Check Run ID 87118121459
  • Pipeline Run: enterprise-contract-mce-50-lwsw4
  • Namespace: crt-redhat-acm-tenant
  • Snapshot: release-mce-50-20260714-150137-000
  • Commit: 33bf9a3
  • Duration: ~41 minutes (14:50:22 → 15:31:16 UTC)

Test Failure Analysis

Error

Task: verify | Duration: 28s | Status: PodCreationFailed | Reason: PodCreationFailed

The Tekton TaskRun "verify" in PipelineRun "enterprise-contract-mce-50-lwsw4" failed
because the Kubernetes pod backing the task could not be created.

Summary

The verify task of the enterprise-contract integration test pipeline failed with PodCreationFailed — a Tekton TaskRun status indicating that the Kubernetes pod for the task could not be scheduled or created on the Konflux cluster. This is a transient Konflux infrastructure issue entirely unrelated to the PR's code changes. The PR only modifies Go source files (API types, controllers, tests) and does not touch any CI configuration, Containerfiles, or Tekton pipeline definitions. The upstream build (hypershift-cli-mce-50-on-pull-request) completed successfully, and the identical enterprise-contract pipeline passed for every other component on the same commit.

Root Cause

The verify-enterprise-contract Tekton task (resolved from the OCI bundle quay.io/conforma/tekton-task:konflux) has a validate step that requests 1800m CPU and 2Gi memory — significantly more than the preceding collect-keyless-params task. When the Konflux cluster namespace crt-redhat-acm-tenant had insufficient allocatable resources at the time of scheduling (likely due to resource contention from concurrent pipeline runs across multiple PRs), the Tekton pipeline controller could not create the pod and reported PodCreationFailed.

In Tekton's reconciler (tektoncd/pipeline/pkg/reconciler/taskrun/taskrun.go), PodCreationFailed is the catch-all error reason used when pod creation fails for reasons other than quota exceeded (which gets ExceededResourceQuota and auto-retries), admission failures, or validation errors. This suggests the failure was a transient scheduling or container runtime issue.

Key evidence this is infrastructure-only and not code-related:

  1. Same commit, other components passed: On commit 33bf9a33, the enterprise-contract check succeeded for control-plane-operator-main (success), hypershift-operator-main (neutral/warning), and hypershift-release-mce-50 (neutral/warning with 279 successes, 40 warnings). Only hypershift-cli-mce-50 failed.

  2. Same pipeline, different snapshot, same time — passed: The enterprise-contract-mce-50 pipeline ran for both hypershift-release-mce-50 and hypershift-cli-mce-50 components concurrently. The former succeeded while the latter got PodCreationFailed, indicating a race condition for cluster resources rather than a pipeline definition issue.

  3. Same check, prior runs passed: The enterprise-contract-mce-50 / hypershift-cli-mce-50 check completed successfully (neutral/warning) on all recently merged PRs (SPLAT-2741: Add SetSecurityGroups perms for AWS CCM for BYO SG on AWS NLB #8401, OCPBUGS-98571: Skip Azure topology LB scope override for ARO HCP IngressController #8992, CNTRLPLANE-3553: Wire usesRunc detection into RHEL stream resolution #8832, OCPBUGS-88531: Remove CPO-side restart logic for CNO operands #8751) and other open PRs (OCPSTRAT-3150: Add etcd sharding by resource kind support #8705, OCPBUGS-98464: handle stale DaemonSet in GlobalPullSecret test #8990).

  4. The preceding task succeeded: collect-keyless-params (which requires minimal resources) completed successfully in 7 seconds, confirming the pipeline itself, service accounts, and image pulls are functional. The failure only occurred on the resource-heavy verify task.

  5. No CI/container files changed: The PR modifies only .go source files — no .tekton/, Containerfile, Dockerfile, or CI configuration changes that could affect the pipeline.

Recommendations
  1. Re-trigger the check: Push a new commit or request a Konflux pipeline re-run. Since this is a transient infrastructure issue, the re-run will likely succeed. If the Konflux GitHub App supports re-runs, use the GitHub UI to re-run the failed check.

  2. No code changes needed: The PR's changes (converting NodePortPublishingStrategy.Port from int32 to *int32) are unrelated to this failure. The enterprise-contract check validates image signatures and provenance policies — not Go source code correctness.

  3. If the failure persists on retry: Escalate to the Konflux infrastructure team (Red Hat AppStudio / crt-redhat-acm-tenant namespace administrators) to investigate resource quota or scheduling capacity in the tenant namespace. The verify-enterprise-contract task's validate step requests 1800m CPU + 2Gi memory, which may exceed available capacity during peak concurrent pipeline activity.

  4. Consider marking as non-blocking: If this check is not required for merge (the neutral conclusion on passing runs suggests it may be informational), coordinate with the repository maintainers to confirm whether this check blocks PR merges.

Evidence
Evidence Detail
Failed Task verify in PipelineRun enterprise-contract-mce-50-lwsw4
Failure Reason PodCreationFailed — Tekton could not create the backing pod for the TaskRun
Task Duration 28 seconds (failed quickly, no test execution occurred)
Task Resource Requests validate step: 1800m CPU, 2Gi memory (from conforma/tekton-catalog task definition)
Task Image quay.io/conforma/cli:latest@sha256:7de855ebd9d3c9cb7b50be2216a815227fa2dfc04425cc59d8da82e6af2db0c4
Preceding Task collect-keyless-params — succeeded in 7 seconds
Same Pipeline, Other Component hypershift-release-mce-50 — passed (279 successes, 40 warnings)
Other EC Checks on Same Commit control-plane-operator-enterprise-contract — success; hypershift-operator-main-enterprise-contract — neutral/warning
Prior Run (PR #8401, merged 2026-07-14) Same check passed — neutral/warning (277 successes, 23 warnings)
Prior Run (PR #8992, merged 2026-07-14) Same check passed — neutral/warning
PR Files Changed 16 Go files only — no .tekton/, Containerfile, or CI config changes
Build Pipeline hypershift-cli-mce-50-on-pull-request — succeeded (image built correctly)

@openshift-ci

openshift-ci Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

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

@cblecker

Copy link
Copy Markdown
Member

/uncc

@openshift-ci
openshift-ci Bot removed the request for review from cblecker July 14, 2026 17:18
@@ -1102,7 +1102,7 @@ type NodePortPublishingStrategy struct {
// port is the port of the NodePort service. If <=0, the port is dynamically

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should also document what a nil value here means with the new type.

@ironcladlou

Copy link
Copy Markdown
Contributor

@csrwng @enxebre @mehabhalodiya was this API change proposed somewhere? I see no reference to a discussion in the Jira, etc.

I haven't reviewed this yet, but generally I'm wary of API changes framed as bugfixes, and especially without an up front API design review by the team

/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 16, 2026
// assigned when the service is created.
// +optional
Port int32 `json:"port,omitempty"`
Port *int32 `json:"port,omitempty"`

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.

What is the expected behaviour of this field if the field is omitted? E.g. in the future when this is a nil pointer, what would you expect to happen?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is what Claude is suggesting to me (new area, took this bug as an opportunity to learn) -

When port is omitted (nil pointer), the behavior is the same as port: 0 — Kubernetes dynamically assigns a NodePort when the service is created.

All consumers already handle this correctly:

  • KAS/OAuth/Konnectivity service controllers: check strategy.NodePort.Port != nil before using the value — when nil, they skip setting portSpec.NodePort, so Kubernetes auto-assigns.
  • Ignition service controllers: same nil guard — skip setting the port, let Kubernetes choose.
  • Port range validation: uses ptr.Deref(svc.NodePort.Port, 0) and only validates when port > 0 — nil defaults to 0 which is excluded from range checks.

The reason this field needs a pointer is not to distinguish nil from 0 semantically (they're equivalent), but to fix a serialization bug: with the previous int32 + omitempty, Go's JSON encoder dropped port: 0 from the serialized output. When the reconciler read a HostedCluster with port: 0, serialized it back (now missing the field), and called client.Update(), the CEL rule self.services == oldSelf.services rejected the update as "Services is immutable" — creating a permanent deadlock where the reconciler couldn't even add a finalizer.

With *int32 + omitempty, only nil is omitted; an explicit port: 0 is preserved in the JSON, so the round-trip is stable and the immutability check passes.

I've updated the godoc to: "If not specified or set to 0, the port is dynamically assigned when the service is created." (not yet pushed, will do)

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.

The immutability of services implemented by this CEL rule makes this round tripping issue a genuine problem.

Walking through the examples and possible solutions.

Today, an unstructured client can set port: 0. There is no restriction on this and the API server accepts. A structured client would see this as int32, the omitempty causes the port field to be dropped. This breaks immutability.

If we instead changed the field to drop the omitempty. An unstructured client may not set port at all. But when a structured client reads the value, they'll see a 0 int32 value, but without omit empty, they'll add port: 0 to the object. This breaks immutability.

We could prevent the 0 value from being committed (+kubebuilder:validation:XValidation:=1). In the future, no 0 value would be allowed and when the key is omitted, the behaviour is the same as setting 0 today - dynamic allocation. There is no explicit 0 option and there's only one way in the API to represent dynamic assignment. This avoid the round trip issue without changing the port field to a pointer. This is favourable, but it does not account for existing resources. Any resource that exists today would need a manual fix from an unstructured client. This may be acceptable because, AFAICT, any resource that has 0 today would never have a finalizer added and therefore would not progress to become an actual cluster. Users would probably have already deleted this resource? This IS a breaking change, but a breaking change that prevents an otherwise invalid/useless object I think we can permit.

Or we continue to allow the 0 value as an explicit "I want a dynamically allocated port". If we want to do that, we must fix the round trip, and AFAICT the only way to do that is to change the field to *int32 as laid out in this PR. It does correctly maintain whatever the unstructured client applied and would solve the immutability issue. The cons of changing this to a pointer is that we do not control every usage of this field. There will be end users out there who build tooling atop our client libraries. Those who write to this field will need to update their code to account for the change, the compiler will complain if they don't. Those who read this field will be exposed to NPEs as a result of this change, that's a pretty nasty change and not something the compiler would necessarily complain about, so this could break their code in the wild.

So, do we, or do we not want to allow unstructured users to explicitly set port: 0?

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

Labels

area/api Indicates the PR includes changes for the API 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 area/testing Indicates the PR includes changes for e2e testing do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. jira/severity-critical Referenced Jira bug's severity is critical for the branch this PR is targeting. 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.

6 participants