Skip to content

Commit 7254405

Browse files
committed
add multicluster access provider options to Helm chart
Signed-off-by: kahirokunn <okinakahiro@gmail.com>
1 parent 2910cb0 commit 7254405

6 files changed

Lines changed: 111 additions & 2 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright 2025 The Knative Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
{{- $mc := .Values.knative_operator.multicluster | default dict }}
16+
{{- if $mc.enabled }}
17+
{{- $mountPaths := list }}
18+
{{- range ($mc.plugins | default (list)) }}
19+
{{- $mountPaths = append $mountPaths .mountPath }}
20+
{{- end }}
21+
{{- $cfg := $mc.accessProvidersConfig | default dict }}
22+
{{- range ($cfg.providers | default (list)) }}
23+
{{- $cmd := (.execConfig | default dict).command | default "" }}
24+
{{- if $cmd }}
25+
{{- $cmdDir := dir $cmd }}
26+
{{- if not (has $cmdDir $mountPaths) }}
27+
{{- fail (printf "multicluster validation error: provider %q command %q has parent dir %q which does not match any plugins[].mountPath (have %v); execConfig.command parent directory must equal a plugin mountPath" .name $cmd $cmdDir $mountPaths) }}
28+
{{- end }}
29+
{{- end }}
30+
{{- end }}
31+
apiVersion: v1
32+
kind: ConfigMap
33+
metadata:
34+
name: clusterprofile-provider-file
35+
namespace: "{{ .Release.Namespace }}"
36+
labels:
37+
app.kubernetes.io/name: knative-operator
38+
app.kubernetes.io/version: "{{ .Chart.Version }}"
39+
data:
40+
config.json: {{ $mc.accessProvidersConfig | default dict | mustToJson | quote }}
41+
{{- end }}

config/charts/knative-operator/templates/operator.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,5 +855,31 @@ spec:
855855
ports:
856856
- name: metrics
857857
containerPort: 9090
858+
{{- $mc := .Values.knative_operator.multicluster | default dict }}
859+
{{- if $mc.enabled }}
860+
args:
861+
- --clusterprofile-provider-file=/etc/cluster-inventory/config.json
862+
volumeMounts:
863+
- name: cred-config
864+
mountPath: /etc/cluster-inventory
865+
readOnly: true
866+
{{- range ($mc.plugins | default list) }}
867+
- name: {{ .name }}
868+
mountPath: {{ .mountPath }}
869+
readOnly: true
870+
{{- end }}
871+
{{- end }}
872+
{{- $mc := .Values.knative_operator.multicluster | default dict }}
873+
{{- if $mc.enabled }}
874+
volumes:
875+
- name: cred-config
876+
configMap:
877+
name: clusterprofile-provider-file
878+
{{- range ($mc.plugins | default list) }}
879+
- name: {{ .name }}
880+
image:
881+
reference: {{ .image }}
882+
{{- end }}
883+
{{- end }}
858884

859885
---

config/charts/knative-operator/templates/rbac/eventing-operator-role.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,3 +401,12 @@ rules:
401401
- list
402402
- get
403403
- watch
404+
# for multicluster support
405+
- apiGroups:
406+
- multicluster.x-k8s.io
407+
resources:
408+
- clusterprofiles
409+
verbs:
410+
- get
411+
- list
412+
- watch

config/charts/knative-operator/templates/rbac/serving-operator-role.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,15 @@ rules:
252252
- pods
253253
verbs:
254254
- get
255+
# for multicluster support
256+
- apiGroups:
257+
- multicluster.x-k8s.io
258+
resources:
259+
- clusterprofiles
260+
verbs:
261+
- get
262+
- list
263+
- watch
255264
# Copyright 2020 The Knative Authors
256265
#
257266
# Licensed under the Apache License, Version 2.0 (the "License");

config/charts/knative-operator/values.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
knative_operator:
2+
# Multi-cluster (Cluster Inventory API): when enabled, the chart mounts
3+
# access provider config and optional plugin images, and sets
4+
# --clusterprofile-provider-file on the operator. ClusterProfile.status
5+
# accessProviders are not managed by this chart.
6+
multicluster:
7+
enabled: false
8+
accessProvidersConfig: {}
9+
plugins: []
10+
# accessProvidersConfig:
11+
# providers:
12+
# - name: token-secretreader
13+
# execConfig:
14+
# apiVersion: client.authentication.k8s.io/v1
15+
# command: /credential-plugins/token-secretreader/kubeconfig-secretreader-plugin
16+
# provideClusterInfo: true
17+
# plugins:
18+
# - name: token-secretreader
19+
# image: ghcr.io/example/plugin:v1.0.0
20+
# mountPath: /credential-plugins/token-secretreader
221
knative_operator:
322
image: gcr.io/knative-releases/knative.dev/operator/cmd/operator
423
tag: {{ tag }}

docs/release.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ spec:
8585
...
8686
- name: KUBERNETES_MIN_VERSION
8787
value: "{{ .Values.knative_operator.kubernetes_min_version }}"
88-
...
88+
...
8989
```
9090

9191
and
@@ -106,7 +106,7 @@ spec:
106106
...
107107
- name: KUBERNETES_MIN_VERSION
108108
value: "{{ .Values.knative_operator.kubernetes_min_version }}"
109-
...
109+
...
110110
```
111111

112112
You need to remove the line containing `logging.request-log-template:`, because the value of this key contains `{{ }}` in the example,
@@ -128,3 +128,8 @@ helm install knative-operator ./knative-operator-{version}.tgz
128128
```
129129

130130
Replace `{version}` with the correct version for your artifact.
131+
132+
For multi-cluster installs using `spec.clusterProfileRef` on `KnativeServing` / `KnativeEventing`, set
133+
`knative_operator.multicluster.enabled` to `true` in `values.yaml` and provide
134+
`knative_operator.multicluster.accessProvidersConfig` (structured YAML; rendered to the operator's `config.json`) and
135+
`knative_operator.multicluster.plugins` (image volume mounts for exec plugins).

0 commit comments

Comments
 (0)