apache / apache/solr-operator

Support independent PVC retention policies (whenDeleted/whenScaled) in SolrCloud deployments

Open
#793 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
283
Forks
148
PR merge metrics
No merged PRs in 30d

Description

# Support independent PVC retention policies (whenDeleted/whenScaled) in SolrCloud deployments

**Is your feature request related to a problem?**

In Kubernetes 1.27+ a new feature was added where a retention policy can be used to control if and when PVCs created from a StatefulSet's `volumeClaimTemplate` are deleted.

The Apache Solr Operator currently does not expose the StatefulSet `persistentVolumeClaimRetentionPolicy` feature through the SolrCloud CRD configuration. The operator only provides basic PVC management through `dataStorage.persistent.reclaimPolicy`, which applies the same policy to both deletion and scaling scenarios.

**Describe the solution you'd like.**

The ability to configure `whenDeleted` and `whenScaled` policies independently through the SolrCloud CRD:

```yaml
# Current limitation:
spec:
dataStorage:
persistent:
reclaimPolicy: "Retain" # Same for both scenarios

# Desired configuration:
spec:
dataStorage:
persistent:
reclaimPolicy:
whenDeleted: "Retain" # Keep PVCs during maintenance
whenScaled: "Delete" # Clean up PVCs during scaling
```

This would generate the appropriate StatefulSet `persistentVolumeClaimRetentionPolicy` configuration.

**Describe alternatives you've considered.**

Manual StatefulSet patching works but is overwritten during AroCD sync's
Kustomize overlays are overwritten during deployment.

**Additional context.**

**Environment:** Enterprise Kubernetes (AKS) with GitOps using ArgoCD and Kustomize

**Use Case:** Need different retention behaviors for maintenance workflows (retain data) vs dynamic scaling operations (cleanup for cost optimization).

**Precedent:** This feature has been implemented in other Helm charts:
- [[Prometheus community charts (Issue #3711)](https://github.com/prometheus-community/helm-charts/issues/3711)](https://github.com/prometheus-community/helm-charts/issues/3711)
- [[Bitnami Solr chart (PR #33272)](https://github.com/bitnami/charts/pull/33272)](https://github.com/bitnami/charts/pull/33272)

**Backward Compatibility:** Existing `reclaimPolicy` string format should continue working to set both policies to the same value.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the SolrCloud CRD's dataStorage.persistent.reclaimPolicy definition and trace the StatefulSet generation path that controls persistentVolumeClaimRetentionPolicy. Check how the existing string form is represented and tested, then verify that separate whenDeleted and whenScaled values are reflected in generated StatefulSets while the existing format still applies both policies.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
devops, infrastructure, search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.