Skip to content

Stabilize Amphora serial LB tests: per-spec teardown and sourceRanges wait fix - #320

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
tusharjadhav3302:amphora-isolated-per-spec-teardown
Sep 22, 2026
Merged

openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
tusharjadhav3302:amphora-isolated-per-spec-teardown

Conversation

@tusharjadhav3302

@tusharjadhav3302 tusharjadhav3302 commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Serial Amphora [lb] specs can leave Octavia LBs behind between Its, which under max-shared-lb / amphora capacity pressure contributes to ensure-LB timeouts in osp_verification.
  • Register Amphora-only DeferCleanup for the create, ETP:Local+monitors, and UDP sourceRanges Its (delete Service + cascade-delete Octavia LB if it remains). Registered before CreateLoadBalancerService so a timed-out ensure still cleans up. OVN / other [lb] specs unchanged.
  • Fix lbProviderUnderTest == "amphora" case mismatch (EqualFold) so Amphora actually waits for listener allowed_cidrs → 0.0.0.0/0 after clearing loadBalancerSourceRanges (previously took the OVN 30s sleep path). On post-open UDP failure, dump listener ACL / LB / pool / member state and a sourceRanges_diag_verdict.

Test plan

  • Review Amphora-gated teardown limited to the three Its above
  • CI: build / images / test / verify (pre-squash; re-check after squash)
  • serval71: combined with shiftstack-qa PR #41 — late sourceRanges phase PASS (ACL allow-all ~2s); teardown helpers present in binary

Related

  • Complements shiftstack/shiftstack-qa#41 (late Amphora sourceRanges phase under less OCCM contention). Does not fix OCCM allow-all stall under heavy load; improves wait correctness and leftover LB hygiene.

@tusharjadhav3302
tusharjadhav3302 force-pushed the amphora-isolated-per-spec-teardown branch from 94a3bbf to bd44dc7 Compare September 21, 2026 07:22
@tusharjadhav3302 tusharjadhav3302 changed the title Add Amphora-only per-spec teardown for serial LB tests Stabilize Amphora serial LB tests: per-spec teardown and sourceRanges wait fix Sep 21, 2026

@winiciusallan winiciusallan left a comment

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.

I agree that we should try to cleanup resources to avoid leaving behind something. I left a few suggestions inline, but I believe we should try to follow the code pattern -- use more methods from the ginkgo framework when logging and making assertions. These applies throughout all the changes.

jig.Labels = labels
// Amphora LBs are costly (slots / max-shared-lb). Register before create so a
// timed-out ensure still tears down any partial Octavia LB for the next serial [lb] case.
registerAmphoraLoadBalancerTeardown(loadBalancerClient, clientSet, oc.Namespace(), svcName, lbProviderUnderTest)

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.

Wouldn't be better to register the function within BeforeEach since it's conditionally cleans up when the driver is amphora?

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.

The cleanup stays registered inside the three Its (create, ETP:Local+monitors, and UDP sourceRanges), and it is registered before CreateLoadBalancerService so a timed-out ensure still deletes a partial load balancer. BeforeEach would run for every spec in the provider/protocol loop, including OVN and the Amphora cases we are not changing. The service name is also different in each It. The Amphora check already lives in registerAmphoraLoadBalancerTeardown.

if delErr := clientSet.CoreV1().Services(namespace).Delete(ctx, svcName, metav1.DeleteOptions{}); delErr != nil && !apierrors.IsNotFound(delErr) {
e2e.Logf("Teardown: error deleting service %s/%s: %v", namespace, svcName, delErr)
}
} else if !apierrors.IsNotFound(err) {

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.

I would guard for whatever error this function would return. So I think you can use

o.Expect(err).NotTo(o.HaveOccurred(), fmt.Sprintf("Teardown: error getting service %s/%s: %v", namespace, svcName, err))

This would give us a better error message. This should apply for other error references.

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.

These errors stay as logs. DeferCleanup runs after the spec, so an Expect on Get or Delete would fail a passing spec on a transient API error, or cover the original timeout when the spec already failed. NotFound is expected when the Service never got a load balancer. The UDP diagnostic dump is log-only for the same reason: it runs after the connectivity assert has already failed, and an Expect there would stop the snapshot before sourceRanges_diag_verdict is printed.

Comment on lines +851 to +852
deadline := time.Now().Add(3 * time.Minute)
for time.Now().Before(deadline) {

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.

for a retry mechanism, I think you can use the Eventually method. There are some examples in this file.

@tusharjadhav3302
tusharjadhav3302 force-pushed the amphora-isolated-per-spec-teardown branch from bd44dc7 to bb9ebef Compare September 21, 2026 15:45
@tusharjadhav3302

Copy link
Copy Markdown
Contributor Author

/test test

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

one comment regarding IPv6 support.

// Wait until allowed_cidrs in the LB listener is updated to 0.0.0.0/0 (all traffic allowed)
if lbProviderUnderTest == "amphora" { // it only makes sense with Amphora
if isAmphoraProvider {
allowAllAllowedCidrs := []string{"0.0.0.0/0"}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could we derive allowAllAllowedCidrs from the service/VIP address family? For IPv6-primary dual-stack and single-stack IPv6 clusters, allowed_sourcerange is IPv6, but this assertion always waits for 0.0.0.0/0. That will cause the Amphora test to time out after clearing LoadBalancerSourceRanges please handle the IPv6 (and, if applicable, dual-stack) expected CIDRs here.

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.

Good catch. Updated the Amphora allow-all wait to derive the expected CIDR from the service VIP family: 0.0.0.0/0 for IPv4 and ::/0 for IPv6. The sourceRanges failure diagnostic uses the same rule when classifying allow-all. Squashed into tip 43b125a.

… fix

Register Amphora-only per-spec Service/Octavia cleanup for create,
ETP:Local+monitors, and UDP sourceRanges. Fix provider case mismatch so
Amphora waits for allowed_cidrs allow-all, and dump diagnostics on UDP
connectivity failure.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tusharjadhav3302
tusharjadhav3302 force-pushed the amphora-isolated-per-spec-teardown branch from bb9ebef to 43b125a Compare September 22, 2026 14:06
@winiciusallan

Copy link
Copy Markdown
Member

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Sep 22, 2026
@ekuris-redhat

Copy link
Copy Markdown

Looks legit to me. I think its ready to be merged after all gates are passed

@openshift-ci

openshift-ci Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

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

@winiciusallan

Copy link
Copy Markdown
Member

/approve

tests are passing and it looks like the teardown is also working. well done @tusharjadhav3302!

@openshift-ci

openshift-ci Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: winiciusallan

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

The pull request process is described here

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

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

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

Copy link
Copy Markdown
Member

/verified by CI

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Sep 22, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@winiciusallan: This PR has been marked as verified by CI.

Details

In response to this:

/verified by CI

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-merge-bot
openshift-merge-bot Bot merged commit fbfd8da into openshift:main Sep 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants