Skip to content

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

@jharris-sohosquared

Description

@jharris-sohosquared

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:

# 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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions