From 625121aabbd80bd3a59176b4a847c8768c1a9198 Mon Sep 17 00:00:00 2001 From: ph1ll Date: Thu, 28 Nov 2024 10:33:28 +0000 Subject: [PATCH] Convert to StatefulSet --- .../charts/management/templates/pvc.yaml | 17 ------------- .../{deployment.yaml => statefulset.yaml} | 25 +++++++++++++------ 2 files changed, 18 insertions(+), 24 deletions(-) delete mode 100644 charts/netbird/charts/management/templates/pvc.yaml rename charts/netbird/charts/management/templates/{deployment.yaml => statefulset.yaml} (82%) diff --git a/charts/netbird/charts/management/templates/pvc.yaml b/charts/netbird/charts/management/templates/pvc.yaml deleted file mode 100644 index 7d37c1b..0000000 --- a/charts/netbird/charts/management/templates/pvc.yaml +++ /dev/null @@ -1,17 +0,0 @@ -{{- if .Values.persistence.enabled -}} -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: {{ include "management.fullname" . }}-data - labels: - {{- include "management.labels" . | nindent 4 }} -spec: - {{- if .Values.persistence.storageClassName }} - storageClassName: "{{- .Values.persistence.storageClassName }}" - {{- end }} - accessModes: - - ReadWriteOnce - resources: - requests: - storage: "{{ .Values.persistence.size | default "1Gi" }}" -{{- end -}} diff --git a/charts/netbird/charts/management/templates/deployment.yaml b/charts/netbird/charts/management/templates/statefulset.yaml similarity index 82% rename from charts/netbird/charts/management/templates/deployment.yaml rename to charts/netbird/charts/management/templates/statefulset.yaml index 3e134b0..5482690 100644 --- a/charts/netbird/charts/management/templates/deployment.yaml +++ b/charts/netbird/charts/management/templates/statefulset.yaml @@ -1,5 +1,5 @@ apiVersion: apps/v1 -kind: Deployment +kind: StatefulSet metadata: name: {{ include "management.fullname" . }} labels: @@ -66,21 +66,18 @@ spec: name: config readOnly: true - mountPath: /var/lib/netbird - name: data + name: {{ include "management.fullname" . }}-data - mountPath: /tmp name: tmp volumes: - name: config secret: secretName: {{ .Values.config.existingSecret }} + {{- if not .Values.persistence.enabled }} - name: data - {{- if .Values.persistence.enabled }} - persistentVolumeClaim: - claimName: {{ include "management.fullname" . }}-data - {{- else }} emptyDir: medium: Memory - {{- end }} + {{- end }} - name: tmp emptyDir: medium: Memory @@ -96,3 +93,17 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} + {{- if .Values.persistence.enabled }} + volumeClaimTemplates: + - metadata: + name: {{ include "management.fullname" . }}-data + spec: + {{- if .Values.persistence.storageClassName }} + storageClassName: "{{- .Values.persistence.storageClassName }}" + {{- end }} + accessModes: + - ReadWriteOnce + resources: + requests: + storage: "{{ .Values.persistence.size | default "1Gi" }}" + {{- end }}