Skip to content

ROSAENG-60642: feat(install): add --operator-pprof-addr flag to enable pprof on the HyperShift Operator - #8853

Closed
Ajpantuso wants to merge 1 commit into
openshift:mainfrom
Ajpantuso:apantuso/ROSAENG-60642
Closed

ROSAENG-60642: feat(install): add --operator-pprof-addr flag to enable pprof on the HyperShift Operator#8853
Ajpantuso wants to merge 1 commit into
openshift:mainfrom
Ajpantuso:apantuso/ROSAENG-60642

Conversation

@Ajpantuso

@Ajpantuso Ajpantuso commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Add an installer option to conditionally enable the Go pprof profiling server on the HyperShift Operator. The HyperShift Operator uses controller-runtime, which has built-in pprof support via `manager.Options.PprofBindAddress`, but this field was never set. There was no way to enable pprof without modifying code and redeploying.

When `--operator-pprof-addr` is provided (e.g. `:6060`), the installer passes `--pprof-addr` to the operator binary and adds the corresponding container port to the Deployment. The pprof endpoint is intentionally not exposed via a Service.

Which issue(s) this PR fixes:

Fixes ROSAENG-60642

Special notes for your reviewer:

The installer validates the address format and port range (1–65535) before generating manifests so that invalid values fail early rather than after deployment.

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

  • New Features
    • Added an install-time option to configure the HyperShift operator’s pprof listener with a validated host:port address.
    • Valid configurations expose the pprof port and enable runtime binding; leaving the option empty disables pprof.
  • Bug Fixes
    • Added validation for required ports, valid port ranges (1–65535), and reserved ports (9000, 9443).
  • Tests
    • Added coverage for address validation and deployment configuration.

@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 the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 27, 2026
@openshift-ci-robot

openshift-ci-robot commented Jun 27, 2026

Copy link
Copy Markdown

@Ajpantuso: This pull request references ROSAENG-60642 which is a valid jira issue.

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

Details

In response to this:

What this PR does / why we need it:

Add an installer option to conditionally enable the Go pprof profiling server on the HyperShift Operator. The HyperShift Operator uses controller-runtime, which has built-in pprof support via `manager.Options.PprofBindAddress`, but this field was never set. There was no way to enable pprof without modifying code and redeploying.

When `--operator-pprof-addr` is provided (e.g. `:6060`), the installer passes `--pprof-addr` to the operator binary and adds the corresponding container port to the Deployment. The pprof endpoint is intentionally not exposed via a Service.

Which issue(s) this PR fixes:

Fixes ROSAENG-60642

Special notes for your reviewer:

The installer validates the address format and port range (1–65535) before generating manifests so that invalid values fail early rather than after deployment.

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.

@openshift-ci openshift-ci Bot added do-not-merge/needs-area do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Jun 27, 2026
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The install command adds --operator-pprof-addr and validates its host and port. Valid values pass to deployment generation, which adds the pprof TCP port and --pprof-addr argument. The operator accepts --pprof-addr and sets PprofBindAddress in the controller-runtime manager options.

Sequence Diagram(s)

sequenceDiagram
  participant Installer
  participant Deployment
  participant Operator
  participant Manager
  Installer->>Deployment: Pass validated pprof address
  Deployment->>Operator: Set --pprof-addr and expose pprof port
  Operator->>Manager: Set PprofBindAddress
Loading

Suggested reviewers: cblecker, muraee

