Skip to content

Commit 1475d8b

Browse files
committed
Update docs for ClusterResourceSets
The current documentation links to the original enhancement proposal for examples, but these examples are for an older API version. This commit adds examples directly in the book for the latest API version. Signed-off-by: Lennart Jern <[email protected]>
1 parent b58b1f9 commit 1475d8b

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

docs/book/src/tasks/experimental-features/cluster-resource-set.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,44 @@ The `ClusterResourceSet` feature is introduced to provide a way to automatically
88

99
The `ClusterResourceSet` feature is enabled by default, but can be disabled by setting the `EXP_CLUSTER_RESOURCE_SET` environment variable to `false`.
1010

11-
More details on `ClusterResourceSet` and an example to test it can be found at:
11+
More details on `ClusterResourceSet` can be found at:
1212
[ClusterResourceSet CAEP](https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20200220-cluster-resource-set.md)
1313

14+
## Example
15+
16+
Suppose you want to automatically install the relevant external cloud provider on all workload clusters.
17+
This can be accomplished by labeling the clusters with the specific cloud (e.g. AWS, GCP or OpenStack) and then creating a `ClusterResourceSet` for each.
18+
For example, you could have the following for OpenStack:
19+
20+
```yaml
21+
apiVersion: addons.cluster.x-k8s.io/v1beta1
22+
kind: ClusterResourceSet
23+
metadata:
24+
name: cloud-provider-openstack
25+
namespace: default
26+
spec:
27+
strategy: Reconcile
28+
clusterSelector:
29+
matchLabels:
30+
cloud: openstack
31+
resources:
32+
- name: cloud-provider-openstack
33+
kind: ConfigMap
34+
- name: cloud-config
35+
kind: Secret
36+
```
37+
38+
This `ClusterResourceSet` would apply the content of the `Secret` `cloud-config` and of the `ConfigMap` `cloud-provider-openstack` in all workload clusters with the label `cloud=openstack`.
39+
Suppose you have the file `cloud.conf` that should be included in the `Secret` and `cloud-provider-openstack.yaml` that should be in the `ConfigMap`.
40+
The `Secret` and `ConfigMap` can then be created in the following way:
41+
42+
```bash
43+
kubectl create secret generic cloud-config --from-file=cloud.conf --type=addons.cluster.x-k8s.io/resource-set
44+
kubectl create configmap cloud-provider-openstack --from-file=cloud-provider-openstack.yaml
45+
```
46+
47+
Note that it is required that the `Secret` has the type `addons.cluster.x-k8s.io/resource-set` for it to be picked up.
48+
1449
## Update from `ApplyOnce` to `Reconcile`
1550

1651
The `strategy` field is immutable so existing CRS can't be updated directly. However, CAPI won't delete the managed resources in the target cluster when the CRS is deleted.

0 commit comments

Comments
 (0)