Skip to content

OCPBUGS-98462: add jitter to AWS endpoint service requeue delay#8996

Open
jparrill wants to merge 1 commit into
openshift:mainfrom
jparrill:OCPBUGS-98462
Open

OCPBUGS-98462: add jitter to AWS endpoint service requeue delay#8996
jparrill wants to merge 1 commit into
openshift:mainfrom
jparrill:OCPBUGS-98462

Conversation

@jparrill

@jparrill jparrill commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace fixed 20s requeue delay with 15s base + random 1-10s jitter in the AWS endpoint service controller

Fixes

Root Cause

When 14+ HostedClusters are created in parallel (as in e2e-aws-ovn), their AWS endpoint service controllers all call Route53 ChangeResourceRecordSets simultaneously. On failure (typically NLB not yet active), all controllers requeued after a fixed 20s — retrying at the exact same instant and sustaining Route53 API throttling (Throttling: Rate exceeded).

Frequency

Searched 40 builds of periodic-ci-openshift-hypershift-release-5.0-periodics-e2e-aws-ovn (29 failures total):

  • 1/29 failures (3.4%) had Route53 throttling as the root cause
  • The single affected run (2075226710403452928, Jul 9) had 4 HCs stuck with AWSEndpointAvailable=False and 9 test failures
  • Low frequency but the fix is safe, minimal, and consistent with AWS best practices for throttle mitigation

Existing throttle handling

The CPO-side awsprivatelink controller already handles throttling with a 2min backoff (throttleRequeueDelay, line 61 of control-plane-operator/controllers/awsprivatelink/awsprivatelink_controller.go). This fix targets the HO-side endpoint service controller where the fixed 20s delay caused synchronized retries across all HCs.

Changes

Before After
lbNotActiveRequeueDuration = 20s (fixed, all controllers retry simultaneously) lbNotActiveRequeueBase = 15s + rand(1-10s) jitter (16-25s range, desynchronized)
log.Info("retrying in 20s") log.Info("retrying with jitter", "requeueAfter", requeueAfter)

Test plan

  • go build passes
  • Observe e2e-aws-ovn periodic — Route53 throttling should no longer cascade across HCs

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved retry timing when an AWS load balancer is not yet active by adding randomized delays.
    • Enhanced retry logs to show the scheduled retry duration.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 150c322b-848f-4d97-a37a-b6bb5813b228

📥 Commits

Reviewing files that changed from the base of the PR and between aa06faa and 3c86439.

📒 Files selected for processing (1)
  • hypershift-operator/controllers/platform/aws/controller.go

📝 Walkthrough

Walkthrough

The AWS endpoint controller replaces the fixed 20-second retry interval used when the network load balancer is inactive with a randomized delay. New base and jitter constants define the delay calculation, and retry logs now report the computed requeue duration.

Suggested reviewers: ironcladlou, sdminonne

🚥 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 accurately summarizes the main change: adding jitter to the AWS endpoint service requeue delay.
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 PR changes only controller.go; no *_test.go files or Ginkgo titles were added or modified.
Test Structure And Quality ✅ Passed PR only changes controller.go; no Ginkgo tests were added or modified, so the test-quality check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed Only retry backoff in aws controller changed; no pod topology, node selector, affinity, toleration, or replica settings were introduced.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Only controller.go changed; no Ginkgo e2e tests were added, so there are no IPv4 or external-connectivity assumptions to review.
No-Weak-Crypto ✅ Passed The PR only adds jittered requeue timing via math/rand; no MD5/SHA1/DES/RC4/3DES, custom crypto, or secret comparisons were introduced.
Container-Privileges ✅ Passed PR only changes a Go controller; diff contains no container/K8s manifest updates and no privileged settings like hostNetwork, privileged, or allowPrivilegeEscalation.
No-Sensitive-Data-In-Logs ✅ Passed PASS: The retry log only adds a jitter duration and reuses the existing error field; it doesn’t log secrets, PII, hostnames, or customer data.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@jparrill jparrill changed the title fix(OCPBUGS-98462): add jitter to AWS endpoint service requeue delay OCPBUGS-98462: add jitter to AWS endpoint service requeue delay Jul 14, 2026
@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Jul 14, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@jparrill: This pull request references Jira Issue OCPBUGS-98462, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Summary

  • Replace fixed 20s requeue delay with 15s base + random 1-10s jitter in the AWS endpoint service controller

Fixes

Root Cause

When 14+ HostedClusters are created in parallel (as in e2e-aws-ovn), their AWS endpoint service controllers all call Route53 ChangeResourceRecordSets simultaneously. On failure (typically NLB not yet active), all controllers requeued after a fixed 20s — retrying at the exact same instant and sustaining Route53 API throttling (Throttling: Rate exceeded).

Evidence from build 2075226710403452928 (Jul 9): 4 HCs hit AWSEndpointAvailable=False with Route53 throttling, causing DNS resolution failures and node readiness timeouts. 1/40 builds affected.

Changes

Before After
RequeueAfter: 20s (fixed, all controllers retry simultaneously) RequeueAfter: 15s + rand(1-10s) (16-25s range, desynchronized)

The existing throttle-specific handler in the CPO awsprivatelink controller (2min backoff, line 537) is unchanged — this fix targets the HO-side endpoint service controller where the fixed 20s delay caused synchronized retries.

Test plan

  • go build passes
  • Observe e2e-aws-ovn periodic — Route53 throttling should no longer cascade across HCs

🤖 Generated with Claude Code

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

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jparrill

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 requested review from ironcladlou and sdminonne July 14, 2026 10:14
@openshift-ci-robot

Copy link
Copy Markdown

@jparrill: This pull request references Jira Issue OCPBUGS-98462, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

Summary

  • Replace fixed 20s requeue delay with 15s base + random 1-10s jitter in the AWS endpoint service controller

Fixes

Root Cause

When 14+ HostedClusters are created in parallel (as in e2e-aws-ovn), their AWS endpoint service controllers all call Route53 ChangeResourceRecordSets simultaneously. On failure (typically NLB not yet active), all controllers requeued after a fixed 20s — retrying at the exact same instant and sustaining Route53 API throttling (Throttling: Rate exceeded).

Evidence from build 2075226710403452928 (Jul 9): 4 HCs hit AWSEndpointAvailable=False with Route53 throttling, causing DNS resolution failures and node readiness timeouts. 1/40 builds affected.

Changes

Before After
RequeueAfter: 20s (fixed, all controllers retry simultaneously) RequeueAfter: 15s + rand(1-10s) (16-25s range, desynchronized)

The existing throttle-specific handler in the CPO awsprivatelink controller (2min backoff, line 537) is unchanged — this fix targets the HO-side endpoint service controller where the fixed 20s delay caused synchronized retries.

Test plan

  • go build passes
  • Observe e2e-aws-ovn periodic — Route53 throttling should no longer cascade across HCs

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
  • Improved retry timing while waiting for AWS network load balancers to become active.
  • Added randomized retry delays to reduce repeated retry collisions and improve reconciliation behavior.
  • Retry logs now include the next scheduled retry duration.

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 area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release approved Indicates a PR has been approved by an approver from all required OWNERS files. area/platform/aws PR/issue for AWS (AWSPlatform) platform and removed do-not-merge/needs-area labels Jul 14, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
hypershift-operator/controllers/platform/aws/controller.go (1)

359-361: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add a bounded retry-jitter test.

Please add or extend the controller tests to exercise this error path and assert that RequeueAfter remains within the documented 16–25 second range, without asserting one exact random value.

🤖 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/platform/aws/controller.go` around lines 359
- 361, Add a controller test covering the reconciliation error path that logs
“reconciliation failed, retrying with jitter” and returns RequeueAfter. Execute
the path and assert the result stays within the documented 16–25 second
inclusive range, checking bounds rather than an exact random value; reuse
existing test fixtures and symbols for the AWS controller reconciliation flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@hypershift-operator/controllers/platform/aws/controller.go`:
- Around line 359-361: Add a controller test covering the reconciliation error
path that logs “reconciliation failed, retrying with jitter” and returns
RequeueAfter. Execute the path and assert the result stays within the documented
16–25 second inclusive range, checking bounds rather than an exact random value;
reuse existing test fixtures and symbols for the AWS controller reconciliation
flow.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: c7817516-3d1d-4792-b165-a4ef1d77f5cf

📥 Commits

Reviewing files that changed from the base of the PR and between d241190 and aa06faa.

📒 Files selected for processing (1)
  • hypershift-operator/controllers/platform/aws/controller.go

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.80%. Comparing base (d241190) to head (3c86439).
⚠️ Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
...ft-operator/controllers/platform/aws/controller.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8996      +/-   ##
==========================================
- Coverage   43.80%   43.80%   -0.01%     
==========================================
  Files         772      772              
  Lines       96100    96101       +1     
