|
5 | 5 | {{- $keyPEM := include "webhook.keyPEM" . -}} |
6 | 6 | {{- $timeoutSeconds := .Values.webhook.timeoutSeconds }} |
7 | 7 |
|
8 | | -{{- if eq .Values.mountMode "sidecar" }} |
| 8 | +{{- if contains "sidecar" .Values.mountMode }} |
9 | 9 | --- |
10 | 10 | apiVersion: admissionregistration.k8s.io/v1 |
11 | 11 | kind: MutatingWebhookConfiguration |
@@ -36,12 +36,23 @@ webhooks: |
36 | 36 | failurePolicy: {{ $.Values.webhook.FailurePolicy }} |
37 | 37 | sideEffects: None |
38 | 38 | 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 }} |
39 | 49 | namespaceSelector: |
40 | 50 | matchLabels: |
41 | 51 | juicefs.com/enable-injection: "true" |
| 52 | + {{- end }} |
42 | 53 | {{- end }} |
43 | 54 |
|
44 | | -{{- if eq .Values.mountMode "serverless" }} |
| 55 | +{{- if contains "serverless" .Values.mountMode }} |
45 | 56 | --- |
46 | 57 | apiVersion: admissionregistration.k8s.io/v1 |
47 | 58 | kind: MutatingWebhookConfiguration |
@@ -72,9 +83,20 @@ webhooks: |
72 | 83 | failurePolicy: {{ $.Values.webhook.FailurePolicy }} |
73 | 84 | sideEffects: None |
74 | 85 | 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 }} |
75 | 96 | namespaceSelector: |
76 | 97 | matchLabels: |
77 | 98 | juicefs.com/enable-serverless-injection: "true" |
| 99 | + {{- end }} |
78 | 100 | {{- end }} |
79 | 101 |
|
80 | 102 | {{- if .Values.validatingWebhook.enabled -}} |
@@ -197,7 +219,7 @@ webhooks: |
197 | 219 | {{- end }} |
198 | 220 | {{- end }} |
199 | 221 |
|
200 | | -{{- if or (eq .Values.mountMode "sidecar") (.Values.validatingWebhook.enabled) }} |
| 222 | +{{- if or (contains "sidecar" .Values.mountMode) (contains "serverless" .Values.mountMode) (.Values.validatingWebhook.enabled) }} |
201 | 223 | {{- if $certEnabled }} |
202 | 224 | --- |
203 | 225 | apiVersion: cert-manager.io/v1 |
|
0 commit comments