Repository navigation
Conversation
Reconcile ran the whole reconcile loop for a SolrCloud being deleted, so the providedConfigMap lookup failed with NotFound on every pass and the storage finalizer was never removed. A SolrCloud with a deletionTimestamp now only runs the storage finalizer logic. If the StatefulSet is already gone, the PVCs are found by the selector labels the operator always generates. Fixes apache#828
There was a problem hiding this comment.
🟡 Changes recommended
The fallback selector can delete unrelated non-Solr PVCs sharing the cloud label, and the regression test creates no PVCs to verify deletion scope.
2 open issues
What changed in this PR
This PR addresses #828 by giving SolrCloud deletion a dedicated reconciliation path, preventing a missing provided ConfigMap from blocking storage finalizer removal.
Changes:
- Bypass normal resource reconciliation during deletion and handle storage cleanup directly.
- Add a regression test for deleting the provided ConfigMap before the SolrCloud.
- Document the fix in the operator Helm chart changelog.
| File | Description |
|---|---|
helm/solr-operator/Chart.yaml |
Adds a changelog entry for the deletion fix. |
controllers/solrcloud_controller.go |
Adds deletion-only reconciliation and a fallback PVC selector when the StatefulSet is absent. |
controllers/solrcloud_controller_storage_test.go |
Tests finalizer removal after the provided ConfigMap is deleted. |
Review effort: Balanced
Without it, deleting a SolrCloud whose StatefulSet is already gone also deleted PVCs that only carry the solr-cloud label, which the StatefulSet selector would never match.
…ocked-by-missing-configmap # Conflicts: # controllers/solrcloud_controller.go # helm/solr-operator/Chart.yaml
|
🤖 I merged the latest Since this PR was opened, #827 added
Both new specs still fail against The PR description still refers to |


Fixes #828.
The bug
Reconcilehas no deletion branch. A SolrCloud with adeletionTimestampgoes through the full reconcile (ZK, services, ConfigMap, StatefulSet…) before it reachesreconcileStorageFinalizer. If any step on the way returns an error, the storage finalizer is never removed and the SolrCloud can't be deleted.The case from the issue: when
providedConfigMapis already gone (Helm deletes it in the same uninstall/upgrade), the lookup returnsNotFoundon every pass, so the CR is stuck for good.The fix
When the SolrCloud is being deleted,
Reconcilenow goes straight to a smallreconcileDeletionthat only handles the storage finalizer. Owned resources are garbage collected by Kubernetes, so nothing else needs reconciling on that path.SharedLabels(). That is the selector the operator always generates for the StatefulSet, and the StatefulSet controller copies the selector's labels onto every PVC it creates (getPersistentVolumeClaimsinpkg/controller/statefulset/stateful_set_utils.go).Tests
New spec in
solrcloud_controller_storage_test.go: a SolrCloud with a provided ConfigMap andVolumeReclaimPolicy: Delete. The test deletes the ConfigMap, then the SolrCloud, and expects the SolrCloud to go away.ConfigMap "provided-config-deleted-first" not foundon every reconcile, same as in the issue.The full
go test ./api/... ./controllers/...run passes (78 specs) against envtest 1.37.0, and so domake check-format vet check-generated check-manifests.AI-assisted (Claude)