#kubernetes #reflector #controller #watcher #run-time

kube-subcontroller

Multi-subcontroller management by reacting to reflector

2 releases

0.0.2 Mar 29, 2024
0.0.1 Mar 29, 2024

#4 in #reflector

Apache-2.0

23KB
522 lines

kube-subcontroller

Used to build general-purpose Kubernetes controllers that run independently on separate objects/resource types.

graph LR

subgraph subscriber
objects
types
end

subgraph subcontrollers
subctrl1[User code]
subctrl2[...]
end

objects & types -->|notify| kube-subcontroller
-->|start/stop/refresh| subctrl1 & subctrl2

lib.rs:

kube-subcontroller executes a set of subroutines ("subcontrollers") in response to configuration changes from the apiserver, e.g. run a subcontroller watching a new GVK when a CRD is created.

The process subscribes to events from a certain object list-watch (e.g. CRD), which indicate the associated subcontrollers for this key to start, stop or restart. There would be up to N × M subcontrollers running, where N is the number of keys (e.g. number of CRDs), and M is the number of subcontrollers to run for each key.

Dependencies

~64MB
~1M SLoC