Skip to content

Commit 58f886c

Browse files
authored
support mountpod|serverless mountpod|sidecar mode (#195)
* support mountpod|serverless mountpod|sidecar mode Signed-off-by: Xuhui zhang <xuhui@juicedata.io> * bump chart version Signed-off-by: Xuhui zhang <xuhui@juicedata.io> * update Signed-off-by: Xuhui zhang <xuhui@juicedata.io> --------- Signed-off-by: Xuhui zhang <xuhui@juicedata.io>
1 parent 8cbe491 commit 58f886c

File tree

8 files changed

+51
-15
lines changed

8 files changed

+51
-15
lines changed

charts/juicefs-csi-driver/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: juicefs-csi-driver
33
description: A Helm chart for JuiceFS CSI Driver
44
type: application
5-
version: 0.30.1
5+
version: 0.30.2
66
appVersion: 0.30.1
77
kubeVersion: ">=1.14.0-0"
88
home: https://github.com/juicedata/juicefs-csi-driver

charts/juicefs-csi-driver/templates/controller.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ spec:
7070
{{- if hasKey .Values.controller "cacheClientConf" }}
7171
- --cache-client-conf={{ .Values.controller.cacheClientConf }}
7272
{{- end }}
73-
{{- if or (eq .Values.mountMode "sidecar") (.Values.validatingWebhook.enabled) (eq .Values.mountMode "serverless") }}
73+
{{- if or (contains "sidecar" .Values.mountMode) (.Values.validatingWebhook.enabled) (contains "serverless" .Values.mountMode) }}
7474
- --webhook=true
7575
{{- end }}
7676
{{- if .Values.validatingWebhook.enabled }}
@@ -154,7 +154,7 @@ spec:
154154
add:
155155
- SYS_ADMIN
156156
runAsNonRoot: false
157-
{{- if ne .Values.mountMode "serverless" }}
157+
{{- if not (contains "serverless" .Values.mountMode) }}
158158
allowPrivilegeEscalation: true
159159
privileged: true
160160
{{- end }}
@@ -163,17 +163,17 @@ spec:
163163
name: socket-dir
164164
{{- if ne .Values.mountMode "process" }}
165165
- mountPath: /jfs
166-
{{- if ne .Values.mountMode "serverless" }}
166+
{{- if not (contains "serverless" .Values.mountMode) }}
167167
mountPropagation: Bidirectional
168168
{{- end }}
169169
name: jfs-dir
170170
- mountPath: /root/.juicefs
171-
{{- if ne .Values.mountMode "serverless" }}
171+
{{- if not (contains "serverless" .Values.mountMode) }}
172172
mountPropagation: Bidirectional
173173
{{- end }}
174174
name: jfs-root-dir
175175
{{- end }}
176-
{{- if or (eq .Values.mountMode "sidecar") (.Values.validatingWebhook.enabled) (eq .Values.mountMode "serverless") }}
176+
{{- if or (contains "sidecar" .Values.mountMode) (.Values.validatingWebhook.enabled) (contains "serverless" .Values.mountMode) }}
177177
- name: webhook-certs
178178
mountPath: /etc/webhook/certs
179179
readOnly: true
@@ -274,13 +274,13 @@ spec:
274274
path: {{ .Values.jfsConfigDir }}
275275
type: DirectoryOrCreate
276276
name: jfs-root-dir
277-
{{- else if eq .Values.mountMode "serverless" }}
277+
{{- else if contains "serverless" .Values.mountMode }}
278278
- emptyDir: {}
279279
name: jfs-dir
280280
- emptyDir: {}
281281
name: jfs-root-dir
282282
{{- end }}
283-
{{- if or (eq .Values.mountMode "sidecar") (.Values.validatingWebhook.enabled) (eq .Values.mountMode "serverless")}}
283+
{{- if or (contains "sidecar" .Values.mountMode) (.Values.validatingWebhook.enabled) (contains "serverless" .Values.mountMode) }}
284284
- name: webhook-certs
285285
secret:
286286
secretName: {{ template "juicefs-csi.webhook.secret" . }}

charts/juicefs-csi-driver/templates/daemonset.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ spec:
8282
{{- if .Values.node.debug }}
8383
- --v=1
8484
{{- end }}
85-
{{- if eq .Values.mountMode "mountpod" }}
85+
{{- if contains "mountpod" .Values.mountMode }}
8686
- --enable-manager=true
8787
{{- end }}
8888
{{- if eq .Values.mountMode "process" }}

charts/juicefs-csi-driver/templates/secret.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{- $certEnabled := .Values.webhook.certManager.enabled }}
22

3-
{{- if or (eq .Values.mountMode "sidecar") (.Values.validatingWebhook.enabled) (eq .Values.mountMode "serverless") }}
3+
{{- if or (contains "sidecar" .Values.mountMode) (.Values.validatingWebhook.enabled) (contains "serverless" .Values.mountMode) }}
44
{{- if not $certEnabled }}
55
kind: Secret
66
apiVersion: v1

charts/juicefs-csi-driver/templates/service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ spec:
2121
{{- include "juicefs-csi.selectorLabels" . | nindent 4 }}
2222
{{- end }}
2323

