<p>I am using helm to deploy StatefulSet, below is yaml</p>

<pre><code>---
kind: StorageClass
apiVersion: storage.k8s.io/v1beta1
metadata:
  name: {{ .Values.database.mongo.storageClassName }}
  labels:
    for: for-mongo-statefulset
provisioner: kubernetes.io/gce-pd
parameters:
  type: pd-ssd
reclaimPolicy: Retain
---
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
  name: mongo
spec:
  serviceName: {{ .Values.database.mongo.serviceName }}
  replicas: {{ .Values.database.mongo.replicas }}
  template:
    metadata:
      labels:
        role: mongo
        environment: prod
    spec:
      serviceAccountName: {{ .Values.serviceAccount }}
      terminationGracePeriodSeconds: 10
      containers:
        - name: mongo
          image: mongo
          command:
            - mongod
            - "--bind_ip"
            - 0.0.0.0
            - "--replSet"
            - {{ .Values.database.mongo.replicaSet }}
            - "--smallfiles"
            - "--noprealloc"
          ports:
            - containerPort: {{ .Values.database.mongo.port }}
          volumeMounts:
            - name: {{ .Values.database.mongo.storageName }}
              mountPath: /data/db
        - name: mongo-sidecar
          image: cvallance/mongo-k8s-sidecar
          env:
            - name: MONGO_SIDECAR_POD_LABELS
              value: "role=mongo,environment=prod"
            - name: KUBERNETES_MONGO_SERVICE_NAME
              value: {{ .Values.database.mongo.serviceName }}
  volumeClaimTemplates:
  - metadata:
      name: {{ .Values.database.mongo.storageName }}
    spec:
      storageClassName: {{ .Values.database.mongo.storageClassName }}
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 100Gi
</code></pre>

<p>On <code>helm install . -n release-name</code> it creates <code>StorageClass</code>, <code>PersistentVolume</code> &amp; <code>PersistentVolumeClaim</code>.</p>

<p>If I delete the release <code>helm delete release-name --purge</code> it keeps pv and pvc which is fine. But it deletes the <code>StorageClass</code> even though I have specified <code>reclaimPolicy: Retain</code> on sc.</p>

<p>Is this expected behaviour? </p>

<p><strong>Helm version</strong></p>

<pre><code>Client: v2.10.0+g9ad53aa
Server: v2.10.0+g9ad53aa
</code></pre>

<p><strong>Kubernetes version</strong></p>

<pre><code>Client Version: v1.11.1
Server Version: v1.9.7-gke.5
</code></pre>

<p><strong>Update</strong></p>

<p>I assumed <code>reclaimPolicy</code> was for both StorageClass and PV/PVC, Thanks to @Pablo for clearing my understanding regarding <code>reclaimPolicy</code></p>

<blockquote>
  <p><strong><a href="https://kubernetes.io/docs/concepts/storage/storage-classes/#reclaim-policy" rel="nofollow noreferrer">Reclaim Policy</a></strong></p>
  
  <p>Persistent Volumes that are dynamically created by a
  storage class will have the reclaim policy specified in the
  reclaimPolicy field of the class, which can be either Delete or
  Retain. If no <code>reclaimPolicy</code> is specified when a StorageClass object is
  created, it will default to Delete</p>
</blockquote>

<p>Is there anything similar to <code>reclaimPolicy</code> which will tell helm/kubernetes to not delete <code>StorageClass</code> when performing <code>helm delete release-name --purge</code>?</p>

Yogesh
<p>The reclaim policy listed in the StorageClass object is used for the persistent volumes not the storage class it self. Meaning that the pvs and pvcs that are created using that storage class will inherit the reclaim policy set in the storage class.</p>

<p>You can find more info on that here: <a href="https://kubernetes.io/docs/concepts/storage/storage-classes/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/storage/storage-classes/</a></p>
