Skip to content

THREESCALE-14267 Add 3 status conditions; Use new status for requeue#1155

Open
urbanikb wants to merge 3 commits into3scale:masterfrom
urbanikb:THREESCALE-14267
Open

THREESCALE-14267 Add 3 status conditions; Use new status for requeue#1155
urbanikb wants to merge 3 commits into3scale:masterfrom
urbanikb:THREESCALE-14267

Conversation

@urbanikb
Copy link
Copy Markdown
Contributor

@urbanikb urbanikb commented Apr 6, 2026

Fix:

What

Previously, APIManager exposed a single Available condition that collapsed three independent system checks into one opaque signal. When Available=False there was no way to tell from the CR alone whether the problem was with deployments, routes, or secrets.

New conditions

Three independent sub-conditions are now present in .status.conditions:

Condition True when
DeploymentsAvailable All expected deployments have at least one available replica
RoutesReady All expected routes are admitted by the router
SecretsAvailable All externally-referenced secrets (Redis, database, custom policies, etc.) exist in the cluster

Available remains a roll-up: True if all above sub-conditions are True.

Change in status reporting

Before: On a broken install you would see:

  - type: Available
    status: "False"

After: The root cause is visible without inspecting cluster resources:

  - type: Available
    status: "False"
  - type: DeploymentsAvailable
    status: "False"
    reason: DeploymentsNotAvailable
    message: "The following deployment(s) are not available: backend-listener, backend-worker"
  - type: RoutesReady
    status: "True"
  - type: SecretsAvailable
    status: "True"

Backwards compatibility

The Available condition continues to surface Reason and Message from SecretsAvailable when secrets are missing, preserving existing automation that reads those fields from Available.

Verification

Tested that the status behaves as expected (namespace 3scale-abc below).

Also verified that if a different version of operator (earlier 2.16 from public bundle) is installed in a different namespace (namespace 3scale-parallel), it will be able to set status on the CR in that namespace.

borisurbanik@Boriss-MacBook-Pro 3scale-operator % oc get apimanager -n 3scale-parallel 3scale -o yaml | yq '.status.conditions'
- lastTransitionTime: "2026-04-08T14:52:05Z"
  status: "False"
  type: Available
- message: All requirements for the current version are met
  reason: PreflightsPass
  status: "True"
  type: Preflights
borisurbanik@Boriss-MacBook-Pro 3scale-operator % oc get apimanager -n 3scale-abc 3scale -o yaml | yq '.status.conditions'
- lastTransitionTime: "2026-04-08T14:55:50Z"
  status: "False"
  type: Available
- lastTransitionTime: "2026-04-08T14:55:50Z"
  message: 'The following deployment(s) are not available: apicast-staging, apicast-production, backend-listener, backend-worker, system-memcache, system-app, system-sidekiq, system-searchd, zync, zync-que, zync-database'
  reason: DeploymentsNotAvailable
  status: "False"
  type: DeploymentsAvailable
- lastTransitionTime: "2026-04-08T14:55:50Z"
  message: 'The following route(s) are not yet admitted: backend-3scale.apps.burbanik.cp.fyre.ibm.com, api-3scale-apicast-production.apps.burbanik.cp.fyre.ibm.com, api-3scale-apicast-staging.apps.burbanik.cp.fyre.ibm.com, master.apps.burbanik.cp.fyre.ibm.com, 3scale.apps.burbanik.cp.fyre.ibm.com, 3scale-admin.apps.burbanik.cp.fyre.ibm.com'
  reason: RoutesNotReady
  status: "False"
  type: RoutesReady
- lastTransitionTime: "2026-04-08T14:55:50Z"
  status: "True"
  type: SecretsAvailable
borisurbanik@Boriss-MacBook-Pro 3scale-operator % oc get apimanager -n 3scale-abc 3scale -o yaml | yq '.status.conditions'
- lastTransitionTime: "2026-04-08T14:55:50Z"
  status: "False"
  type: Available
- lastTransitionTime: "2026-04-08T15:02:33Z"
  status: "True"
  type: DeploymentsAvailable
- lastTransitionTime: "2026-04-08T14:55:50Z"
  message: 'The following route(s) are not yet admitted: backend-3scale.apps.burbanik.cp.fyre.ibm.com'
  reason: RoutesNotReady
  status: "False"
  type: RoutesReady
- lastTransitionTime: "2026-04-08T14:55:50Z"
  status: "True"
  type: SecretsAvailable
borisurbanik@Boriss-MacBook-Pro 3scale-operator % oc get apimanager -n 3scale-parallel 3scale -o yaml | yq '.status.conditions'
- lastTransitionTime: "2026-04-08T14:52:05Z"
  status: "False"
  type: Available
- message: All requirements for the current version are met
  reason: PreflightsPass
  status: "True"
  type: Preflights
borisurbanik@Boriss-MacBook-Pro 3scale-operator % oc get apimanager -n 3scale-parallel 3scale -o yaml | yq '.status.conditions'
- lastTransitionTime: "2026-04-08T16:08:24Z"
  status: "True"
  type: Available
- message: All requirements for the current version are met
  reason: PreflightsPass
  status: "True"
  type: Preflights

@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 6, 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 Apr 6, 2026

Codecov Report

❌ Patch coverage is 8.16327% with 90 lines in your changes missing coverage. Please review.
✅ Project coverage is 42.57%. Comparing base (4e62f84) to head (08bb744).
⚠️ Report is 27 commits behind head on master.

Files with missing lines Patch % Lines
controllers/apps/apimanager_status_reconciler.go 0.00% 85 Missing ⚠️
pkg/helper/route.go 66.66% 4 Missing ⚠️
...ontrollers/subscription/subscription_controller.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1155      +/-   ##
==========================================
+ Coverage   39.34%   42.57%   +3.22%     
==========================================
  Files         205      202       -3     
  Lines       23363    20568    -2795     
==========================================
- Hits         9193     8757     -436     
+ Misses      13184    11030    -2154     
+ Partials      986      781     -205     
Flag Coverage Δ
unit 42.57% <8.16%> (?)

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

Components Coverage Δ
apis/apps/v1alpha1 (u) 58.55% <ø> (+29.45%) ⬆️
apis/capabilities/v1alpha1 (u) 3.50% <ø> (+1.99%) ⬆️
apis/capabilities/v1beta1 (u) 20.21% <ø> (-1.16%) ⬇️
controllers (i) 9.26% <0.00%> (-0.08%) ⬇️
pkg (u) 62.03% <79.66%> (+1.04%) ⬆️
Files with missing lines Coverage Δ
apis/apps/v1alpha1/apimanager_types.go 59.57% <ø> (ø)
...ontrollers/subscription/subscription_controller.go 0.00% <0.00%> (ø)
pkg/helper/route.go 73.68% <66.66%> (+73.68%) ⬆️
controllers/apps/apimanager_status_reconciler.go 0.00% <0.00%> (ø)

... and 7 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-14267 branch 2 times, most recently from e9384ab to a1878ac Compare April 7, 2026 20:56
@urbanikb urbanikb marked this pull request as ready for review April 7, 2026 20:57
@urbanikb urbanikb requested a review from a team as a code owner April 7, 2026 20:57
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…erface

Replace direct calls to unexported functions (calculateStatus,
deploymentsAvailableCondition, routesReadyCondition, watchedSecretsExist,
secretsAvailableCondition) with a single table-driven test that exercises
the public Reconcile() method end-to-end.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- fix config map fixture that incorrectly assumed operator namespace
will always match WATCH_NAMESPACE var
- fix error checking in preflight status reconciliation when NotFound
error was not detected correctly and would always crash instead
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