Skip to content
Commodore is a wrapper around Kapitan which allows compiling a Kapitan inventory from multiple Git repositories
Python Makefile Shell Jsonnet Dockerfile
Branch: master
Clone or download

Latest commit

tobru Merge pull request #62 from projectsyn/init-catalog-repo
Create initial commit in cloned repositories if no commits exist
Latest commit e62929a Mar 16, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows Ensure Commodore binary version is set when pushing image Mar 9, 2020
commodore
component-template Implement separation of component defaults and hierarchy values Dec 16, 2019
docs Updated UI bundle Feb 4, 2020
filters Implement new filter argument for helm_namespace Nov 5, 2019
lib Implement new filter argument for helm_namespace Nov 5, 2019
tests Fix ApiError exception message handling Mar 3, 2020
tools Update golang Docker tag to v1.14 Feb 26, 2020
.dockerignore Add python cruft to .dockerignore Feb 14, 2020
.gitignore Adapted documentation to support Antora Dec 18, 2019
CHANGELOG.md Update CHANGELOG Mar 11, 2020
CONTRIBUTING.md add LICENSE and contribution guidelines Dec 17, 2019
Dockerfile Merge pull request #45 from projectsyn/renovate/docker-docker.io-gola… Feb 28, 2020
LICENSE add LICENSE and contribution guidelines Dec 17, 2019
MANIFEST.in
Makefile Add make targets to lint and test the code and to build Docker image Feb 14, 2020
Pipfile Improve bulk dependency update Feb 14, 2020
Pipfile.lock Bulk update python dependencies Mar 13, 2020
README.md Update README and add CHANGELOG Feb 14, 2020
playbook.yml Updated UI bundle version Feb 6, 2020
renovate.json Enable pipenv support in Renovate Feb 14, 2020
requirements.in Bulk-update dependencies Feb 14, 2020
requirements.txt Update dependency google-auth to v1.11.2 Feb 14, 2020
setup.py Add test infrastructure Nov 26, 2019
tox.ini Improve bulk dependency update Feb 14, 2020
tox.mk Add make targets to lint and test the code and to build Docker image Feb 14, 2020

README.md

Project Syn: Commodore

Please note that this project is in its early stages and under active development.

See CHANGELOG.md for changelogs of each release version of Commodore.

See DockerHub for pre-built Docker images of Commodore.

Overview

Commodore provides opinionated tenant-aware management of Kapitan inventories and templates. Commodore uses Kapitan for the heavy lifting of rendering templates and resolving a hierachical configuration structure.

Commodore introduces the concept of a component, which is a bundle of Kapitan templates and associated Kapitan classes which describe how to render the templates. Commodore fetches any components that are required for a given configuration before running Kapitan, and sets up symlinks so Kapitan can find the component classes.

Commodore also supports additional processing on the output of Kapitan, such as patching in the desired namespace for a Helm chart which has been rendered using helm template.

System Requirements

Getting started

  1. Install requirements

    Install pipenv according to the upstream documentation.

    Create the Commdore pip environment:

    pipenv install --dev

    Build the Kapitan helm binding:

    • Linux:

      pipenv run build_kapitan_helm_binding
    • OS X:

      Note: At the moment you'll need a working Go compiler to build the Kapitan Helm bindings on OS X.

      pipenv run sh -c '${VIRTUAL_ENV}/lib/python3.*/site-packages/kapitan/inputs/helm/build.sh'
  2. Setup a .env file to configure Commodore (or provide command line flags):

    # URL of Lieutenant API
    COMMODORE_API_URL="https://lieutenant-api.example.com/"
    # Lieutenant API token
    COMMODORE_API_TOKEN="..."
    # Base URL for global Git repositories
    COMMODORE_GLOBAL_GIT_BASE="ssh://git@github.com/projectsyn/"
    # Base URL for customer Git repositories
    COMMODORE_CUSTOMER_GIT_BASE="ssh://git@git.example.com/syn/customers/"

    For Commodore to work, you need to run an instance of the Lieutenant API somewhere (locally is fine too).

    Commodore component repositories must exist in ${COMMODORE_GLOBAL_GIT_BASE}/commodore_components/ with the repository named identically to the component name.

    Note: Commodore currently only supports fetching remote Git repositories via SSH.

  3. Run Commodore

    pipenv run commodore
  4. Start hacking on Commodore

    pipenv shell
    • Write a line of test code, make the test fail
    • Write a line of application code, make the test pass
    • Repeat
  5. Run linting and tests

    Auto format with autopep8

    pipenv run autopep

    List all Tox targets:

    pipenv run test tox -lv

    Run all linting and tests:

    pipenv run test tox

    Run just a specific target:

    pipenv run test tox -e py38

    Upgrade dependencies (Pipfile.lock, requirements.txt)

    pipenv run test tox -e requirements

Run Commodore in Docker

  1. Build the Docker image inside of the cloned Commodore repository:
docker build -t commodore .
  1. Run the built image:
docker run -it --rm \
    -e COMMODORE_API_URL="https://lieutenant-api.example.com/" \
    -e COMMODORE_API_TOKEN="..." \
    -e COMMODORE_GLOBAL_GIT_BASE="ssh://git@github.com/projectsyn/" \
    -e COMMODORE_CUSTOMER_GIT_BASE="ssh://git@git.example.com/syn/customers/" \
    -e SSH_PRIVATE_KEY="$(cat ~/.ssh/id_ed25519)" \
    -v $(pwd)/catalog:/app/catalog/ \
    -v $(pwd)/dependencies:/app/dependencies/ \
    -v $(pwd)/inventory:/app/inventory/ \
    --entrypoint bash \
    commodore
  1. Set up ssh-agent in the running Docker container for the access to Git repositories:
tools/ssh
eval $(ssh-agent)
ssh-add .identityfile
  1. Run Commodore inside of the running Docker container:
pipenv run commodore

Documentation

Run the make docs command in the docs subfolder to generate the Antora documentation website locally. The website will be available at the _antora/index.html file.

After writing the documentation, please use the make check command and correct any warnings raised by the tool.

You can’t perform that action at this time.