kube-arangodb icon indicating copy to clipboard operation
kube-arangodb copied to clipboard

Persistent volume deletion on deployment deletion

Open jurisitsm opened this issue 2 years ago • 3 comments

I am encountering an issue when deploying ArangoDB using the Kubernetes Operator in Rancher. When I delete the ArangoDB chart in Rancher, the associated Persistent Volume is also deleted, despite having a StorageClass with a reclaim policy set to "Retain." This behavior is causing data loss.

The ArangoDB Operator's handling of finalizers, particularly the "remove-child-finalizers" process, might be relevant to this issue.

Here is the yaml defining the arango deployment in my chart: apiVersion: database.arangodb.com/v1 kind: ArangoDeployment metadata: name: {{ .Values.arangodb.deploymentName }} labels: {{- include "labels" . | indent 4 }} app.kubernetes.io/component: arango spec: image: {{ .Values.repository }}/{{ .Values.arangodb.image.name }}:{{ .Values.arangodb.image.version }} imagePullPolicy: {{ .Values.pullPolicy }} imagePullSecrets: - docker-registry-key annotations: {{- include "labels" . | indent 4 }} app.kubernetes.io/component: arango tls: caSecretName: None mode: Single {{- if .Values.arangodb.nodePort }} externalAccess: nodePort: {{ .Values.arangodb.nodePort }} {{ end }} single: resources: {{- toYaml .Values.arangodb.resources | nindent 6 }} volumeClaimTemplate: spec: storageClassName: arango-storage-class accessModes: - ReadWriteOnce resources: requests: storage: 8Gi volumeMode: Filesystem

And here is the yaml of the storage class definition: apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: arango-storage-class provisioner: kubernetes.io/aws-ebs reclaimPolicy: Retain

After installation the storage class gets created, the policy is indeed set to retain, and the arango deployment has it as it's storage class.

jurisitsm avatar Oct 11 '23 14:10 jurisitsm

Hello!

Please, enable the Storage Feature via:

--deployment.feature.local-storage.pass-reclaim-policy   [LocalStorage] Pass ReclaimPolicy from StorageClass instead of using hardcoded Retain - Required version 3.6.0

This feature will be enabled by default in 1.3.0.

Best Regards, Adam.

ajanikow avatar Nov 06 '23 09:11 ajanikow

Since this is only one template in a large helm chart, from which our application is installed, I'd like to know if there is a way to enable this feature through the yaml template of the arango deployment, in a similar way: volumeClaimTemplate: spec: storageClassName: arango-storage-class accessModes: - ReadWriteOnce resources: requests: storage: 8Gi volumeMode: Filesystem args: - --deployment.feature.local-storage.pass-reclaim-policy I have found some documentation on the specification of an args array during the installation of the chart, but I've found the option of providing arguments to be a bit ambiguous between several options here: https://github.com/arangodb/kube-arangodb/blob/master/docs/api/ArangoDeployment.V1.md

jurisitsm avatar Nov 10 '23 12:11 jurisitsm

Hello! It is Operator Command Line arg, which can be set via https://github.com/arangodb/kube-arangodb/blob/master/chart/kube-arangodb/values.yaml#L9

ajanikow avatar Nov 12 '23 18:11 ajanikow