File tree Expand file tree Collapse file tree
config/charts/knative-operator Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818{{- fail "knative_operator.multicluster.enabled is true but knative_operator.multicluster.accessProvidersConfig is empty; either provide an access-providers config or disable multi-cluster support" }}
1919{{- end }}
2020{{- $mountPaths := list }}
21- {{- range ($mc.plugins | default (list)) }}
22- {{- $mountPaths = append $mountPaths .mountPath }}
21+ {{- range $index, $plugin := ($mc.plugins | default (list)) }}
22+ {{- $mountPath := $plugin.mountPath | default "" | toString | clean }}
23+ {{- if not (hasPrefix "/" $mountPath) }}
24+ {{- fail (printf "knative_operator.multicluster.plugins[%d].mountPath must be an absolute path, got %q" $index ($plugin.mountPath | default "" | toString)) }}
25+ {{- end }}
26+ {{- $mountPaths = append $mountPaths $mountPath }}
2327{{- end }}
2428{{- $cfg := $mc.accessProvidersConfig | default dict }}
2529{{- range ($cfg.providers | default (list)) }}
26- {{- $cmd := (.execConfig | default dict).command | default "" }}
27- {{- if $cmd }}
28- {{- $cmdDir := dir $cmd }}
29- {{- if not (has $cmdDir $mountPaths) }}
30- {{- fail (printf "provider %q: command dir %q does not match any plugins[].mountPath %v" .name $cmdDir $mountPaths) }}
30+ {{- $rawCmd := (.execConfig | default dict).command | default "" | toString }}
31+ {{- $cmd := $rawCmd | clean }}
32+ {{- if $rawCmd }}
33+ {{- $matched := false }}
34+ {{- range $mountPath := $mountPaths }}
35+ {{- if hasPrefix (printf "%s/" $mountPath) $cmd }}
36+ {{- $matched = true }}
37+ {{- end }}
38+ {{- end }}
39+ {{- if not $matched }}
40+ {{- fail (printf "provider %q: command %q is not under any plugins[].mountPath %v" .name $cmd $mountPaths) }}
3141{{- end }}
3242{{- end }}
3343{{- end }}
Original file line number Diff line number Diff line change @@ -867,9 +867,13 @@ spec:
867867 - name : access-config
868868 mountPath : /etc/cluster-inventory
869869 readOnly : true
870- {{- range ($mc.plugins | default list) }}
870+ {{- range $index, $plugin := ($mc.plugins | default list) }}
871+ {{- $mountPath := $plugin.mountPath | default "" | toString | clean }}
872+ {{- if not (hasPrefix "/" $mountPath) }}
873+ {{- fail (printf "knative_operator.multicluster.plugins[%d].mountPath must be an absolute path, got %q" $index ($plugin.mountPath | default "" | toString)) }}
874+ {{- end }}
871875 - name : {{ .name }}
872- mountPath : {{ . mountPath }}
876+ mountPath : {{ $ mountPath }}
873877 readOnly : true
874878{{- end }}
875879{{- end }}
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ knative_operator:
1717 # command: /access-plugins/kubeconfig-secretreader/bin/kubeconfig-secretreader-plugin
1818 # interactiveMode: Never
1919 # provideClusterInfo: true
20- # plugins[] uses the Kubernetes "image" volume type
20+ # plugins[] uses the Kubernetes "image" volume type. Each mountPath must be
21+ # absolute, and each execConfig.command must point under one of these paths.
2122 plugins : []
2223 # plugins:
2324 # - name: secretreader
Original file line number Diff line number Diff line change @@ -74,7 +74,9 @@ knative_operator:
7474` ` `
7575
7676The chart creates a `ConfigMap` with the provider config and mounts each
77- plugin as a Kubernetes image volume inside the operator pod.
77+ plugin as a Kubernetes image volume inside the operator pod. Each
78+ ` plugins[].mountPath` must be absolute, and each `execConfig.command` must
79+ point under a plugin mount path, not at the mount directory itself.
7880
7981# # Namespace configuration
8082
You can’t perform that action at this time.
0 commit comments