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
Copy file name to clipboardExpand all lines: cmd/checksum-controller/main.go
+10-11Lines changed: 10 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -48,14 +48,13 @@ func main() {
48
48
opts:=newOptions()
49
49
50
50
cmd:=&cobra.Command{
51
-
Use: "shard",
52
-
Short: "Run an example shard",
53
-
Long: `The shard command runs an example shard that fulfills the requirements of a controller that supports sharding.
51
+
Use: "checksum-controller",
52
+
Short: "Run an example sharded controller",
53
+
Long: `The checksum-controller is an example for implementing the controller requirements for sharding.
54
54
For this, it creates a shard Lease object and renews it periodically.
55
-
It also starts a controller for ConfigMaps that are assigned to the shard and handles the drain operation as expected.
55
+
It also starts a controller for Secrets that are assigned to the shard and handles the drain operation as expected.
56
56
See https://github.com/timebertt/kubernetes-controller-sharding/blob/main/docs/implement-sharding.md for more details.
57
-
This is basically a lightweight example controller which is useful for developing the sharding components without actually
58
-
running a full controller that complies with the sharding requirements.`,
57
+
This example sharded controller is also useful for developing the sharding components.`,
59
58
60
59
Args: cobra.NoArgs,
61
60
SilenceErrors: true,
@@ -92,14 +91,14 @@ func newOptions() *options {
92
91
TimeEncoder: zapcore.ISO8601TimeEncoder,
93
92
},
94
93
95
-
controllerRingName: "example",
94
+
controllerRingName: "checksum-controller",
96
95
}
97
96
}
98
97
99
98
func (o*options) AddFlags(fs*pflag.FlagSet) {
100
99
fs.StringVar(&o.controllerRingName, "controllerring", o.controllerRingName, "Name of the ControllerRing the shard belongs to.")
101
100
fs.StringVar(&o.leaseNamespace, "lease-namespace", o.leaseNamespace, "Namespace to use for the shard lease. Defaults to the pod's namespace if running in-cluster.")
102
-
fs.StringVar(&o.shardName, "shard", o.shardName, "Name of the shard. Defaults to the instance's hostname.")
101
+
fs.StringVar(&o.shardName, "shard-name", o.shardName, "Name of the shard. Defaults to the instance's hostname.")
Copy file name to clipboardExpand all lines: docs/development.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ Note that you might need to push images to a remote registry though.
26
26
The development setup reuses the deployment manifests of the main sharding components developed in this repository, located in [`config`](../config).
27
27
See [Install the Sharding Components](installation.md).
28
28
29
-
It also includes the [example shard](../pkg/shard) (see [Implement Sharding in Your Controller](implement-sharding.md)) and the [webhosting-operator](../webhosting-operator/README.md) (see [Evaluating the Sharding Mechanism](evaluation.md)).
29
+
It also includes the [checksum-controller](../cmd/checksum-controller) as an example sharded controller (see [Implement Sharding in Your Controller](implement-sharding.md)) and the [webhosting-operator](../webhosting-operator/README.md) (see [Evaluating the Sharding Mechanism](evaluation.md)).
30
30
31
31
Apart from this, the development setup also includes some external components, located in [`hack/config`](../hack/config).
32
32
This includes [cert-manager](https://cert-manager.io/), [ingress-nginx](https://kubernetes.github.io/ingress-nginx/), [kube-prometheus](https://github.com/prometheus-operator/kube-prometheus), [kyverno](https://kyverno.io/), and [parca](https://parca.dev/).
@@ -83,29 +83,29 @@ Assuming a fresh kind cluster:
83
83
make run
84
84
```
85
85
86
-
Now, create the `example``ControllerRing` and run a local shard:
86
+
Now, create the `ControllerRing` and run a local `checksum-controller`:
87
87
88
88
```bash
89
-
make run-shard
89
+
make run-checksum-controller
90
90
```
91
91
92
92
You should see that the shard successfully announced itself to the sharder:
93
93
94
94
```bash
95
95
$ kubectl get lease -L alpha.sharding.timebertt.dev/controllerring,alpha.sharding.timebertt.dev/state
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.
104
+
Running the `checksum-controller` locally gives you the option to test non-graceful termination, i.e., a scenario where the shard fails to renew its lease in time.
105
105
Simply press `Ctrl-C` twice:
106
106
107
107
```bash
108
-
make run-shard
108
+
make run-checksum-controller
109
109
...
110
110
^C2023-11-24T15:16:50.948+0100 INFO Shutting down gracefully in 2 seconds, send another SIGINT or SIGTERM to shutdown non-gracefully
111
111
^Cexit status 1
@@ -114,18 +114,18 @@ make run-shard
114
114
## Testing the Sharding Setup
115
115
116
116
Independent of the used setup (skaffold-based or running on the host machine), you should be able to create sharded `Secrets` in the `default` namespace as configured in the `example``ControllerRing`.
117
-
The `ConfigMaps` created by the example shard controller should be assigned to the same shard as the owning `Secret`:
117
+
The `ConfigMaps` created by the `checksum-controller` should be assigned to the same shard as the owning `Secret`:
0 commit comments