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
Contributor
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.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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)