diff --git a/charts/code-server/templates/deployment.yaml b/charts/code-server/templates/deployment.yaml index 60caa3307..e1036291c 100644 --- a/charts/code-server/templates/deployment.yaml +++ b/charts/code-server/templates/deployment.yaml @@ -126,19 +126,31 @@ spec: volumes: - name: data {{- if .Values.persistence.enabled }} + {{- if not .Values.persistence.hostPath }} persistentVolumeClaim: claimName: {{ .Values.persistence.existingClaim | default (include "code-server.fullname" .) }} + {{- else }} + hostPath: + path: {{ .Values.persistence.hostPath }} + type: Directory + {{- end -}} {{- else }} emptyDir: {} {{- end -}} {{- range .Values.extraSecretMounts }} - - name: {{ .name }} - secret: - secretName: {{ .secretName }} - defaultMode: {{ .defaultMode }} + - name: {{ .name }} + secret: + secretName: {{ .secretName }} + defaultMode: {{ .defaultMode }} {{- end }} {{- range .Values.extraVolumeMounts }} - - name: {{ .name }} - persistentVolumeClaim: - claimName: {{ .existingClaim }} + - name: {{ .name }} + {{- if .existingClaim }} + persistentVolumeClaim: + claimName: {{ .existingClaim }} + {{- else }} + hostPath: + path: {{ .hostPath }} + type: Directory + {{- end }} {{- end }} diff --git a/charts/code-server/templates/pvc.yaml b/charts/code-server/templates/pvc.yaml index f29301477..2f1c87405 100644 --- a/charts/code-server/templates/pvc.yaml +++ b/charts/code-server/templates/pvc.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +{{- if and (and .Values.persistence.enabled (not .Values.persistence.existingClaim)) (not .Values.persistence.hostPath) }} kind: PersistentVolumeClaim apiVersion: v1 metadata: diff --git a/charts/code-server/values.yaml b/charts/code-server/values.yaml index 182116546..eff180351 100644 --- a/charts/code-server/values.yaml +++ b/charts/code-server/values.yaml @@ -115,6 +115,7 @@ persistence: size: 1Gi annotations: {} # existingClaim: "" + # hostPath: /data serviceAccount: create: true @@ -152,6 +153,7 @@ extraVolumeMounts: [] # mountPath: /mnt/volume # readOnly: true # existingClaim: volume-claim + # hostPath: "" extraConfigmapMounts: [] # - name: certs-configmap