24-
{{- if or (eq .Values.mountMode "sidecar") (.Values.validatingWebhook.enabled) (eq .Values.mountMode "serverless") }}
24+
{{- if or (contains "sidecar" .Values.mountMode) (.Values.validatingWebhook.enabled) (contains "serverless" .Values.mountMode) }}
2525
---
2626
apiVersion: v1
2727
kind: Service

charts/juicefs-csi-driver/templates/serviceaccount.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ rules:
154154
- update
155155
- create
156156
{{- end }}
157-
{{- if or (eq .Values.mountMode "sidecar") (eq .Values.mountMode "serverless") }}
157+
{{- if or (contains "sidecar" .Values.mountMode) (contains "serverless" .Values.mountMode) }}
158158
- apiGroups:
159159
- ""
160160
resources:

charts/juicefs-csi-driver/templates/webhook.yaml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{{- $keyPEM := include "webhook.keyPEM" . -}}
66
{{- $timeoutSeconds := .Values.webhook.timeoutSeconds }}
77

8-
{{- if eq .Values.mountMode "sidecar" }}
8+
{{- if contains "sidecar" .Values.mountMode }}
99
---
1010
apiVersion: admissionregistration.k8s.io/v1
1111
kind: MutatingWebhookConfiguration
@@ -36,12 +36,23 @@ webhooks:
3636
failurePolicy: {{ $.Values.webhook.FailurePolicy }}
3737
sideEffects: None
3838
admissionReviewVersions: ["v1","v1beta1"]
39+
{{- if .Values.webhook.selector }}
40+
{{- if .Values.webhook.selector.objectSelector }}
41+
objectSelector:
42+
{{- toYaml .Values.webhook.selector.objectSelector | nindent 6 }}
43+
{{- end }}
44+
{{- if .Values.webhook.selector.namespaceSelector }}
45+
namespaceSelector:
46+
{{- toYaml .Values.webhook.selector.namespaceSelector | nindent 6 }}
47+
{{- end }}
48+
{{- else }}
3949
namespaceSelector:
4050
matchLabels:
4151
juicefs.com/enable-injection: "true"
52+
{{- end }}
4253
{{- end }}
4354

44-
{{- if eq .Values.mountMode "serverless" }}
55+
{{- if contains "serverless" .Values.mountMode }}
4556
---
4657
apiVersion: admissionregistration.k8s.io/v1
4758
kind: MutatingWebhookConfiguration
@@ -72,9 +83,20 @@ webhooks:
7283
failurePolicy: {{ $.Values.webhook.FailurePolicy }}
7384
sideEffects: None
7485
admissionReviewVersions: ["v1","v1beta1"]
86+
{{- if .Values.webhook.selector }}
87+
{{- if .Values.webhook.selector.objectSelector }}
88+
objectSelector:
89+
{{- toYaml .Values.webhook.selector.objectSelector | nindent 6 }}
90+
{{- end }}
91+
{{- if .Values.webhook.selector.namespaceSelector }}
92+
namespaceSelector:
93+
{{- toYaml .Values.webhook.selector.namespaceSelector | nindent 6 }}
94+
{{- end }}
95+
{{- else }}
7596
namespaceSelector:
7697
matchLabels:
7798
juicefs.com/enable-serverless-injection: "true"
99+
{{- end }}
78100
{{- end }}
79101

80102
{{- if .Values.validatingWebhook.enabled -}}
@@ -197,7 +219,7 @@ webhooks:
197219
{{- end }}
198220
{{- end }}
199221

200-
{{- if or (eq .Values.mountMode "sidecar") (.Values.validatingWebhook.enabled) }}
222+
{{- if or (contains "sidecar" .Values.mountMode) (contains "serverless" .Values.mountMode) (.Values.validatingWebhook.enabled) }}
201223
{{- if $certEnabled }}
202224
---
203225
apiVersion: cert-manager.io/v1

charts/juicefs-csi-driver/values.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ imagePullSecrets: []
4242
# - sidecar: run JuiceFS Client as a sidecar container in the same pod with application
4343
# - process: run JuiceFS Client as a process in the JuiceFS CSI node service
4444
# - serverless: a special "sidecar" mode that requires no privilege, creates no hostPath volumes, to allow full serverless deployment
45+
# - "mountpod|serverless": support both mountpod and serverless modes
46+
# - "mountpod|sidecar": support both mountpod and sidecar modes
4547
# Ref: https://juicefs.com/docs/csi/introduction/
4648
mountMode: mountpod
4749

@@ -396,6 +398,18 @@ webhook:
396398
# FailurePolicy defines how unrecognized errors and timeout errors from the admission webhook are handled
397399
# https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#failure-policy
398400
FailurePolicy: Fail
401+
# For serverless & sidecar mountMode, configure webhook selectors
402+
# default namespace selector
403+
# - for sidecar mode: juicefs.com/enable-injection: "true"
404+
# - for serverless mode: juicefs.com/enable-serverless-injection: "true"
405+
# Example configuration:
406+
# namespaceSelector:
407+
# matchLabels:
408+
# juicefs.com/enable-injection: "true"
409+
# objectSelector:
410+
# matchLabels:
411+
# juicefs.com/enable-injection: "true"
412+
selector: {}
399413

400414
validatingWebhook:
401415
enabled: false

0 commit comments

Comments
 (0)