Kubernetes backend for Pants

PyPI

Warning This plugin is in development. No stability is guaranteed! Contributions welcome.

This backends implements targets for working with Kubernetes clusters using raw YAML.

Targets

There's currently three targets for pants-backend-k8s:

k8s_source

A file that can be passed into other k8s fields that are not source fields. For example, k8s_object.template.

k8s_source(
    name="namespace.yaml",
    source="namespace.yaml",
)
ArgumentMeaningDefault value
nameThe target nameSame as any other target, which is the directory name
sourceThe raw fileRequired
decsriptionA description of the target
tagsList of tags[]

This'll eventually be automated like other rules once a suitable heuristic for generation with tailor is found. PRs welcome!

k8s_object

Input for a kubernetes command, either generated via kustomize or via k8s_source.

k8s_object(
    name="k8s",
    description="the chat backend"
    template=[":kustomize"],
    namespace="chat-app",
    cluster="prod",
)
ArgumentMeaningDefault value
nameThe target nameSame as any other target, which is the directory name
templateThe target to act onRequired
namespaceNamespace to targetOptional, will use default kubectl namespace
clustercluster to targetOptional, will use default kubectl cluster
decsriptionA description of the target
tagsList of tags[]

k8s_object is a generator for kubernetes target parametrized by the potential commands that are available: apply, create, get, describe, replace, and delete.

k8s_objects

A collection of kubernetes objects that should be managed together.

k8s_objects(
    name="my-service",
    description="all components of service-x"
    objects=[":namespace", ":deployment"],
)
ArgumentMeaningDefault value
nameThe target nameSame as any other target, which is the directory name
objectsk8s_object targets that should be managedRequired
decsriptionA description of the target
tagsList of tags[]

Like k8s_object, k8s_objects is a generator for parametrized targets for the commands that are available: apply, create, get, describe, replace, and delete.