==========================================
  Hits        42097    42097              
- Misses      51084    51085       +1     
  Partials     2919     2919              
Files with missing lines Coverage Δ
...ft-operator/controllers/platform/aws/controller.go 41.31% <0.00%> (-0.07%) ⬇️
Flag Coverage Δ
cmd-support 37.45% <ø> (ø)
cpo-hostedcontrolplane 45.90% <ø> (ø)
cpo-other 45.13% <ø> (ø)
hypershift-operator 54.06% <0.00%> (-0.01%) ⬇️
other 32.12% <ø> (ø)

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.

When multiple HostedClusters are created in parallel, their AWS
endpoint service controllers all hit Route53 ChangeResourceRecordSets
simultaneously. On failure (e.g. NLB not yet active), all controllers
requeued after a fixed 20s, retrying at the same instant and
potentially sustaining API throttling.

Replace the fixed 20s requeue with 15s base + random 1-10s jitter so
concurrent controllers desynchronize their retries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Juan Manuel Parrilla Madrid <jparrill@redhat.com>
@jparrill

Copy link
Copy Markdown
Contributor Author

/label acknowledge-critical-fixes-only

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

openshift-ci Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

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

@ironcladlou

Copy link
Copy Markdown
Contributor

Nice, thanks

/lgtm

@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

@hypershift-jira-solve-ci

Copy link
Copy Markdown
Contributor

Test Failure Analysis Complete

Job Information

Test Failure Analysis

Error

codecov/patch — 0.00% of diff hit (target 43.80%)
3 relevant lines in hypershift-operator/controllers/platform/aws/controller.go not covered by tests.

Summary

The codecov/patch check failed because none of the 3 new executable lines introduced by the PR are exercised by unit tests. The PR adds jitter to the AWS endpoint service requeue delay (replacing a fixed 20-second constant with a 15s base + random 1–10s jitter) to prevent thundering-herd retries. All 3 modified lines reside inside an error-handling branch (if err != nil) within the Reconcile method, and no existing tests exercise this failure path.

Root Cause

The codecov/patch failure is caused by zero test coverage on the modified lines in the error-requeue path of reconcileAWSEndpointService. Specifically:

  1. Line ~357: requeueAfter := lbNotActiveRequeueBase + time.Duration(rand.Intn(lbNotActiveJitterMax)+1)*time.Second — the new jitter calculation is not exercised by any test.
  2. Line ~358: log.Info("reconciliation failed, retrying with jitter", ...) — the updated log statement is not covered.
  3. Line ~359: return ctrl.Result{RequeueAfter: requeueAfter}, nil — the return with jittered duration is not covered.

These lines are inside an if err != nil branch that triggers when reconcileAWSEndpointService returns an error (e.g., NLB not yet active). No existing unit test mocks the full AWS reconciliation loop to trigger this error path, so codecov reports 0% patch coverage against the 43.80% target.

This is a false positive / acceptable coverage gap. The change is a 3-line operational improvement with minimal risk. Writing a unit test would require mocking the entire AWS reconciliation stack to trigger the error branch, which is disproportionate effort for a simple jitter addition. The repo's overall coverage is already low (43.80% target), and this is a well-understood error-requeue pattern.

Recommendations
  1. Dismiss the codecov/patch failure — This is a low-risk operational change (adding jitter to a requeue delay) that does not warrant new test infrastructure. A maintainer can override the check.
  2. No code changes needed — The PR is correct as-is. The jitter logic (15s base + rand(1–10)s) is straightforward and well-understood.
  3. Optional future improvement — If coverage of the error-requeue path is desired long-term, consider adding a unit test that mocks reconcileAWSEndpointService to return an error and asserts that the returned ctrl.Result.RequeueAfter falls within the expected range (16s–25s). This is not blocking for this PR.
Evidence
Evidence Detail
Failing check codecov/patch — 0.00% of diff hit (target 43.80%)
Changed file hypershift-operator/controllers/platform/aws/controller.go
Diff size 6 additions, 3 deletions
Uncovered lines 3 executable lines inside if err != nil error-handling branch
Nature of change Replace fixed 20s requeue with 15s base + 1–10s random jitter
Coverage target 43.80% patch coverage required
Verdict False positive — low-risk operational change, acceptable to override

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

Labels

acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. approved Indicates a PR has been approved by an approver from all required OWNERS files. area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release area/platform/aws PR/issue for AWS (AWSPlatform) platform jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants