Skip to content

THREESCALE-14651 Fix HPA reconciler to skip API delete calls when HPA already absent#1175

Open
urbanikb wants to merge 1 commit into3scale:masterfrom
urbanikb:THREESCALE-14651
Open

THREESCALE-14651 Fix HPA reconciler to skip API delete calls when HPA already absent#1175
urbanikb wants to merge 1 commit into3scale:masterfrom
urbanikb:THREESCALE-14651

Conversation

@urbanikb
Copy link
Copy Markdown
Contributor

@urbanikb urbanikb commented May 7, 2026

Summary

Fixes THREESCALE-14651: once an HPA was successfully deleted, ReconcileHpa() was calling DeleteResource() directly on every subsequent reconcile cycle, hitting a 404 indefinitely.

  • Replace DeleteResource() with TagObjectToDelete + ReconcileResource, which does a cache-backed Get first and is a no-op when the object is already absent — consistent with how PDB and monitoring resources are handled
  • Affects all three HPA targets: backend-listener, backend-worker, apicast-production
  • Add table-driven tests covering enabled, disabled, and async-disable annotation scenarios for all three targets

Test plan

  • Unit tests pass (make test-unit)
  • Manually verified on fyre cluster: disabled all three HPAs via spec.backend.listenerSpec.hpa, spec.backend.workerSpec.hpa, spec.apicast.productionSpec.hpa — no repeated delete attempts in operator logs after HPAs removed

🤖 Generated with Claude Code

@urbanikb urbanikb requested a review from a team as a code owner May 7, 2026 17:41
@urbanikb urbanikb changed the title THREESCALE-14651 (THREESCALE-14224): Fix HPA reconciler to skip API delete calls when HPA already absent THREESCALE-14651: Fix HPA reconciler to skip API delete calls when HPA already absent May 8, 2026
@urbanikb urbanikb changed the title THREESCALE-14651: Fix HPA reconciler to skip API delete calls when HPA already absent THREESCALE-14651 Fix HPA reconciler to skip API delete calls when HPA already absent May 8, 2026
ReconcileHpa() was calling DeleteResource() directly when HPA is disabled,
which issues a Client().Delete() API call every reconcile cycle regardless
of whether the HPA exists. After the first successful delete, subsequent
cycles hit a 404 on every cycle indefinitely.

Replace with TagObjectToDelete + ReconcileResource, which does a
cache-backed Get first and is a no-op when the object is already gone.
This is consistent with how PDB and monitoring resources are handled.

Add table-driven tests covering all three HPA targets (backend-listener,
backend-worker, apicast-production) across enabled, disabled, and
async-disable annotation scenarios.

Related: THREESCALE-14224

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@urbanikb urbanikb force-pushed the THREESCALE-14651 branch from 286bd6d to d8fbaaf Compare May 8, 2026 05:15
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.03%. Comparing base (4963add) to head (d8fbaaf).
⚠️ Report is 18 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1175      +/-   ##
==========================================
+ Coverage   41.84%   44.03%   +2.18%     
==========================================
  Files         203      204       +1     
  Lines       20859    20923      +64     
==========================================
+ Hits         8729     9213     +484     
+ Misses      11350    10913     -437     
- Partials      780      797      +17     
Flag Coverage Δ
unit 44.03% <100.00%> (+2.18%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
apis/apps/v1alpha1 (u) 63.56% <ø> (+5.01%) ⬆️
apis/capabilities/v1alpha1 (u) 3.50% <ø> (ø)
apis/capabilities/v1beta1 (u) 20.21% <ø> (ø)
controllers (i) 12.08% <88.23%> (+2.76%) ⬆️
pkg (u) 63.75% <81.90%> (+2.03%) ⬆️
Files with missing lines Coverage Δ
...e/amp/operator/base_apimanager_logic_reconciler.go 56.80% <100.00%> (+4.17%) ⬆️

... and 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants