Skip to content

fix: propagate suspend/resume via annotation, not hub-side Status.Suspended - #214

Merged
JoseSzycho merged 5 commits into
mainfrom
fix/federate-suspension-via-annotation
Aug 10, 2026
Merged

fix: propagate suspend/resume via annotation, not hub-side Status.Suspended#214
JoseSzycho merged 5 commits into
mainfrom
fix/federate-suspension-via-annotation

Conversation

@JoseSzycho

Copy link
Copy Markdown
Contributor

PR: fix: propagate suspend/resume via annotation, not hub-side Status.Suspended

Summary

Project suspensions weren't stopping instances: ComputeSuspend/ComputeResume patched WorkloadDeployment.Status.Suspended directly on the project-namespace object, but that write was silently reverted. WorkloadDeploymentFederator never propagates Status hub→cell (only Spec and one specific annotation), and its syncStatusFromDownstream overwrites the entire project-namespace status with whatever Karmada aggregated from the cell on every reconcile — which fires immediately off the hook's own update. The patch logged success with no error, but the object's resourceVersion never actually changed.

This switches the hooks to write a SuspendedAnnotation instead, the same channel already used for ExpectedReferencedDataAnnotation — one of the few things Karmada does propagate hub→cell. The cell's own WorkloadDeploymentReconciler now derives Status.Suspended from that annotation locally, before reconcileInstanceGates propagates it to owned Instances. The cell is the correct authoritative writer here: Karmada only aggregates status cell→hub, never the reverse, so only the cell can honestly confirm suspension actually happened. Status.Suspended then rides the existing generic status-aggregation path back up to the hub — no federator changes needed for that direction.

wdReferencedDataChangedPredicate is extended to fire on the annotation changing too, since that's a metadata-only change (same Generation) that would otherwise never trigger the reconcile that acts on it.

Test plan

  • go build ./...
  • go test ./... (438 passed)
  • Added a test asserting the actual mechanism (SuspendedAnnotation), since the existing conformance test only checks ServiceConsumer's Paused condition and hand-labels its fixture, so it wouldn't have caught this bug or the earlier WorkloadDeployment labeling bug either
  • Re-run a real production suspension against a healthy, actively-running workload and confirm Status.Suspended reaches the WorkloadDeployment, propagates to Instance, and the pod is deleted (and recreated on resume)

@JoseSzycho
JoseSzycho requested a review from scotwells August 7, 2026 18:04
@JoseSzycho

Copy link
Copy Markdown
Contributor Author

just noted that e2e tests are failing. Working into fixing them

…tion

Two watches were silently broken by an earlier make manifests run that
correctly reflected missing +kubebuilder:rbac markers, removing
permissions the code still needs:

- WorkloadReconciler watches networkingv1alpha.Network (workload_controller.go)
  but had no marker requesting networking.datumapis.com/networks at all.
- WorkloadDeploymentFederator.mapDownstreamDeploymentToRequest reads
  Namespace via FederationCluster.GetClient(), a cached/informer-backed
  client (unlike the direct FederationClient used elsewhere in this file),
  which needs list;watch to populate its cache even though the code only
  calls Get() — the existing marker only requested get;list.

Both broke real functionality, not just generated-manifest hygiene: this
is what was failing chainsaw e2e tests unrelated to suspension
(deletion-cascade, propagation-policy-lifecycle, referenced-data-mounts,
etc.) — the manager couldn't establish these watches/caches, so
WorkloadDeploymentFederator never got a chance to run.

Add the markers back and regenerate manifests.
@JoseSzycho
JoseSzycho merged commit 5878538 into main Aug 10, 2026
8 checks passed
@JoseSzycho
JoseSzycho deleted the fix/federate-suspension-via-annotation branch August 10, 2026 14:49
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