Skip to content

hsnlab/dcontroller

Repository files navigation

Declarative Kubernetes controller runtime

This is a preliminary implementation for the declarative Kubernetes controller runtime. The main goal is to reduce the mental overhead of writing Kubernetes controllers, by providing simple automations to eliminate some of the repetitive code that must be written when coding against the upstream controller-runtime project. The final goal is to let anyone with minimal Go skills to write NoCode or LowCode style.

The main tools here are declarative Kubernetes API translation and incremental reconciliation. Declarative Kubernetes API translation allows to view the Kubernetes API as a NoSQL database and run simple declarative queries on it. This can be done by registering an aggregation pipeline (inspired by MongoDB aggregators) to map the Kubernetes API resources to a view of interest to the controller. These views are dynamically maintained by the declarative controller runtime, by running the aggregation pipeline on the watch events automatically installed for the base Kubernetes API resources on top of which the view is defined on. Incremental reconciliation then means that the controller can watch the incremental changes to the views, instead of the raw ("materialized") views, which simplifies writing edge-triggered conrollers.

Expressions

  • Aggregations work on objects that are indexed on (.metadata.namespace, .metadata.name): all objects at every stage of the aggregation must have valid .metadata.
  • Operator arguments go into lists, optional for single-argument ops (like @len and @not).
  • No multi-dimensional lists: arrays our unpacked to the top level.

Caveats

  • Full RBAC.
  • The strategic merge patch implementation does not handle lists.

About

Declarative Kubernetes controller runtime.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published