Skip to content

THREESCALE-14653 Fix route watch cannot map events to APIManager when Zync is disabled#1176

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

THREESCALE-14653 Fix route watch cannot map events to APIManager when Zync is disabled#1176
urbanikb wants to merge 1 commit into3scale:masterfrom
urbanikb:THREESCALE-14653

Conversation

@urbanikb
Copy link
Copy Markdown
Contributor

@urbanikb urbanikb commented May 7, 2026

Summary

Fixes THREESCALE-14653

Note: This branch is based on the pending PR branch tkan145-go1.25 (Go 1.25 bump), not directly on master. The base will be updated once that PR is merged.

Root cause

The operator monitored routes by traversing the owner-reference chain from Route → Zync resource → APIManager. This chain breaks when Zync is disabled or when Zync is being deleted — theoretically Zync's deployment should carry a finalizer that holds deletion until its owned routes are cleaned up first, but that guarantee is not in place. The result is that route events cannot be mapped back to any APIManager, producing noisy not-found errors in the logs and leaving the availability status stale until the next unrelated reconcile event.

Solution

Replace the owner-reference chain mapper with a domain-name mapper that lists APIManagers in the namespace and matches by expected tenant route hosts. This approach is significantly more straightforward than adding a finalizer to the Zync deployment and is indifferent to who created the route — Zync-managed routes, manually-created routes, and routes created without the Zync label are all handled identically.

The label predicate (3scale.net/created-by=zync) that was initially considered as a watch filter was dropped because:

  • It would silently exclude manually-created routes, reintroducing the same symptom for customers who create routes by hand
  • It provides no memory benefit since predicates filter events after the informer cache is already populated

Changes

  • Replace APIManagerRoutesEventMapper (ownerRef chain) with ZyncRouteToAPIManagerMapper (domain-name matching)
  • Delete pkg/handlers/apimanager_managed_routes_event_mapper.go
  • Add integration test: delete a Zync-managed route, verify Available=False, recreate it manually without the Zync label, verify Available=True

Test plan

  • Unit tests: go test ./controllers/apps/... -run TestZyncRoute
  • Integration tests pass: make test-integration (verified locally)

🤖 Generated with Claude Code

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 7, 2026

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

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 7, 2026

Codecov Report

❌ Patch coverage is 60.00000% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.95%. Comparing base (4963add) to head (31d531b).
⚠️ Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
controllers/apps/apimanager_controller.go 0.00% 6 Missing ⚠️
...lers/apps/zync_route_to_apimanager_event_mapper.go 78.26% 3 Missing and 2 partials ⚠️
...rollers/capabilities/openapi_product_reconciler.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1176      +/-   ##
==========================================
+ Coverage   41.84%   43.95%   +2.10%     
==========================================
  Files         203      204       +1     
  Lines       20859    20911      +52     
==========================================
+ Hits         8729     9191     +462     
+ Misses      11350    10919     -431     
- Partials      780      801      +21     
Flag Coverage Δ
unit 43.95% <60.00%> (+2.10%) ⬆️

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

Components Coverage Δ
apis/apps/v1alpha1 (u) 63.19% <ø> (+4.64%) ⬆️
apis/capabilities/v1alpha1 (u) 3.50% <ø> (ø)
apis/capabilities/v1beta1 (u) 20.21% <ø> (ø)
controllers (i) 12.30% <81.57%> (+2.98%) ⬆️
pkg (u) 63.64% <81.73%> (+1.92%) ⬆️
Files with missing lines Coverage Δ
...rollers/capabilities/openapi_product_reconciler.go 22.72% <0.00%> (ø)
...lers/apps/zync_route_to_apimanager_event_mapper.go 78.26% <78.26%> (ø)
controllers/apps/apimanager_controller.go 10.11% <0.00%> (-0.10%) ⬇️

... 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.

@urbanikb urbanikb force-pushed the THREESCALE-14653 branch from 2fad081 to 31d531b Compare May 7, 2026 20:12
Replace the ownerRef-chain mapper (Route → Zync → APIManager) with a
domain-name mapper that lists APIManagers in the namespace and matches
by expected tenant route hosts. The ownerRef chain is broken when Zync
is disabled, causing noisy not-found errors and stale availability status.

The new mapper is indifferent to who created the route — Zync-managed
routes and manually-created routes are handled identically, avoiding the
need for callers to fake a Zync label just to get status updates.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@urbanikb urbanikb force-pushed the THREESCALE-14653 branch from 31d531b to 9a5ef41 Compare May 8, 2026 05:15
@urbanikb urbanikb marked this pull request as ready for review May 8, 2026 05:16
@urbanikb urbanikb requested a review from a team as a code owner May 8, 2026 05:16
@urbanikb urbanikb changed the title WIP: Fix route watch cannot map events to APIManager when Zync is disabled THREESCALE-14653 Fix route watch cannot map events to APIManager when Zync is disabled May 8, 2026
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