Skip to content

NE-2839: Add HAProxy version upgrade tests - #31495

Open
jcmoraisjr wants to merge 1 commit into
openshift:mainfrom
jcmoraisjr:NE-2839-haproxy-version-upgrade-tests
Open

NE-2839: Add HAProxy version upgrade tests#31495
jcmoraisjr wants to merge 1 commit into
openshift:mainfrom
jcmoraisjr:NE-2839-haproxy-version-upgrade-tests

Conversation

@jcmoraisjr

@jcmoraisjr jcmoraisjr commented Aug 7, 2026

Copy link
Copy Markdown
Member

The IngressControllerMultipleHAProxyVersions feature allows selecting HAProxy versions per IngressController. During y-stream upgrades (e.g. 4.22 to 5.0), the default HAProxy version may change (2.8 to 3.2). Two upgrade scenarios need validation:

  • Pinned version: an IngressController with an explicitly set HAProxyVersion must retain that version across any upgrade, regardless of default version changes.
  • Unset version: an IngressController with no HAProxyVersion set must follow the new release default after upgrade.

Both tests create a custom IngressController before upgrade, wait for the upgrade to complete, then verify the expected HAProxy version via both the IngressController status (EffectiveHAProxyVersion) and the HAProxy runtime socket.

Also refactors multi-haproxy.go to extract shared helpers (apiHasHAProxyVersionField, deleteAll) used by both the day-2 tests and the new upgrade tests.

https://redhat.atlassian.net/browse/NE-2839

Summary by CodeRabbit

  • Tests
    • Added upgrade coverage for HAProxy versions in both pinned and unpinned configurations.
    • Upgrade validation now confirms the effective HAProxy version in status information and through the runtime API.
    • Tests automatically detect supported platform capabilities and determine the default HAProxy version across compatible environments.
    • Improved test setup and cleanup for ingress controller resources.

The IngressControllerMultipleHAProxyVersions feature allows selecting
HAProxy versions per IngressController. During y-stream upgrades (e.g.
4.22 to 5.0), the default HAProxy version may change (2.8 to 3.2).
Two upgrade scenarios need validation:

- Pinned version: an IngressController with an explicitly set
  HAProxyVersion must retain that version across any upgrade,
  regardless of default version changes.
- Unset version: an IngressController with no HAProxyVersion set
  must follow the new release default after upgrade.

Both tests create a custom IngressController before upgrade, wait for
the upgrade to complete, then verify the expected HAProxy version via
both the IngressController status (EffectiveHAProxyVersion) and the
HAProxy runtime socket.

Also refactors multi-haproxy.go to extract shared helpers
(apiHasHAProxyVersionField, deleteAll) used by both the day-2 tests
and the new upgrade tests.

https://redhat.atlassian.net/browse/NE-2839

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@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: automatic 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 Aug 7, 2026
@openshift-ci-robot

openshift-ci-robot commented Aug 7, 2026

Copy link
Copy Markdown

@jcmoraisjr: This pull request references NE-2839 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:

The IngressControllerMultipleHAProxyVersions feature allows selecting HAProxy versions per IngressController. During y-stream upgrades (e.g. 4.22 to 5.0), the default HAProxy version may change (2.8 to 3.2). Two upgrade scenarios need validation:

  • Pinned version: an IngressController with an explicitly set HAProxyVersion must retain that version across any upgrade, regardless of default version changes.
  • Unset version: an IngressController with no HAProxyVersion set must follow the new release default after upgrade.

Both tests create a custom IngressController before upgrade, wait for the upgrade to complete, then verify the expected HAProxy version via both the IngressController status (EffectiveHAProxyVersion) and the HAProxy runtime socket.

Also refactors multi-haproxy.go to extract shared helpers (apiHasHAProxyVersionField, deleteAll) used by both the day-2 tests and the new upgrade tests.

https://redhat.atlassian.net/browse/NE-2839

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 requested review from deads2k and frobware August 7, 2026 19:37
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Walkthrough

The router upgrade suite adds pinned and unpinned HAProxy version tests. It detects API support, validates status and runtime versions after upgrade, derives the default version, and uses shared CRD detection and cleanup helpers.

Changes

HAProxy version upgrade testing

