Skip to content

Commit 34a44f9

Browse files
authored
Merge pull request #4 from sttts/sttts-cluster-support-enhancement-uniform
Add notes about uniform controllers
2 parents e4cac69 + 7469ce9 commit 34a44f9

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

designs/multi-cluster.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ The `ctrl.Manager` _SHOULD_ be extended to get an optional `cluster.Provider` vi
106106
// pkg/cluster
107107

108108
// Provider defines methods to retrieve clusters by name. The provider is
109-
// responsible for discovering and managing the lifecycle of each cluster.
109+
// responsible for discovering and managing the lifecycle of each cluster,
110+
// and to engage or disengage clusters with the manager the provider is
111+
// run against.
110112
//
111113
// Example: A Cluster API provider would be responsible for discovering and
112114
// managing clusters that are backed by Cluster API resources, which can live
@@ -196,6 +198,8 @@ clusters with non-empty name "provider clusters" or "enganged clusters", while
196198
the embedded cluster of the manager is called the "default cluster" or "hub
197199
cluster".
198200

201+
### Cluster-Aware Request
202+
199203
To provide information about the source cluster of a request, a new type
200204
`reconcile.ClusterAwareRequest` _SHOULD_ be added:
201205

@@ -214,11 +218,21 @@ Given that an empty cluster name represents the "default cluster", a `reconcile.
214218
can be used as `request` type even for controllers that do not have an active cluster provider.
215219
The cluster name will simply be an empty string, which is compatible with calls to `mgr.GetCluster`.
216220

221+
**Note:** controller-runtime must provide this cluster-aware request type to
222+
allow writing *uniform* multi-cluster controllers (see goals), i.e. controllers
223+
that both work as single-cluster and multi-cluster controllers against arbitrary
224+
cluster providers. Think of generic CNCF projects like cert-manager wanting to
225+
support multi-cluster setups generically without forking the codebase.
226+
217227
### BYO Request Type
218228

219229
Instead of using the new `reconcile.ClusterAwareRequest`, implementations _CAN_ also bring their
220230
own request type through the generics support in `Typed*` types (`request comparable`).
221231

232+
**Note:** these kind of controllers won't be uniform in the sense of compatibility
233+
with arbitrary cluster providers, but for use-cases that are tiedly integrated
234+
with specific cluster providers, this might be useful.
235+
222236
Optionally, a passed `TypedEventHandler` will be duplicated per engaged cluster if they
223237
fullfil the following interface:
224238

0 commit comments

Comments
 (0)