🔥Config is a (prototype of) a Python-based configuration-as-code library for generating Kubernetes manifests built on top of cdk8s. It is extremely alpha code, so use at your own risk! If this seems cool, I'd welcome pull requests to make it better! There is currently no stable API, no tests, and no guarantees. Things may be horribly broken, or change significantly between versions.
🔥Config is designed on the builder pattern. You construct a base Kubernetes object with all the required fields, and then can configure it using chained method calls. Here is an example to construct a deployment object with a single container:
import fireconfig as fire
from cdk8s import App, Chart
from constructs import Construct
listen_port = 8080
class Nginx(Chart):
def __init__(self, scope: Construct, id: str):
super().__init__(scope, id)
container = fire.ContainerBuilder(
name='nginx',
image='nginx:latest',
command='nginx',
).with_ports(listen_port)
deployment = fire.DeploymentBuilder(
namespace="default",
selector={"app": "nginx"},
).with_service().with_containers(container).build(self)
This creates a Kubernetes manifest for an nginx pod and a service listening on port 8080.
It is highly recommended that you install pre-commit; this will run useful checks before you
push anything to GitHub. To set up the hooks in this repo, run pre-commit install
.
This project uses poetry to manage dependencies. You can set up for development by running
poetry install
, and for tests/mypy/etc, you can run poetry shell
to enter the virtualenv.
There are currently no tests. Maybe someday I will add some.