Layer / File(s) Summary
Router test helpers
test/extended/router/multi-haproxy.go
The router tests use shared cleanup for tracked IngressControllers. CRD schema detection now returns whether spec.haproxyVersion exists and propagates client or retrieval errors.
HAProxy upgrade validation
test/extended/router/haproxyversion_upgrade.go
HAProxyVersionUpgradeTest supports pinned and unset-version scenarios. It checks API support, creates the IngressController, derives the expected version, validates status and runtime API versions, and deletes the resource during teardown.
Upgrade suite registration
test/e2e/upgrade/upgrade.go
AllTests includes separate pinned and unpinned HAProxy version upgrade test instances.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant HAProxyVersionUpgradeTest
  participant UpgradeFramework
  participant IngressController
  participant HAProxyRuntimeAPI
  HAProxyVersionUpgradeTest->>UpgradeFramework: wait for upgrade completion
  HAProxyVersionUpgradeTest->>IngressController: read effective HAProxy version
  HAProxyVersionUpgradeTest->>HAProxyRuntimeAPI: verify runtime version
  HAProxyVersionUpgradeTest->>IngressController: delete test resource
Loading

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Microshift Test Compatibility ⚠️ Warning New upgrade tests are registered in AllTests, use operator.openshift.io IngressControllers, and wait for a cluster upgrade; only the available route tag is present, with no MicroShift guard. Add [apigroup:operator.openshift.io] or [Skipped:MicroShift], or run /payload-job periodic-ci-openshift-microshift-release-4.22-periodics-e2e-aws-ovn-ocp-conformance.
No-Weak-Crypto ❓ Inconclusive Investigation is still in progress; no verdict has been submitted for the code yet. Inspect the changed Go files and their crypto-related calls before deciding.
✅ Passed checks (13 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 describes the main change: adding HAProxy version upgrade tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 All Ginkgo titles and upgrade Name/DisplayName values are static; dynamic IngressController names occur only in g.By steps and runtime assertions.
Test Structure And Quality ✅ Passed Upgrade tests use Setup/Teardown, track IngressControllers for cleanup, bound waits to 2 or 15 minutes, and give new assertions diagnostic messages while validating one HAProxy behavior.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The new upgrade tests use one IngressController replica and only validate API status and HAProxy socket output; no multi-node, HA, affinity, node, or topology assumptions are present.
Topology-Aware Scheduling Compatibility ✅ Passed The commit adds and refactors only Go end-to-end tests and helpers; it adds no manifests, controllers, affinity, topology spread, node selectors, tolerations, or PDB scheduling constraints.
Ote Binary Stdout Contract ✅ Passed Changed code has no direct stdout writes or init/suite output. New logs use g.By/framework.Logf, which write to GinkgoWriter; existing klog call was not changed.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The added upgrade tests use only cluster APIs and an in-cluster HAProxy runtime socket; no IPv4 literals, IP parsing, public endpoints, external URLs, or public registry access appear.
Container-Privileges ✅ Passed The patch changes only Go test code and creates an IngressController resource; it adds no privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, root, or allowPrivilegeEscalation settings.
No-Sensitive-Data-In-Logs ✅ Passed Added logs contain HAProxy versions, generated IngressController names, and generic errors; no passwords, tokens, API keys, PII, session IDs, or customer data are logged.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

❤️ Share

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

@openshift-ci

openshift-ci Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@test/extended/router/haproxyversion_upgrade.go`:
- Around line 143-151: The Teardown cleanup in
test/extended/router/haproxyversion_upgrade.go:143-151 and the corresponding
cleanup in test/extended/router/multi-haproxy.go:55-58 must use an uncancelable
base context with a bounded timeout when calling controllers.deleteAll, rather
than the canceled test context; preserve the existing resource checks and error
logging.
🪄 Autofix

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: Pro Plus

Run ID: 36092e16-5729-4422-815b-dad8eebbcd3a

📥 Commits

Reviewing files that changed from the base of the PR and between ce6064a and 60d4a8f.

📒 Files selected for processing (3)
  • test/e2e/upgrade/upgrade.go
  • test/extended/router/haproxyversion_upgrade.go
  • test/extended/router/multi-haproxy.go

Comment on lines +143 to +151
func (h *HAProxyVersionUpgradeTest) Teardown(ctx context.Context, f *framework.Framework) {
if h.operatorClient == nil {
framework.Logf("Skipping cleanup because setup did not initialize test resources")
return
}
if err := h.controllers.deleteAll(ctx, h.operatorClient); err != nil {
framework.Logf("error deleting IngressController resource: %s", err.Error())
}
}

Copy link
Copy Markdown

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Verify that the declared toolchain supports context.WithoutCancel.
rg -n '^(go|toolchain) ' go.mod

# Inspect both cleanup call sites.
rg -n -C 5 'deleteAll\(' test/extended/router/multi-haproxy.go test/extended/router/haproxyversion_upgrade.go

Repository: openshift/origin

Length of output: 2816


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect imports and surrounding cleanup context usage in both test files.
for f in test/extended/router/multi-haproxy.go test/extended/router/haproxyversion_upgrade.go; do
  echo "===== $f ====="
  sed -n '1,90p' "$f"
  echo
done

# Search for IngressController deletion helpers and context use around cleanup.
rg -n -C 4 'deleteAll|i\.Delete\(|OperatorV1\(\)\.IngressControllers|context\.With|context\.Background|context\.Timeout|context\.WithoutCancel' test/extended/router test -g '*.go' | head -n 200

Repository: openshift/origin

Length of output: 21383


Use bounded cleanup contexts.

A canceled test context can make deleteAll fail before it sends deletion requests. Use an uncancelable cleanup base context with a timeout before calling deleteAll in both cleanup paths.

📍 Affects 2 files
  • test/extended/router/haproxyversion_upgrade.go#L143-L151 (this comment)
  • test/extended/router/multi-haproxy.go#L55-L58
🤖 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 `@test/extended/router/haproxyversion_upgrade.go` around lines 143 - 151, The
Teardown cleanup in test/extended/router/haproxyversion_upgrade.go:143-151 and
the corresponding cleanup in test/extended/router/multi-haproxy.go:55-58 must
use an uncancelable base context with a bounded timeout when calling
controllers.deleteAll, rather than the canceled test context; preserve the
existing resource checks and error logging.

Sources: Path instructions, Learnings

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aws-ovn-upgrade-rollback

@jcmoraisjr

Copy link
Copy Markdown
Member Author

/payload-job-with-prs ?

@openshift-ci

openshift-ci Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@jcmoraisjr: it appears that you have attempted to use some version of the payload command, but your comment was incorrectly formatted and cannot be acted upon. See the docs for usage info.

@jcmoraisjr

Copy link
Copy Markdown
Member Author

/payload-job-with-prs

@openshift-ci

openshift-ci Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@jcmoraisjr: it appears that you have attempted to use some version of the payload command, but your comment was incorrectly formatted and cannot be acted upon. See the docs for usage info.

@jcmoraisjr

Copy link
Copy Markdown
Member Author

/payload-job-with-prs periodic-ci-openshift-release-main-ci-5.0-upgrade-from-stable-4.22-e2e-aws-ovn-upgrade openshift/api#2971 openshift/cluster-ingress-operator#1545

@openshift-ci

openshift-ci Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@jcmoraisjr: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-ci-5.0-upgrade-from-stable-4.22-e2e-aws-ovn-upgrade

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/c80a2da0-92a7-11f1-9749-1b41a869f83d-0

@jcmoraisjr

Copy link
Copy Markdown
Member Author

/payload-job-with-prs periodic-ci-openshift-release-main-ci-5.0-e2e-aws-ovn-upgrade openshift/api#2971 openshift/cluster-ingress-operator#1545

@openshift-ci

openshift-ci Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@jcmoraisjr: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-ci-5.0-e2e-aws-ovn-upgrade

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/03588550-92a8-11f1-8016-b7673b47292e-0

@jcmoraisjr

Copy link
Copy Markdown
Member Author

/payload-job-with-prs periodic-ci-openshift-release-main-ci-4.22-e2e-aws-ovn-upgrade openshift/api#2971 openshift/cluster-ingress-operator#1545

@openshift-ci

openshift-ci Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@jcmoraisjr: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-ci-4.22-e2e-aws-ovn-upgrade

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/204e9d20-92a8-11f1-96af-9e21d2a7ed7f-0

@openshift-ci

openshift-ci Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

@jcmoraisjr: The following test 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-metal-ipi-ovn-ipv6 60d4a8f link true /test e2e-metal-ipi-ovn-ipv6

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-trt

openshift-trt Bot commented Aug 8, 2026

Copy link
Copy Markdown

Risk analysis has seen new tests most likely introduced by this PR.
Please ensure that new tests meet guidelines for naming and stability.

New tests seen in this PR at sha: 60d4a8f

  • "[sig-network-edge][Feature:Router][apigroup:route.openshift.io] Verify HAProxy pinned version state during upgrade" [Total: 2, Pass: 2, Fail: 0, Flake: 0]
  • "[sig-network-edge][Feature:Router][apigroup:route.openshift.io] Verify HAProxy unset version state during upgrade" [Total: 2, Pass: 2, Fail: 0, Flake: 0]

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

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants