CUEK8s is an experimental environment for a CUE based approach to Kubernetes manifest management.
It assumes a somewhat homogeneous environment so that abstractions can be provided to service owners, while still provide high levels of customization and flexibility.
The operating environment is assumed to be:
- Multi-tenant (e.g. details, productpage, ratings, reviews)
- Multi-environment (e.g. dev, prod)
- Multi-region (e.g. london, tokyo)
- Multi-cluster (e.g. dev-tokyo-01, dev-tokyo-02)
It is largely incomplete, with some specific offerings being ommitted (either because they are far from complete or too specific to internal use cases. However, it is sufficient as an example and environment to experiment for the purposes of future development.
Various packages are provided which provide abstraction as well as constrained definitions of Kubernetes resources.
See here for reference documentation.
Kubernetes definitions have also beeen imported which can be used directly if
neither the constrained definitions nor the abstractions are appropriate. These
definitions are stored under cue.mod/gen/
.
Resources are grouped together as a unit known as a deliverable.
The reason for this is so that these groups of resources can be deployed as a single unit. It also allows resources to be deployed via different (or even multiple) methods.
A command line tool (cuek8s
) is provided to interact with configurations.
To build the tool:
make build
and to see available commands and their usage:
./bin/cuek8s help
A CUE tool in the form of tools/bootstrap_tool.cue
will spin up a local
environment using k3s and
k3d.
It can be setup via:
make up
and torn down via:
make down
This creates a minimal environment, with just the dev-tokyo
cluster and the
following namespaces:
details-dev
productpage-dev
ratings-dev
reviews-dev
To create a custom environment, the tool can be run via the cue
command,
and injecting values:
cue [-t environments=ENVIRONMENTS -t regions=REGIONS] up ./tool/...
Similarly, to teardown the custom environment:
cue [-t environments=ENVIRONMENTS -t regions=REGIONS] down ./tool/...
See cue injection
for more information about injecting values.