Skip to content

Commit 6eefcaa

Browse files
committed
Update docs
1 parent 8fba3b2 commit 6eefcaa

File tree

8 files changed

+130
-143
lines changed

8 files changed

+130
-143
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ It distributes reconciliation of Kubernetes objects across multiple controller i
4343
For this, the project applies proven sharding mechanisms used in distributed databases to Kubernetes controllers.
4444

4545
The project introduces a `sharder` component that implements sharding in a generic way and can be applied to any Kubernetes controller (independent of the used programming language and controller framework).
46-
The `sharder` component is installed into the cluster along with a `ClusterRing` custom resource.
47-
A `ClusterRing` declares a virtual ring of sharded controller instances and specifies API resources that should be distributed across shards in the ring.
48-
It configures sharding on the cluster-scope level (i.e., objects in all namespaces), hence the `ClusterRing` name.
46+
The `sharder` component is installed into the cluster along with a `ControllerRing` custom resource.
47+
A `ControllerRing` declares a virtual ring of sharded controller instances and specifies API resources that should be distributed across shards in the ring.
48+
It configures sharding on the cluster-scope level (i.e., objects in all namespaces), hence the `ControllerRing` name.
4949

5050
The watch cache is an expensive part of a controller regarding network transfer, CPU (decoding), and memory (local copy of all objects).
5151
When running multiple instances of a controller, the individual instances must thus only watch the subset of objects they are responsible for.

docs/assets/architecture.svg

Lines changed: 1 addition & 1 deletion
Loading

docs/design.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ Notably, no leader election is performed, and there is no designated single acti
2323
Instead, each controller instance maintains an individual shard `Lease` labeled with the ring's name, allowing them to announce themselves to the sharder for membership and failure detection.
2424
The sharder watches these leases to build a hash ring with the available instances.
2525

26-
### The `ClusterRing` Resource and Sharder Webhook
26+
### The `ControllerRing` Resource and Sharder Webhook
2727

28-
Rings of controllers are configured through the use of the `ClusterRing` custom resource.
29-
The sharder creates a `MutatingWebhookConfiguration` for each `ClusterRing` to perform assignments for objects associated with the ring.
28+
Rings of controllers are configured through the use of the `ControllerRing` custom resource.
29+
The sharder creates a `MutatingWebhookConfiguration` for each `ControllerRing` to perform assignments for objects associated with the ring.
3030
The sharder webhook is called on `CREATE` and `UPDATE` requests for configured resources, but only for objects that don't have the ring-specific shard label, i.e., for unassigned objects.
3131

3232
The sharder uses the consistent hashing ring to determine the desired shard and adds the shard label during admission accordingly.
3333
Shards then use a label selector for the shard label with their own instance name to restrict the cache and controller to the subset of objects assigned to them.
3434

35-
For the controller's "main" object (configured in `ClusterRing.spec.resources[]`), the object's `apiVersion`, `kind`, `namespace`, and `name` are concatenated to form its hash key.
36-
For objects controlled by other objects (configured in `ClusterRing.spec.resources[].controlledResources[]`), the sharder utilizes information about the controlling object (`ownerReference` with `controller=true`) to calculate the object's hash key.
35+
For the controller's "main" object (configured in `ControllerRing.spec.resources[]`), the object's `apiVersion`, `kind`, `namespace`, and `name` are concatenated to form its hash key.
36+
For objects controlled by other objects (configured in `ControllerRing.spec.resources[].controlledResources[]`), the sharder utilizes information about the controlling object (`ownerReference` with `controller=true`) to calculate the object's hash key.
3737
This ensures that owned objects are consistently assigned to the same shard as their owner.
3838

3939
### Object Movements and Rebalancing
@@ -88,7 +88,7 @@ The comparisons show that the sharder's resource consumption is almost constant
8888
### Minimize Impact on the Critical Path
8989

9090
While the use of mutating webhooks might allow dropping watches for the sharded objects, they can have a significant impact on API requests, e.g., regarding request latency.
91-
To minimize the impact of the sharder's webhook on the overall request latency, the webhook is configured to only react on precisely the set of objects configured in the `ClusterRing` and only for `CREATE` and `UPDATE` requests of unassigned objects.
91+
To minimize the impact of the sharder's webhook on the overall request latency, the webhook is configured to only react on precisely the set of objects configured in the `ControllerRing` and only for `CREATE` and `UPDATE` requests of unassigned objects.
9292
With this the webhook is only on the critical path during initial object creation and whenever the set of available shards requires reassignments.
9393

9494
Furthermore, webhooks can cause API requests to fail entirely.

docs/development.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Assuming a fresh kind cluster:
8383
make run
8484
```
8585

86-
Now, create the `example` `ClusterRing` and run a local shard:
86+
Now, create the `example` `ControllerRing` and run a local shard:
8787

8888
```bash
8989
make run-shard
@@ -92,13 +92,13 @@ make run-shard
9292
You should see that the shard successfully announced itself to the sharder:
9393

9494
```bash
95-
$ kubectl get lease -L alpha.sharding.timebertt.dev/clusterring,alpha.sharding.timebertt.dev/state
96-
NAME HOLDER AGE CLUSTERRING STATE
97-
shard-h9np6f8c shard-h9np6f8c 8s example ready
95+
$ kubectl get lease -L alpha.sharding.timebertt.dev/controllerring,alpha.sharding.timebertt.dev/state
96+
NAME HOLDER AGE CONTROLLERRING STATE
97+
shard-fkpxhjk8 shard-fkpxhjk8 18s example ready
9898

99-
$ kubectl get clusterring
99+
$ kubectl get controllerring
100100
NAME READY AVAILABLE SHARDS AGE
101-
example True 1 1 15s
101+
example True 1 1 34s
102102
```
103103