🚥 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 and concisely identifies the new installer flag that enables pprof on the HyperShift Operator.
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 The PR adds only standard Go tests with static Test and t.Run titles; no Ginkgo titles or dynamic pod, namespace, node, IP, timestamp, or generated identifiers appear.
Test Structure And Quality ✅ Passed The PR adds standard testing.T/Gomega table tests, not Ginkgo It blocks; they create no cluster resources and use no cluster waits requiring cleanup or timeouts.
Topology-Aware Scheduling Compatibility ✅ Passed The patch adds only pprof flags, validation, manager binding, and a container port; it adds no affinity, topology spread, node targeting, tolerations, replica, or PDB constraints.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR adds only standard Go unit tests with t.Run and Gomega; it adds no Ginkgo e2e tests, external connectivity, or applicable IPv4 networking logic.
No-Weak-Crypto ✅ Passed The commit adds address parsing and pprof wiring only; added-line and changed-file scans found no MD5, SHA1, DES, RC4, Blowfish, ECB, custom crypto, or secret comparisons.
Container-Privileges ✅ Passed The patch adds no privilege-related manifest fields; operator containers remain UID 1000 with Privileged=false, allowPrivilegeEscalation=false, and all capabilities dropped.
No-Sensitive-Data-In-Logs ✅ Passed The PR adds no logging of passwords, tokens, PII, or customer data. PprofAddr is only validated and passed to deployment and controller-runtime configuration.
✨ 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 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci Bot added area/cli Indicates the PR includes changes for CLI 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 Jun 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.

Actionable comments posted: 2

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

Inline comments:
In `@cmd/install/install.go`:
- Around line 195-208: The validateOperatorPprofAddr() check currently only
verifies format and port range, so it still allows ports already reserved by the
operator. Update this validation to reject the reserved listener ports used by
metrics and the manager/webhook server (including the values accepted by
net.SplitHostPort in this path), and make sure the error returned from
validateOperatorPprofAddr() clearly reports the port is unavailable. Add
regression cases to the existing validation table covering the reserved-port
inputs and a valid non-reserved port.

In `@hypershift-operator/main.go`:
- Line 203: The new --pprof-addr flag is only validated on the installer path,
so the run path can still accept malformed or conflicting bind addresses and
fail later. Add the same upfront validation before calling run() in the main
command flow, using the existing pprof address handling around opts.PprofAddr
and the run() entrypoint so both paths reject bad values consistently.
🪄 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: a8405f28-d4c1-432d-987d-184300c152b1

📥 Commits

Reviewing files that changed from the base of the PR and between c180b15 and 95ce94f.

📒 Files selected for processing (5)
  • cmd/install/assets/hypershift_operator.go
  • cmd/install/assets/hypershift_operator_test.go
  • cmd/install/install.go
  • cmd/install/install_test.go
  • hypershift-operator/main.go

Comment thread cmd/install/install.go
Comment thread hypershift-operator/main.go
@codecov

codecov Bot commented Jun 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.85106% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.98%. Comparing base (0cd0254) to head (14339aa).
⚠️ Report is 57 commits behind head on main.

Files with missing lines Patch % Lines
cmd/install/assets/hypershift_operator.go 76.00% 4 Missing and 2 partials ⚠️
hypershift-operator/main.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8853      +/-   ##
==========================================
+ Coverage   44.96%   44.98%   +0.01%     
==========================================
  Files         778      778              
  Lines       97452    97496      +44     
==========================================
+ Hits        43820    43856      +36     
- Misses      50607    50613       +6     
- Partials     3025     3027       +2     
Files with missing lines Coverage Δ
cmd/install/install.go 69.34% <100.00%> (+0.43%) ⬆️
hypershift-operator/main.go 0.00% <0.00%> (ø)
cmd/install/assets/hypershift_operator.go 47.78% <76.00%> (+0.30%) ⬆️
Flag Coverage Δ
cmd-support 38.68% <86.36%> (+0.06%) ⬆️
cpo-hostedcontrolplane 47.28% <ø> (ø)
cpo-other 45.67% <ø> (ø)
hypershift-operator 55.00% <0.00%> (-0.01%) ⬇️
other 34.30% <ø> (ø)

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.

@Ajpantuso
Ajpantuso force-pushed the apantuso/ROSAENG-60642 branch from 95ce94f to 415d103 Compare June 27, 2026 17:46

@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 `@cmd/install/assets/hypershift_operator.go`:
- Around line 775-777: The pprof flag assembly currently allows an address that
conflicts with existing operator listeners, so add a reserved-port validation
for o.PprofAddr that rejects values colliding with metrics/listener ports before
appending "--pprof-addr" in the installer flow. Mirror the same check in the
safety-net parser path that handles pprof address parsing, and make sure any
address-parse errors are returned or handled instead of being ignored.
🪄 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: 2f30fe6d-f76a-4e90-ace6-81d693ba0a73

📥 Commits

Reviewing files that changed from the base of the PR and between 95ce94f and 415d103.

📒 Files selected for processing (5)
  • cmd/install/assets/hypershift_operator.go
  • cmd/install/assets/hypershift_operator_test.go
  • cmd/install/install.go
  • cmd/install/install_test.go
  • hypershift-operator/main.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • cmd/install/install_test.go
  • hypershift-operator/main.go
  • cmd/install/assets/hypershift_operator_test.go

Comment on lines +775 to +777
if o.PprofAddr != "" {
args = append(args, "--pprof-addr="+o.PprofAddr)
}

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.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Reject pprof ports that collide with existing operator listeners.

--pprof-addr=:9000 can currently be emitted even though metrics already bind :9000, which would make the operator fail to start. Add this reserved-port check to installer validation and mirror it in this safety-net parser; also don’t discard the parse errors.

Suggested hardening
-	if o.PprofAddr != "" {
+	if _, ok := o.pprofContainerPort(); ok {
 		args = append(args, "--pprof-addr="+o.PprofAddr)
 	}
-	_, portStr, _ := net.SplitHostPort(o.PprofAddr)
-	port, _ := strconv.Atoi(portStr)
-	if port < 1 || port > 65535 {
+	_, portStr, err := net.SplitHostPort(o.PprofAddr)
+	if err != nil {
+		return corev1.ContainerPort{}, false
+	}
+	port, err := strconv.Atoi(portStr)
+	if err != nil || port < 1 || port > 65535 || port == 9000 {
 		return corev1.ContainerPort{}, false
 	}

As per coding guidelines, **/*.go: “Always check errors — don’t ignore them.” As per path instructions, Go security requires “Never ignore error returns.”

Also applies to: 941-945

🤖 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 `@cmd/install/assets/hypershift_operator.go` around lines 775 - 777, The pprof
flag assembly currently allows an address that conflicts with existing operator
listeners, so add a reserved-port validation for o.PprofAddr that rejects values
colliding with metrics/listener ports before appending "--pprof-addr" in the
installer flow. Mirror the same check in the safety-net parser path that handles
pprof address parsing, and make sure any address-parse errors are returned or
handled instead of being ignored.

Sources: Coding guidelines, Path instructions

@Ajpantuso
Ajpantuso force-pushed the apantuso/ROSAENG-60642 branch from 415d103 to ccbf829 Compare June 27, 2026 18:20
@Ajpantuso
Ajpantuso marked this pull request as ready for review June 27, 2026 18:37
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 27, 2026
@openshift-ci
openshift-ci Bot requested review from cblecker and muraee June 27, 2026 18:37
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 1, 2026
@Ajpantuso
Ajpantuso force-pushed the apantuso/ROSAENG-60642 branch from ccbf829 to 84185e0 Compare July 2, 2026 13:20
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 2, 2026
@cblecker

cblecker commented Jul 3, 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 Jul 3, 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

@hypershift-jira-solve-ci

Copy link
Copy Markdown
Contributor

AI Test Failure Analysis

Job: pull-ci-openshift-hypershift-main-e2e-aws | Build: 2073179697620979712 | Cost: $2.9962162500000007 | Failed step: hypershift-aws-run-e2e-nested

View full analysis report


Generated by hypershift-analyze-e2e-failure post-step using Claude claude-opus-4-6

@Ajpantuso

Copy link
Copy Markdown
Contributor Author

/retest-required

@Ajpantuso
Ajpantuso force-pushed the apantuso/ROSAENG-60642 branch from 84185e0 to ebd4865 Compare July 13, 2026 12:35
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Jul 13, 2026
@openshift-ci

openshift-ci Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai coderabbitai Bot 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)
cmd/install/assets/hypershift_operator.go (1)

976-977: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use named constants for the port bounds.

Replace 1 and 65535 with named constants so the validation rules are self-documenting and consistent across the installer and safety-net parser. As per coding guidelines, Go code should avoid magic numbers.

🤖 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 `@cmd/install/assets/hypershift_operator.go` around lines 976 - 977, Update the
port validation in the strconv.Atoi parsing flow to replace the literal bounds 1
and 65535 with named constants. Define or reuse shared constants representing
the minimum and maximum valid port values so the installer and safety-net parser
use the same validation rules.

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.

Inline comments:
In `@cmd/install/assets/hypershift_operator.go`:
- Around line 965-985: Update the pprof address validation used by buildArgs and
HyperShiftOperatorDeployment.pprofContainerPort to reject port 9000, matching
the fixed metrics listener configured by --metrics-addr=:9000. Preserve existing
empty, parse-error, and out-of-range rejection behavior while ensuring the
helper also returns false for the reserved metrics port.

---

Nitpick comments:
In `@cmd/install/assets/hypershift_operator.go`:
- Around line 976-977: Update the port validation in the strconv.Atoi parsing
flow to replace the literal bounds 1 and 65535 with named constants. Define or
reuse shared constants representing the minimum and maximum valid port values so
the installer and safety-net parser use the same validation rules.
🪄 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: a1b12ea6-45bb-457d-9a9f-f5a860b5b879

📥 Commits

Reviewing files that changed from the base of the PR and between 84185e0 and ebd4865.

📒 Files selected for processing (5)
  • cmd/install/assets/hypershift_operator.go
  • cmd/install/assets/hypershift_operator_test.go
  • cmd/install/install.go
  • cmd/install/install_test.go
  • hypershift-operator/main.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • cmd/install/assets/hypershift_operator_test.go
  • hypershift-operator/main.go
  • cmd/install/install_test.go
  • cmd/install/install.go

Comment on lines +965 to +985
// pprofContainerPort parses o.PprofAddr and returns the corresponding
// ContainerPort when the address is non-empty and valid. The installer
// validates the address before Build is called, so errors here are a safety net.
func (o HyperShiftOperatorDeployment) pprofContainerPort() (corev1.ContainerPort, bool) {
if o.PprofAddr == "" {
return corev1.ContainerPort{}, false
}
_, portStr, err := net.SplitHostPort(o.PprofAddr)
if err != nil {
return corev1.ContainerPort{}, false
}
port, err := strconv.Atoi(portStr)
if err != nil || port < 1 || port > 65535 {
return corev1.ContainerPort{}, false
}
return corev1.ContainerPort{
Name: "pprof",
ContainerPort: int32(port),
Protocol: corev1.ProtocolTCP,
}, true
}

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.

🩺 Stability & Availability | 🟠 Major

Still reject pprof addresses that collide with the metrics listener.

buildArgs() always passes --metrics-addr=:9000 at Line [794], but this helper accepts :9000; the operator can then fail when both listeners bind the same port. Reject the reserved metrics port in both installer validation and this safety-net helper. The prior parse-error concern is fixed, but this collision remains unresolved.

🧰 Tools
🪛 ast-grep (0.44.1)

[warning] 981-981: Narrowing a non-constant integer to a smaller fixed-width type (int8/int16/int32, uint8/uint16/uint32) can silently overflow or wrap, yielding negative or truncated values that are dangerous in size, length, or index logic. Validate the source value is within the target type's range before converting (e.g. bounds-check, or use a checked helper), and avoid narrowing untrusted or len()/parsed values.
Context: int32(port)
Note: [CWE-190] Integer Overflow or Wraparound.

(integer-overflow-narrowing-conversion-go)

🤖 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 `@cmd/install/assets/hypershift_operator.go` around lines 965 - 985, Update the
pprof address validation used by buildArgs and
HyperShiftOperatorDeployment.pprofContainerPort to reject port 9000, matching
the fixed metrics listener configured by --metrics-addr=:9000. Preserve existing
empty, parse-error, and out-of-range rejection behavior while ensuring the
helper also returns false for the reserved metrics port.

@cblecker

Copy link
Copy Markdown
Member

/lgtm
@CodeRabbit resume

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

@cblecker Resuming automatic reviews on this PR.

✅ Action performed

Reviews resumed.

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

@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 `@cmd/install/assets/hypershift_operator.go`:
- Around line 729-733: Update the shared pprof port validation used by
pprofContainerPort() to reject port 9000, matching the installer validator and
the fixed --metrics-addr=:9000 configuration in buildArgs(). Ensure invalid
:9000 input does not add a container port or propagate pprof arguments, while
preserving existing behavior for valid pprof ports.
🪄 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: 22eb46d1-f0e6-4f0e-b1ca-e69933b69bac

📥 Commits

Reviewing files that changed from the base of the PR and between 84185e0 and ebd4865.

📒 Files selected for processing (5)
  • cmd/install/assets/hypershift_operator.go
  • cmd/install/assets/hypershift_operator_test.go
  • cmd/install/install.go
  • cmd/install/install_test.go
  • hypershift-operator/main.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • hypershift-operator/main.go
  • cmd/install/install_test.go
  • cmd/install/install.go
  • cmd/install/assets/hypershift_operator_test.go

Comment on lines +729 to +733
if port, ok := o.pprofContainerPort(); ok {
deployment.Spec.Template.Spec.Containers[0].Ports = append(
deployment.Spec.Template.Spec.Containers[0].Ports, port,
)
}

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.

🩺 Stability & Availability | 🟠 Major

Reject pprof port 9000 in the shared validation helper.

buildArgs() always passes --metrics-addr=:9000 at Line [794], but pprofContainerPort() accepts :9000; both deployment generation and argument propagation then configure conflicting listeners, causing operator startup failure when upstream validation is bypassed. Reject the reserved metrics port here and keep the installer validator aligned.

Suggested fix
-	if err != nil || port < 1 || port > 65535 {
+	if err != nil || port < 1 || port > 65535 || port == 9000 {

Also applies to: 806-808, 965-986

🤖 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 `@cmd/install/assets/hypershift_operator.go` around lines 729 - 733, Update the
shared pprof port validation used by pprofContainerPort() to reject port 9000,
matching the installer validator and the fixed --metrics-addr=:9000
configuration in buildArgs(). Ensure invalid :9000 input does not add a
container port or propagate pprof arguments, while preserving existing behavior
for valid pprof ports.

@Ajpantuso

Copy link
Copy Markdown
Contributor Author

/retest-required

@hypershift-jira-solve-ci

Copy link
Copy Markdown
Contributor

All 4 background agents have now completed. Their findings are fully consistent with the report I already delivered above. The e2e-aks agent confirmed the AKS failures were caused by management cluster resource exhaustion (pods stuck Pending with 0/16 nodes available: 12 Too many pods, 3 Insufficient memory), which corroborates the infrastructure flake diagnosis. No changes needed to the report.


@Ajpantuso

Copy link
Copy Markdown
Contributor Author

/retest-required

1 similar comment
@Ajpantuso

Copy link
Copy Markdown
Contributor Author

/retest-required

…HyperShift Operator

Add an installer option to conditionally configure the Go pprof
profiling server on the HyperShift Operator. When set, the installer
passes --pprof-addr to the operator binary and adds the corresponding
container port to the Deployment. The pprof endpoint is not exposed
via a Service.

The installer validates the address format and port range before
generating manifests so that invalid values fail early rather than
after deployment.

Ref: ROSAENG-60642

Signed-off-by: Andrew Pantuso <apantuso@redhat.com>
@Ajpantuso
Ajpantuso force-pushed the apantuso/ROSAENG-60642 branch from ebd4865 to 14339aa Compare August 4, 2026 18:34
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 4, 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.

♻️ Duplicate comments (1)
cmd/install/assets/hypershift_operator.go (1)

729-733: 🩺 Stability & Availability | 🟠 Major

Reject pprof addresses that reuse operator listener ports.

buildArgs() always passes --metrics-addr=:9000, but pprofContainerPort() accepts :9000. Build() then adds a pprof port and passes a second listener on port 9000. The operator can fail with address already in use.

Reject port 9000 in the shared helper. Add a regression test for :9000 that expects no pprof argument and no pprof container port. Use named constants for the metrics port and valid port bounds. Also verify whether the existing manager port 9443 is bound by the webhook server. If it is, reject that port when the listener is enabled.

#!/bin/bash
set -euo pipefail

rg -n -C 6 \
  'PprofBindAddress|WebhookServer|HealthProbeBindAddress|metrics-addr|health-probe|9443|9000' \
  --glob '*.go' \
  --glob '*.yaml' \
  --glob '*.yml' \
  .

As per coding guidelines, use named constants instead of magic numbers and run make lint-fix after the Go change.

Also applies to: 806-808, 965-986

🤖 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 `@cmd/install/assets/hypershift_operator.go` around lines 729 - 733, The shared
pprof address validation used by pprofContainerPort() must reject the metrics
port 9000, and reject 9443 when the webhook listener binds it. Define named
constants for the metrics port and valid port bounds, update validation
accordingly, and add regression coverage ensuring :9000 produces neither a pprof
argument nor container port; verify the webhook binding before applying the 9443
restriction, then run make lint-fix.

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.

Duplicate comments:
In `@cmd/install/assets/hypershift_operator.go`:
- Around line 729-733: The shared pprof address validation used by
pprofContainerPort() must reject the metrics port 9000, and reject 9443 when the
webhook listener binds it. Define named constants for the metrics port and valid
port bounds, update validation accordingly, and add regression coverage ensuring
:9000 produces neither a pprof argument nor container port; verify the webhook
binding before applying the 9443 restriction, then run make lint-fix.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 51c80537-e445-40d2-bc49-f72f14273bc1

📥 Commits

Reviewing files that changed from the base of the PR and between ebd4865 and 14339aa.

📒 Files selected for processing (4)
  • cmd/install/assets/hypershift_operator.go
  • cmd/install/assets/hypershift_operator_test.go
  • cmd/install/install.go
  • cmd/install/install_test.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • cmd/install/assets/hypershift_operator_test.go
  • cmd/install/install_test.go
  • cmd/install/install.go

@cblecker

cblecker commented Aug 7, 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 Aug 7, 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-kubevirt-aws-ovn-reduced
/test e2e-v2-aws
/test e2e-v2-azure-self-managed
/test e2e-v2-gke

@openshift-ci

openshift-ci Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Stale PRs are closed after 21d of inactivity.

If this PR is still relevant, comment to refresh it or remove the stale label.
Mark the PR as fresh by commenting /remove-lifecycle stale.

If this PR is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci Bot added lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Sep 7, 2026
@openshift-ci

openshift-ci Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

PR needs rebase.

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 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

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

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-4-22 14339aa link true /test e2e-aws-4-22
ci/prow/e2e-aws-upgrade-hypershift-operator 14339aa link true /test e2e-aws-upgrade-hypershift-operator
ci/prow/rosa-e2e-images 14339aa link true /test rosa-e2e-images

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.

@Ajpantuso Ajpantuso closed this Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cli Indicates the PR includes changes for CLI area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release 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. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants