Skip to content

Commit e8d11cc

Browse files
authored
Update multi-cluster docs for secretreader v0.1.2 (#6645)
* Update multi-cluster docs for secretreader v0.1.2 Signed-off-by: kahirokunn <okinakahiro@gmail.com> * Fix Netlify deploy preview build Signed-off-by: kahirokunn <okinakahiro@gmail.com> --------- Signed-off-by: kahirokunn <okinakahiro@gmail.com>
1 parent de00ee0 commit e8d11cc

3 files changed

Lines changed: 37 additions & 23 deletions

File tree

docs/blog/articles/deploying-knative-to-remote-clusters-with-operator.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,17 @@ knative_operator:
7777
- name: secretreader
7878
execConfig:
7979
apiVersion: client.authentication.k8s.io/v1
80-
command: /credential-plugin/secretreader-plugin
80+
command: /access-plugins/secretreader/bin/secretreader-plugin
81+
interactiveMode: Never
8182
provideClusterInfo: true
8283
plugins:
8384
- name: secretreader
84-
image: registry.k8s.io/cluster-inventory-api/secretreader:v0.1.1
85-
mountPath: /credential-plugin
85+
image: registry.k8s.io/cluster-inventory-api/secretreader:v0.1.2
86+
mountPath: /access-plugins/secretreader
8687
remoteDeploymentsPollInterval: 10s
8788
```
8889
89-
The provider name in `accessProvidersConfig.providers[].name` must match the plugin name in `plugins[].name`. The Operator uses that name to connect the `ClusterProfile` access provider entry to the credential plugin configuration.
90+
The provider name in `accessProvidersConfig.providers[].name` must match the access provider name in `ClusterProfile` status. The `execConfig.command` points to the plugin binary mounted from the image volume.
9091

9192
If you do not use Helm, you can patch an existing Operator Deployment. The important pieces are the same: mount the access provider configuration, mount the credential plugin binary, and start the Operator with `--clusterprofile-provider-file`.
9293

docs/versioned/install/operator/multi-cluster-deployment.md

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ Before you deploy Knative to a remote cluster, you must have:
3737
- The Cluster Inventory API `ClusterProfile` CRD installed on the hub cluster. See the installation instructions in the [kubernetes-sigs/cluster-inventory-api](https://github.com/kubernetes-sigs/cluster-inventory-api) repository.
3838
- Network connectivity from the hub cluster to each spoke cluster's API server. If the hub cannot reach a spoke directly, use a reverse tunnel such as the OCM cluster-proxy.
3939
- A credential plugin that implements the Cluster Inventory API access provider interface. The upstream `kubernetes-sigs/cluster-inventory-api` project publishes two plugins:
40-
- `registry.k8s.io/cluster-inventory-api/secretreader:v0.1.1` reads a bearer token from a `Secret`'s `data.token` field.
41-
- `registry.k8s.io/cluster-inventory-api/kubeconfig-secretreader:v0.1.1` reads a complete kubeconfig from a `Secret`.
40+
- `registry.k8s.io/cluster-inventory-api/secretreader:v0.1.2` reads a bearer token from a `Secret`'s `data.token` field.
41+
- `registry.k8s.io/cluster-inventory-api/kubeconfig-secretreader:v0.1.2` reads a complete kubeconfig from a `Secret`.
4242

4343
Pick whichever matches the credential format you intend to use, or use a plugin from another source.
4444
- RBAC permissions on each spoke cluster that let the credential returned by the plugin create and manage Knative resources. See [Spoke RBAC requirements](#spoke-rbac-requirements).
@@ -76,16 +76,17 @@ knative_operator:
7676
- name: secretreader
7777
execConfig:
7878
apiVersion: client.authentication.k8s.io/v1
79-
command: /credential-plugin/secretreader-plugin
79+
command: /access-plugins/secretreader/bin/secretreader-plugin
80+
interactiveMode: Never
8081
provideClusterInfo: true
8182
plugins:
8283
- name: secretreader
83-
image: registry.k8s.io/cluster-inventory-api/secretreader:v0.1.1
84-
mountPath: /credential-plugin
84+
image: registry.k8s.io/cluster-inventory-api/secretreader:v0.1.2
85+
mountPath: /access-plugins/secretreader
8586
remoteDeploymentsPollInterval: 10s
8687
```
8788
88-
The value of `accessProvidersConfig.providers[].name` must match the value of `plugins[].name`; the Operator uses the name to bind a plugin binary to its exec configuration.
89+
The value of `accessProvidersConfig.providers[].name` must match the `ClusterProfile` status provider name. The `execConfig.command` must point to a binary under one of the configured `plugins[].mountPath` values.
8990

9091
Apply the values with `helm upgrade --install`:
9192

@@ -120,7 +121,8 @@ If you do not use Helm, add multi-cluster support to an Operator that is already
120121
"name": "secretreader",
121122
"execConfig": {
122123
"apiVersion": "client.authentication.k8s.io/v1",
123-
"command": "/credential-plugin/secretreader-plugin",
124+
"command": "/access-plugins/secretreader/bin/secretreader-plugin",
125+
"interactiveMode": "Never",
124126
"provideClusterInfo": true
125127
}
126128
}
@@ -148,12 +150,19 @@ If you do not use Helm, add multi-cluster support to an Operator that is already
148150
args:
149151
- --clusterprofile-provider-file=/etc/cluster-inventory/config.json
150152
volumeMounts:
151-
- name: credential-plugin
152-
mountPath: /credential-plugin
153+
- name: access-config
154+
mountPath: /etc/cluster-inventory
155+
readOnly: true
156+
- name: secretreader
157+
mountPath: /access-plugins/secretreader
158+
readOnly: true
153159
volumes:
154-
- name: credential-plugin
160+
- name: access-config
161+
configMap:
162+
name: clusterprofile-provider-file
163+
- name: secretreader
155164
image:
156-
reference: <your-registry>/<plugin-image>:<tag>
165+
reference: registry.k8s.io/cluster-inventory-api/secretreader:v0.1.2
157166
pullPolicy: IfNotPresent
158167
```
159168

@@ -175,7 +184,7 @@ A `ClusterProfile` resource on the hub describes one spoke. Register it in one o
175184

176185
### Register a ClusterProfile manually
177186

178-
Manual registration prepares the spoke first, then publishes its endpoint and credentials on the hub. The examples below use the `secretreader` plugin (`registry.k8s.io/cluster-inventory-api/secretreader:v0.1.1`); replace image references and configuration fields with those required by the plugin you choose.
187+
Manual registration prepares the spoke first, then publishes its endpoint and credentials on the hub. The examples below use the `secretreader` plugin (`registry.k8s.io/cluster-inventory-api/secretreader:v0.1.2`); replace image references and configuration fields with those required by the plugin you choose.
179188

180189
1. On the spoke cluster, create a `ServiceAccount`, the required permissions, and a token `Secret`:
181190

@@ -214,17 +223,17 @@ Manual registration prepares the spoke first, then publishes its endpoint and cr
214223
- For GKE, run `gcloud container clusters describe <name> --zone <zone> --format='value(endpoint)'`.
215224
{% endraw %}
216225

217-
The `kubectl get ... -o jsonpath='{.data.ca\.crt}'` output is already base64-encoded. Paste this string as-is into the `ClusterProfile` status `certificateAuthorityData` field shown in Step 5.
226+
The `kubectl get ... -o jsonpath='{.data.ca\.crt}'` output is already base64-encoded. Paste this string as-is into the `ClusterProfile` status `certificate-authority-data` field shown in Step 5.
218227

219228
3. On the hub cluster, create a `Secret` that the credential plugin reads:
220229

221230
```bash
222-
kubectl create secret generic spoke-cluster-1-credentials \
223-
--namespace fleet-system \
231+
kubectl create secret generic spoke-cluster-1 \
232+
--namespace knative-operator \
224233
--from-literal=token=<spoke-token>
225234
```
226235

227-
The `secretreader` plugin reads the bearer token from the `data.token` field of this `Secret`. The CA certificate is provided separately through the `ClusterProfile` status in Step 5. If you use `kubeconfig-secretreader` or another plugin, store the credentials in the `Secret` according to that plugin's documentation.
236+
The `secretreader` plugin reads the bearer token from the `data.token` field of a `Secret` in the Operator namespace. The Secret name must match the `clusterName` value in the `ClusterProfile` status extension shown in Step 5. The CA certificate is provided separately through the `ClusterProfile` status. If you use `kubeconfig-secretreader` or another plugin, store the credentials in the `Secret` according to that plugin's documentation.
228237

229238
4. On the hub cluster, apply the `ClusterProfile` spec:
230239

@@ -266,7 +275,11 @@ Manual registration prepares the spoke first, then publishes its endpoint and cr
266275
- name: secretreader
267276
cluster:
268277
server: https://<spoke-api-server>:6443
269-
certificateAuthorityData: <spoke-ca-base64>
278+
certificate-authority-data: <spoke-ca-base64>
279+
extensions:
280+
- name: client.authentication.k8s.io/exec
281+
extension:
282+
clusterName: spoke-cluster-1
270283
```
271284

272285
!!! important

hack/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ curl -f -L --show-error https://raw.githubusercontent.com/knative/eventing/main/
7575
echo -e "\nsamples_branch: main\nversion: development\ndoc_base: /docs/versioned/" >> "$TEMP/content/docs/versioned/.meta.yml"
7676
versionjson="{\"version\": \"versioned\", \"title\": \"(Pre-release)\", \"aliases\": [\"\"]}"
7777

78-
# Temporarily force BUILD_VERSIONS (for previews), while this rewrite is testing.
79-
BUILD_VERSIONS="yes"
78+
# Build all versions by default, but allow deploy previews to opt out.
79+
: "${BUILD_VERSIONS:=yes}"
8080

8181
if [ "$BUILD_VERSIONS" != "no" ]; then
8282
mv $TEMP/content/docs/versioned $TEMP/content/docs/development

0 commit comments

Comments
 (0)