Repository navigation
Closed
Labels
area/kubernetesIssues or PRs related to the tenant Kubernetes appIssues or PRs related to the tenant Kubernetes appkind/bugCategorizes issue or PR as related to a bugCategorizes issue or PR as related to a bugpriority/important-soonMust be staffed and worked on either currently, or very soon, ideally in time for the next releaseMust be staffed and worked on either currently, or very soon, ideally in time for the next release
Description
Describe the bug
After deleting a Kubernetes app CR / tenant, the secret <release>-datastore-config retains the finalizer finalizer.kamaji.clastix.io/datastore-secret, which is never removed — blocking deletion of the entire namespace (observed stuck in Terminating for 115 minutes).
Environment
- Cozystack version: v1.4.0-rc.2
- Provider: on-prem (bare-metal)
To Reproduce
- Create a tenant, deploy
Kubernetes/test. - Delete the Kubernetes CR / tenant.
- The namespace
tenant-<x>stays inTerminatingindefinitely. kubectl -n <ns> get secret <release>-datastore-config -o jsonpath='{.metadata.finalizers}'→["finalizer.kamaji.clastix.io/datastore-secret"].
Expected behaviour
On app/tenant deletion, Kamaji removes its finalizer from the datastore secret, and the namespace deletes cleanly.
Actual behaviour
The TenantControlPlane is deleted before Kamaji clears the finalizer, so the secret hangs forever and the namespace cannot be deleted.
Additional context
- Root cause: Kamaji sets
finalizer.kamaji.clastix.io/datastore-secreton the<release>-datastore-configsecret. On deletion the TenantControlPlane is removed before Kamaji reconciles the finalizer off the secret, leaving it stuck. - Severity note: This is the most impactful of the leaks — it blocks namespace teardown entirely and breaks the create→delete cycle (re-runs require manual intervention).
- Proposed fix (Kamaji/cozystack integration):
- Ensure the finalizer is removed in a pre-delete step before the TenantControlPlane is deleted, or
- Enforce deletion order: TenantControlPlane first (Kamaji clears finalizer), then namespace.
- Workaround:
kubectl -n <ns> patch secret <release>-datastore-config \ --type=json -p='[{"op":"remove","path":"/metadata/finalizers"}]'
Found during a create→delete leak sweep of all 22 apps on Cozystack v1.4.0-rc.2.
Reacted by dosubot
Metadata
Metadata
Assignees
Labels
area/kubernetesIssues or PRs related to the tenant Kubernetes appIssues or PRs related to the tenant Kubernetes appkind/bugCategorizes issue or PR as related to a bugCategorizes issue or PR as related to a bugpriority/important-soonMust be staffed and worked on either currently, or very soon, ideally in time for the next releaseMust be staffed and worked on either currently, or very soon, ideally in time for the next release
Activity
fix(kubernetes): clear kamaji datastore-secret finalizer to unblock n…
fix(kubernetes): clear kamaji datastore-secret finalizer to unblock n…
fix(kubernetes): clear kamaji datastore-secret finalizer to unblock n…