You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kcp maintains its own `client-go` implementation at [github.com/kcp-dev/client-go](https://github.com/kcp-dev/client-go) for multi-cluster-aware Kubernetes clients, listers and informers.
Copy file name to clipboardExpand all lines: docs/content/developers/controllers/writing-kcp-aware-controllers.md
+26-15Lines changed: 26 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,23 +7,34 @@ description: >
7
7
8
8
# Writing kcp-aware Controllers
9
9
10
-
## Keys for Objects in Listers/Indexers
10
+
While kcp follows the Kubernetes Resource Model (KRM) closely, its multi-tenancy capabilities via workspaces / logical clusters
11
+
make normal Kubernetes controllers somewhat limited in usefulness, since they generally expect a single Kubernetes API endpoint
12
+
(which would correspond to a single logical cluster). While kcp exposes something called [virtual workspaces](../../concepts/workspaces/virtual-workspaces.md),
13
+
their API semantics are also different from standard Kubernetes API endpoints and thus, controllers written for Kubernetes
14
+
cannot be used against them.
11
15
12
-
When you need to get an object from a kcp-aware lister or an indexer, you can't just pass the object's name to the
13
-
`Get()` function, like you do with a typical controller targeting Kubernetes. Projects using kcp's copy of client-go
14
-
are using a modified key function.
16
+
!!! info
17
+
kcp has previously maintained a [controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) fork under [kcp-dev/controller-runtime](https://github.com/kcp-dev/controller-runtime).
18
+
While it likely still works, we recommend migration to multicluster-runtime (see below).
15
19
16
-
Here are what keys look like for an object `foo` for both cluster-scoped and namespace-scoped varieties:
[multicluster-runtime](https://github.com/kubernetes-sigs/multicluster-runtime) is an effort initiated by kcp developers in the upstream
23
+
community to provide a framework for building multi-cluster controllers. multicluster-runtime is **not** a fork of controller-runtime,
24
+
instead it is a sort of "addon" built on top of controller-runtime's excellent Go generic support. While the project is relatively young
25
+
and deemed experimental, we are confident in its ability to provide a great controller development experience for kcp.
26
26
27
-
## Encoding/Decoding Keys
27
+
The runtime itself is generic and needs a so-called provider that provides it with information about the fleet of clusters
28
+
it is supposed to reconcile over. A small ecosystem of providers exists already. The relevant provider for writing kcp-aware
29
+
controllers is described below.
28
30
29
-
Use the `github.com/kcp-dev/apimachinery/pkg/cache` package to encode and decode keys.
31
+
For more information, also feel free to check out the [talk introducing multicluster-runtime at KubeCon + CloudNativeCon EU in London, 2025](https://www.youtube.com/watch?v=Tz8IcMSY7jw).
32
+
33
+
### Providers for kcp
34
+
35
+
kcp hosts a repository for kcp-specific provider implementations at [kcp-dev/multicluster-provider](https://github.com/kcp-dev/multicluster-provider).
36
+
37
+
Which provider to choose depends on the controller that is to be written, but there is a good chance you want to write a controller for resources
38
+
distributed via an [APIExport](../../concepts/apis/exporting-apis.md). In that case, you should choose the `apiexport` provider from the repository.
39
+
40
+
The provider repository also includes examples, including [one for the `apiexport` provider](https://github.com/kcp-dev/multicluster-provider/tree/main/examples/apiexport).
Copy file name to clipboardExpand all lines: docs/content/developers/investigations/logical-clusters.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ description: >
3
3
Investigation on logical clusters
4
4
---
5
5
6
-
# Logical clusters
6
+
# Logical Clusters
7
7
8
8
Kubernetes evolved from and was influenced by earlier systems that had weaker internal tenancy than a general-purpose compute platform requires. The namespace, quota, admission, and RBAC concepts were all envisioned quite early in the project, but evolved with Kubernetes and not all impacts to future evolution were completely anticipated. Tenancy within clusters is handled at the resource and namespace level, and within a namespace there are a limited number of boundaries. Most organizations use either namespace or cluster separation as their primary unit of self service, with variations leveraging a rich ecosystem of tools.
Copy file name to clipboardExpand all lines: docs/content/developers/investigations/transparent-multi-cluster.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,9 +3,11 @@ description: >
3
3
Investigation of transparent multi-cluster
4
4
---
5
5
6
-
# Transparent multi-cluster
6
+
# Transparent Multi-Cluster
7
7
8
-
## NOTE: This was a prototype that was not continued. The ideas here are still valid and could be picked up by a future project.
8
+
9
+
!!! warning
10
+
This was a prototype that was not continued. The ideas here are still valid and could be picked up by a future project.
9
11
10
12
A key tenet of Kubernetes is that workload placement is node-agnostic until the user needs it to be - Kube offers a homogeneous compute surface that admins or app devs can "break-glass" and set constraints all the way down to writing software that deeply integrates with nodes. But for the majority of workloads a cluster is no more important than a node - it's a detail determined by some human or automated process.
0 commit comments