104104
Running the shard locally gives you the option to test non-graceful termination, i.e., a scenario where the shard fails to renew its lease in time.
@@ -113,19 +113,20 @@ make run-shard
113113

114114
## Testing the Sharding Setup
115115

116-
Independent of the used setup (skaffold-based or running on the host machine), you should be able to create sharded `ConfigMaps` in the `default` namespace as configured in the `example` `ClusterRing`.
116+
Independent of the used setup (skaffold-based or running on the host machine), you should be able to create sharded `ConfigMaps` in the `default` namespace as configured in the `example` `ControllerRing`.
117117
The `Secrets` created by the example shard controller should be assigned to the same shard as the owning `ConfigMap`:
118118

119119
```bash
120120
$ kubectl create cm foo
121121
configmap/foo created
122122

123-
$ kubectl get cm,secret -L shard.alpha.sharding.timebertt.dev/clusterring-50d858e0-example
124-
NAME DATA AGE CLUSTERRING-50D858E0-EXAMPLE
125-
configmap/foo 0 3s shard-5fc87c9fb7-kfb2z
123+
$ kubectl get cm,secret -L shard.alpha.sharding.timebertt.dev/50d858e0-example
124+
NAME DATA AGE 50D858E0-EXAMPLE
125+
configmap/foo 0 1s shard-656d588475-5746d
126126

127-
NAME TYPE DATA AGE CLUSTERRING-50D858E0-EXAMPLE
128-
secret/dummy-foo Opaque 0 3s shard-5fc87c9fb7-kfb2z
127+
NAME TYPE DATA AGE 50D858E0-EXAMPLE
128+
secret/dummy-foo Opaque 0 1s shard-656d588475-5746d
129+
secret/dummy-kube-root-ca.crt Opaque 0 2m14s
129130
```
130131

131132
## Monitoring

docs/evaluation.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ To perform a quick test of the webhosting-operator, create some example `Website
2525
$ kubectl apply -k webhosting-operator/config/samples
2626
...
2727

28-
$ kubectl -n project-foo get website,deploy,svc,ing -L shard.alpha.sharding.timebertt.dev/clusterring-ef3d63cd-webhosting-operator
29-
NAME THEME PHASE AGE CLUSTERRING-EF3D63CD-WEBHOSTING-OPERATOR
30-
website.webhosting.timebertt.dev/homepage exciting Ready 58s webhosting-operator-5d8d548cb9-qmwc7
31-
website.webhosting.timebertt.dev/official lame Ready 58s webhosting-operator-5d8d548cb9-qq549
32-
33-
NAME READY UP-TO-DATE AVAILABLE AGE CLUSTERRING-EF3D63CD-WEBHOSTING-OPERATOR
34-
deployment.apps/homepage-c1160b 1/1 1 1 57s webhosting-operator-5d8d548cb9-qmwc7
35-
deployment.apps/official-97b754 1/1 1 1 57s webhosting-operator-5d8d548cb9-qq549
36-
37-
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE CLUSTERRING-EF3D63CD-WEBHOSTING-OPERATOR
38-
service/homepage-c1160b ClusterIP 10.96.83.180 <none> 8080/TCP 58s webhosting-operator-5d8d548cb9-qmwc7
39-
service/official-97b754 ClusterIP 10.96.193.214 <none> 8080/TCP 58s webhosting-operator-5d8d548cb9-qq549
40-
41-
NAME CLASS HOSTS ADDRESS PORTS AGE CLUSTERRING-EF3D63CD-WEBHOSTING-OPERATOR
42-
ingress.networking.k8s.io/homepage-c1160b nginx * 80 58s webhosting-operator-5d8d548cb9-qmwc7
43-
ingress.networking.k8s.io/official-97b754 nginx * 80 58s webhosting-operator-5d8d548cb9-qq549
28+
$ kubectl -n project-foo get website,deploy,svc,ing -L shard.alpha.sharding.timebertt.dev/ef3d63cd-webhosting-operator
29+
NAME THEME PHASE SINCE AGE EF3D63CD-WEBHOSTING-OPERATOR
30+
website.webhosting.timebertt.dev/homepage exciting Ready 6s 16s webhosting-operator-98ff76b66-tdrtc
31+
website.webhosting.timebertt.dev/official lame Ready 5s 16s webhosting-operator-98ff76b66-tdrtc
32+
33+
NAME READY UP-TO-DATE AVAILABLE AGE EF3D63CD-WEBHOSTING-OPERATOR
34+
deployment.apps/homepage-98bad4 1/1 1 1 15s webhosting-operator-98ff76b66-tdrtc
35+
deployment.apps/official-10ff22 1/1 1 1 15s webhosting-operator-98ff76b66-tdrtc
36+
37+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE EF3D63CD-WEBHOSTING-OPERATOR
38+
service/homepage-98bad4 ClusterIP 100.82.128.107 <none> 8080/TCP 16s webhosting-operator-98ff76b66-tdrtc
39+
service/official-10ff22 ClusterIP 100.82.194.21 <none> 8080/TCP 16s webhosting-operator-98ff76b66-tdrtc
40+
41+
NAME CLASS HOSTS ADDRESS PORTS AGE EF3D63CD-WEBHOSTING-OPERATOR
42+
ingress.networking.k8s.io/homepage-98bad4 nginx webhosting.timebertt.dev 80, 443 16s webhosting-operator-98ff76b66-tdrtc
43+
ingress.networking.k8s.io/official-10ff22 nginx webhosting.timebertt.dev 80, 443 15s webhosting-operator-98ff76b66-tdrtc
4444
```
4545

4646
You can now visit the created websites at http://localhost:8088/project-foo/homepage and http://localhost:8088/project-foo/official.

0 commit comments

Comments
 (0)