📚 / Documentation / Tutorials / Configuration


Overview

At the root of your pipeline, there is a file name vars.yml.

This file defines:

  • what tools will be used by your pipeline
  • what packages will be deployed by your pipeline

There is currently 2 kinds of packages:

  • a bundle, consisting of a set of manifests that will be executed to converge the state of your Kubernetes cluster towards your desired state
  • an application, consisting of a set of Kubernetes resources deployed with kapp

And the following tools are supported:

Those tools allow your pipeline to:

  • build and push Docker images to a Container Registry
  • deploy static or templated Kubernetes resources
  • read/write secrets

Pipeline layout

Alongside the vars.yml file, you'll find a bundles folder and an applications folder, containing the packages to deploy.

|-- bundles/
|   |-- <bundle name>/
|       |-- 10-kubernetes-manifest.yml
|       |-- 20-bash-manifest.sh
|-- applications/
|   |-- <application name>/
|       |-- kubernetes-manifest.yml
|-- vars.yml

Packages are deployed in the order they are defined in the vars.yml file.

In a bundle, manifests are applied in an alphabetical order and currently supports the following kinds:

  • a Kubernetes manifest, deployed with kubectl apply, named *.yml or *.yaml
  • a Shell manifest, executed with bash, named *.sh

For each application, a Kubernetes namespace named klifter-system-app-<application name> will be created, and used by kapp to deploy the application.

Example configuration

vars.yml:

---

tools:
  - helm
  - kbld

packages:
  - name: build-foobar-images
    kind: bundle
  - name: generate-foobar-app
    kind: bundle
  - name: foobar
    kind: application

environment:
  - DOCKER_HOST
  - DOCKER_USERNAME
  - DOCKER_PASSWORD

The above configuration file will expect:

  • a bundles/build-foobar-images/ folder
  • a bundles/generate-foobar-app/ folder
  • an applications/foobar/ folder
  • the listed environment variables (in the environment property) to be set

NB: A bundle can use ytt or helm template to generate files in a later application folder.

Environment variables

Environment VariableDescriptionRequiredDefault Value
K8S_STATE_USERUser used to execute Bash manifestsnobody
K8S_STATE_SOURCE_KINDEither git or localN/A

If K8S_STATE_SOURCE_KIND is set to git:

Environment VariableDescriptionRequiredDefault Value
K8S_STATE_SOURCE_GIT_URLURL to the Git repository to cloneN/A
K8S_STATE_SOURCE_GIT_REFBranch, tag or commit to clonemain
K8S_STATE_SOURCE_GIT_DIRDirectory within the repository containing the source.

If it is set to local:

Environment VariableDescriptionRequiredDefault Value
K8S_STATE_SOURCE_LOCAL_DIRAbsolute path to the folder containing the sourceN/A

The klifter Docker image provides the following defaults:

Environment VariableValue
K8S_STATE_USERklifter-restricted
K8S_STATE_SOURCE_KINDlocal
K8S_STATE_SOURCE_LOCAL_DIR"/data"
K8S_STATE_SOURCE_GIT_REF"main"
K8S_STATE_SOURCE_GIT_DIR"."

It also provides the following users:

  • klifter-agent to run the Ansible playbook
  • klifter-restricted to run the Bash manifests

NB: It is recommended to not override the K8S_STATE_USER in the Docker image.

What's next?

Learn how to write bundles or applications.