Skip to content

Commit b4fd47b

Browse files
committed
Add support for hostPath volumes
1 parent 3570ff7 commit b4fd47b

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

charts/code-server/templates/deployment.yaml

+19-7
Original file line numberDiff line numberDiff line change
@@ -126,19 +126,31 @@ spec:
126126
volumes:
127127
- name: data
128128
{{- if .Values.persistence.enabled }}
129+
{{- if not .Values.persistence.hostPath }}
129130
persistentVolumeClaim:
130131
claimName: {{ .Values.persistence.existingClaim | default (include "code-server.fullname" .) }}
132+
{{- else }}
133+
hostPath:
134+
path: {{ .Values.persistence.hostPath }}
135+
type: Directory
136+
{{- end -}}
131137
{{- else }}
132138
emptyDir: {}
133139
{{- end -}}
134140
{{- range .Values.extraSecretMounts }}
135-
- name: {{ .name }}
136-
secret:
137-
secretName: {{ .secretName }}
138-
defaultMode: {{ .defaultMode }}
141+
- name: {{ .name }}
142+
secret:
143+
secretName: {{ .secretName }}
144+
defaultMode: {{ .defaultMode }}
139145
{{- end }}
140146
{{- range .Values.extraVolumeMounts }}
141-
- name: {{ .name }}
142-
persistentVolumeClaim:
143-
claimName: {{ .existingClaim }}
147+
- name: {{ .name }}
148+
{{- if .existingClaim }}
149+
persistentVolumeClaim:
150+
claimName: {{ .existingClaim }}
151+
{{- else }}
152+
hostPath:
153+
path: {{ .hostPath }}
154+
type: Directory
155+
{{- end }}
144156
{{- end }}

charts/code-server/templates/pvc.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
1+
{{- if and (and .Values.persistence.enabled (not .Values.persistence.existingClaim)) (not .Values.persistence.hostPath) }}
22
kind: PersistentVolumeClaim
33
apiVersion: v1
44
metadata:

charts/code-server/values.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ persistence:
115115
size: 1Gi
116116
annotations: {}
117117
# existingClaim: ""
118+
# hostPath: /data
118119

119120
serviceAccount:
120121
create: true
@@ -152,6 +153,7 @@ extraVolumeMounts: []
152153
# mountPath: /mnt/volume
153154
# readOnly: true
154155
# existingClaim: volume-claim
156+
# hostPath: ""
155157

156158
extraConfigmapMounts: []
157159
# - name: certs-configmap

0 commit comments

Comments
 (0)