|
| 1 | +# Design Notes for kcp-operator |
| 2 | + |
| 3 | +kcp-operator is a kubebuilder/controller-runtime based collection of controllers that allow setting up complex kcp environments. |
| 4 | + |
| 5 | +## Resource Relationships |
| 6 | + |
| 7 | +```mermaid |
| 8 | +flowchart TD |
| 9 | + FrontProxy -- ObjRef (n:1)--> RootShard |
| 10 | + Shard --ObjRef (n:1)--> RootShard |
| 11 | + RootShard --ObjRef (1:1, optional)--> CacheServer |
| 12 | + Shard --ObjRef (n:1, optional)--> CacheServer |
| 13 | + Kubeconfig --ObjRef (n:1)-->Shard |
| 14 | + Kubeconfig --ObjRef (n:1)-->RootShard |
| 15 | + Kubeconfig --ObjRef (n:1)-->FrontProxy |
| 16 | +``` |
| 17 | + |
| 18 | +The above flow chart renders the following considerations: |
| 19 | + |
| 20 | +- The `RootShard` is the nucleus of a kcp setup. Each object of this resource basically creates a new kcp setup. |
| 21 | +- A `RootShard` has an optional dependency on a `CacheServer`, if the cache server embedded in the kcp binary is not used. |
| 22 | +- There can be no, one or multiple kcp-front-proxy deployments that all serve traffic into the same kcp setup (e.g. because you want to run front proxies in multiple regions). The `FrontProxy` object therefore has a object reference to a `RootShard`. |
| 23 | +- There can be one or multiple additional shards added to a kcp setup. The `Shard` object therefore has an object reference to a `RootShard`. |
| 24 | +- `Kubeconfigs` can be generated for either a `Shard`, a `RootShard` or a `FrontProxy`. The former two are more useful for components running alongside shards (e.g. additional controllers), while the latter is useful for external access to the kcp setup. |
| 25 | + |
| 26 | +## Cross-Namespace/Cluster References |
| 27 | + |
| 28 | +Due to the potential "global" nature of a kcp setup it might be necessary to run kcp-operator on multiple clusters while attempting to form one single kcp setup with multiple shards and front proxies. |
| 29 | + |
| 30 | +To make this possible, resources with object references (see above) could have a secondary way of reading necessary configuration (instead of a `corev1.LocalObjectReference`). This could be a reference to a `ConfigMap` or a `Secret` (to be determined) which are automatically generated for various resource types. A sync process (outside of the kcp-operator) could then sync the `ConfigMap` (or the `Secret`, or a custom resource type) across namespaces or even clusters, where e.g. a `Shard` object references a `Secret` which was generated for a `RootShard` on another cluster. |
0 commit comments