diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index d04573843..08806fa8d 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -6,7 +6,7 @@ body:
# information
- type: markdown
attributes:
- value: |
+ value: |
Thanks for taking the time to fill out this bug report!
*Note:* Please search to see if an issue already exists for the bug you encountered.
# bug description
@@ -27,10 +27,10 @@ body:
placeholder: Tell us what steps you did to encounter the bug!
render: bash
value: |
- 1.
- 2.
- 3.
- 4.
+ 1.
+ 2.
+ 3.
+ 4.
validations:
required: true
# expected behavior
@@ -47,7 +47,7 @@ body:
id: additional-context
attributes:
label: Additional context
- description: |
+ description: |
Add any other context about the problem here.
If applicable, you can add screenshots to help explain your problem.
placeholder: Anything that might help us understanding your problem...
@@ -62,7 +62,7 @@ body:
attributes:
label: Version (kapitan)
description: |
- Which version of kapitan are you running?
+ Which version of kapitan are you running?
If you are using an older version of kapitan, please try it against the master branch or the latest stable version.
options:
- v0.31.0 (stable)
@@ -76,11 +76,11 @@ body:
attributes:
label: Version (kapitan)
description: |
- Which version of python are you using? Kapitan officially supports only version 3.10 and 3.11
+ Which version of python are you using? Kapitan officially supports only version 3.10 and 3.11
If you are using an older version of python, please check if the bug still exists with a newer (supported) version.
options:
- "3.11"
- - "3.10"
+ - "3.10"
- I use kapitan directly (pip, docker)
multiple: true
validations:
@@ -107,7 +107,7 @@ body:
id: logs
attributes:
label: Relevant log output
- description: |
+ description: |
Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
Use the `--verbose` flag to see all the logs.
render: bash
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
index 62ebdacd4..3a444d1e0 100644
--- a/.github/ISSUE_TEMPLATE/config.yml
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -7,4 +7,4 @@ contact_links:
- name: '💬 Join us on Slack'
url: https://kubernetes.slack.com/archives/C981W2HD3
about: |
- Join our Slack channel to connect with our community, ask questions, and stay updated on project developments.
\ No newline at end of file
+ Join our Slack channel to connect with our community, ask questions, and stay updated on project developments.
diff --git a/.github/ISSUE_TEMPLATE/documentation.yml b/.github/ISSUE_TEMPLATE/documentation.yml
index 314c60733..bcc6d6f06 100644
--- a/.github/ISSUE_TEMPLATE/documentation.yml
+++ b/.github/ISSUE_TEMPLATE/documentation.yml
@@ -6,7 +6,7 @@ body:
# information
- type: markdown
attributes:
- value: |
+ value: |
Thanks for taking the time to give us feedback!
# feature description
- type: textarea
@@ -14,7 +14,7 @@ body:
attributes:
label: Description of the documentation issue
description: |
- A clear and concise description of what the issue with documentation is.
+ A clear and concise description of what the issue with documentation is.
Please make proposals, how it could be done better.
placeholder: Tell us what you want to see in the project!
validations:
@@ -24,6 +24,6 @@ body:
id: additional-context
attributes:
label: Additional context
- description: |
+ description: |
Add any other context about the feature here.
placeholder: Anything that might help us understanding your documentation issue...
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml
index d0c1a95cb..aba8fb77f 100644
--- a/.github/ISSUE_TEMPLATE/feature_request.yml
+++ b/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -6,7 +6,7 @@ body:
# information
- type: markdown
attributes:
- value: |
+ value: |
Thanks for taking the time to fill out this feature request!
# feature description
- type: textarea
@@ -14,7 +14,7 @@ body:
attributes:
label: Description of the feature
description: |
- A clear and concise description of what the feature request is.
+ A clear and concise description of what the feature request is.
Please make proposals, how you would use this feature (syntax).
placeholder: Tell us what you want to see in the project!
validations:
@@ -24,6 +24,6 @@ body:
id: additional-context
attributes:
label: Additional context
- description: |
+ description: |
Add any other context about the feature here.
placeholder: Anything that might help us understanding your feature request...
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 6d73a0f38..772b13134 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -24,4 +24,4 @@ updates:
schedule:
interval: "daily"
labels:
- - "github-actions"
\ No newline at end of file
+ - "github-actions"
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index 0f335093b..f3c65cb98 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -7,4 +7,4 @@ Fixes #
## Docs and Tests
* [ ] Tests added
-* [ ] Updated documentation
\ No newline at end of file
+* [ ] Updated documentation
diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml
index d7d794d88..7b0df4398 100644
--- a/.github/workflows/documentation.yml
+++ b/.github/workflows/documentation.yml
@@ -12,7 +12,7 @@ on:
- 'docs/**'
- '.github/workflows/documentation.yml'
- 'mkdocs.yml'
- - 'CNAME'
+ - 'CNAME'
push:
branches:
- master
diff --git a/.github/workflows/housekeeping.yml b/.github/workflows/housekeeping.yml
index 8c384f25c..933f3c78a 100644
--- a/.github/workflows/housekeeping.yml
+++ b/.github/workflows/housekeeping.yml
@@ -11,9 +11,9 @@ jobs:
with:
stale-issue-message: |
This issue is stale because it has been open for 1 year with no activity.
- Remove the stale label or comment if this issue is still relevant for you.
+ Remove the stale label or comment if this issue is still relevant for you.
If not, please close it yourself.
days-before-issue-stale: 365
- day-before-pr-stale: -1
+ days-before-pr-stale: -1
days-before-close: -1
- days-before-pr-close: -1
\ No newline at end of file
+ days-before-pr-close: -1
diff --git a/.github/workflows/pex-build-upload.yml b/.github/workflows/pex-build-upload.yml
index af992258e..cb1f57104 100644
--- a/.github/workflows/pex-build-upload.yml
+++ b/.github/workflows/pex-build-upload.yml
@@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install poetry
- run: |-
+ run: |-
pipx install poetry
pipx inject poetry poetry-plugin-export --force
- name: Set up Python
@@ -40,14 +40,14 @@ jobs:
- name: Build Pex
run: |-
mkdir -p dist
- pex .[gojsonnet] -r requirements.txt \
+ pex '.[gojsonnet,omegaconf,reclass-rs]' -r requirements.txt \
--python-shebang='#!/usr/bin/env python3' \
--python=python3.11 \
--python=python3.10 \
--python=python3.12 \
-m kapitan \
-o dist/kapitan.linux-x86_64.pex
- dist/kapitan.linux-x86_64.pex --help
+ dist/kapitan.linux-x86_64.pex --help
- name: Add linux-x86_64 pex to assets
uses: softprops/action-gh-release@v2
diff --git a/.github/workflows/python-pip-publish.yml b/.github/workflows/python-pip-publish.yml
index f987d4a14..927eb5221 100644
--- a/.github/workflows/python-pip-publish.yml
+++ b/.github/workflows/python-pip-publish.yml
@@ -4,7 +4,7 @@ name: Upload Python Package
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
-
+
on:
workflow_dispatch:
release:
diff --git a/.github/workflows/test-build-publish.yml b/.github/workflows/test-build-publish.yml
index 0eddf0f23..b65a3ec52 100644
--- a/.github/workflows/test-build-publish.yml
+++ b/.github/workflows/test-build-publish.yml
@@ -6,7 +6,7 @@ concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
-on:
+on:
push:
branches:
- master
@@ -29,15 +29,15 @@ on:
- 'CNAME'
jobs:
- lint:
- name: linter
+ precommit:
+ name: precommit checks
runs-on: ubuntu-latest
if: success() || failure() # Continue running if other jobs fail
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- - uses: psf/black@main
-
+ - uses: pre-commit/action@v3.0.1
+
test:
name: python ${{ matrix.python-version }} tests
runs-on: ubuntu-latest
@@ -60,7 +60,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install libraries dependencies
run: |
- poetry install --no-root
+ poetry install --with test --no-root --extras=gojsonnet --extras=omegaconf --extras=reclass-rs
- name: Install testing dependencies (Helm)
run: |
sudo apt-get -qq update
@@ -92,7 +92,7 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive
-
+
# Setup QEMU and Buildx to build multi-platform image
# This was inspired by this example : https://docs.docker.com/build/ci/github-actions/examples/#multi-platform-images
- name: Set up QEMU
@@ -104,7 +104,7 @@ jobs:
- name: build Kapitan Image
uses: docker/build-push-action@v6
with:
- push: False
+ push: False
platforms: ${{ matrix.platform }}
load: True
file: Dockerfile
@@ -120,7 +120,7 @@ jobs:
publish:
name: publish platform images
# Only starts if everything else is successful
- needs: [lint, test, build]
+ needs: [precommit, test, build]
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
strategy:
@@ -134,7 +134,7 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive
-
+
# Setup QEMU and Buildx to build multi-platform image
# This was inspired by this example : https://docs.docker.com/build/ci/github-actions/examples/#multi-platform-images
- name: Set up QEMU
@@ -180,7 +180,7 @@ jobs:
platforms: ${{ matrix.platform }}
push: true
tags: ${{ steps.meta.outputs.tags }}
- labels: ${{steps.meta.output.labels}}
+ labels: ${{steps.meta.outputs.labels}}
cache-from: type=gha,scope=$GITHUB_REF_NAME-${{ matrix.platform }}
cache-to: type=gha,mode=max,scope=$GITHUB_REF_NAME-${{ matrix.platform }}
@@ -223,7 +223,7 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
-
+
- uses: int128/docker-manifest-create-action@v1
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME}}
@@ -233,4 +233,4 @@ jobs:
builder: buildx
suffixes: |
-linux-amd64
- -linux-arm64
\ No newline at end of file
+ -linux-arm64
diff --git a/.markdownlintignore b/.markdownlintignore
index ed3852425..b6fa3acf7 100644
--- a/.markdownlintignore
+++ b/.markdownlintignore
@@ -1,4 +1,4 @@
examples/
tests/
kapitan/
-PULL_REQUEST_TEMPLATE.md
\ No newline at end of file
+PULL_REQUEST_TEMPLATE.md
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index c7b4a8c27..bd96c9dcd 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,9 +1,30 @@
+exclude: ^(examples/|tests/test_terraform_compiled/|tests/test_kubernetes_compiled/|tests/test_docker_compiled/|tests/test_resources/|tests/test_jsonnet/)
repos:
- repo: https://github.com/psf/black
- rev: 22.10.0
+ rev: 24.8.0
hooks:
- id: black
- - repo: https://github.com/igorshubovych/markdownlint-cli
- rev: v0.32.2
+ - repo: https://github.com/PyCQA/isort
+ rev: 5.13.2
hooks:
- - id: markdownlint-fix
+ - id: isort
+ args: [--profile, black]
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.6.0
+ hooks:
+ - id: trailing-whitespace
+ - id: check-docstring-first
+ - id: debug-statements
+ - id: end-of-file-fixer
+ - id: check-merge-conflict
+ - repo: https://github.com/python-poetry/poetry
+ rev: '1.8.0'
+ hooks:
+ - id: poetry-check
+ - id: poetry-lock
+ entry: env PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring poetry lock
+ - id: poetry-install
+ - repo: https://github.com/rhysd/actionlint
+ rev: 'v1.7.1'
+ hooks:
+ - id: actionlint-docker
diff --git a/CNAME b/CNAME
index a6b29dc21..4dbe9c735 100644
--- a/CNAME
+++ b/CNAME
@@ -1 +1 @@
-kapitan.dev
\ No newline at end of file
+kapitan.dev
diff --git a/Dockerfile b/Dockerfile
index 53cad7f8e..6d41bf504 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -37,12 +37,12 @@ COPY ./poetry.lock ./poetry.lock
COPY ./README.md ./README.md
# Installs and caches dependencies
-RUN poetry install --no-root --extras=gojsonnet --extras=reclass-rs
+ENV POETRY_VIRTUALENVS_CREATE=false
+RUN poetry install --no-root --extras=gojsonnet --extras=reclass-rs --extras=omegaconf
COPY ./kapitan ./kapitan
-RUN pip install --editable .[test] \
- && pip install .[gojsonnet]
+RUN pip install .[gojsonnet,omegaconf,reclass-rs]
# Final image with virtualenv built in previous step
diff --git a/Makefile b/Makefile
index 082de31bf..a0bd1912d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,26 @@
all: clean package
+.PHONY: pre-requisites
+pre-requisites:
+ @echo ----- Installing pre-requisites -----
+ poetry install --with dev --with docs --with test
+
+.PHONY: lint
+lint:
+ @echo ----- Running lint -----
+ poetry run flake8 kapitan
+ poetry run mypy kapitan
+ poetry run pylint kapitan
+
+.PHONY: install poetry with pipx
+install_poetry:
+ @echo ----- Installing poetry with pipx -----
+ which poetry || pipx install poetry
+
.PHONY: test
-test:
+test: pre-requisites lint test_python test_docker test_coverage test_formatting
@echo ----- Running python tests -----
- python3 -m unittest discover
+ poetry run pytest
.PHONY: test_docker
test_docker:
@@ -16,13 +33,13 @@ test_docker:
.PHONY: test_coverage
test_coverage:
@echo ----- Testing code coverage -----
- coverage run --source=kapitan -m unittest discover
- coverage report --fail-under=65 -m
+ poetry run coverage run --source=kapitan -m pytest
+ poetry run coverage report --fail-under=65 -m
.PHONY: test_formatting
test_formatting:
@echo ----- Testing code formatting -----
- black --check .
+ poetry run black --check .
@echo
.PHONY: release
@@ -43,9 +60,7 @@ clean:
.PHONY: format_codestyle
format_codestyle:
- which black || echo "Install black with pip3 install --user black"
- # ignores line length and reclass
- black .
+ poetry run black .
@echo
.PHONY: local_serve_documentation
diff --git a/_config.yml b/_config.yml
index 911bafd8d..10e6731ad 100644
--- a/_config.yml
+++ b/_config.yml
@@ -1 +1 @@
-markdown: kramdown
\ No newline at end of file
+markdown: kramdown
diff --git a/compiled/minikube-es/script.sh b/compiled/minikube-es/script.sh
index 27ab1d028..872cc515d 100755
--- a/compiled/minikube-es/script.sh
+++ b/compiled/minikube-es/script.sh
@@ -4,4 +4,4 @@ set -ex
compile_dir=$1
-echo "This is going into a file" > "${compile_dir}/${FILE_NAME}"
\ No newline at end of file
+echo "This is going into a file" > "${compile_dir}/${FILE_NAME}"
diff --git a/docs/ADOPTERS.md b/docs/ADOPTERS.md
index f49c8f9e3..e162a461d 100644
--- a/docs/ADOPTERS.md
+++ b/docs/ADOPTERS.md
@@ -17,4 +17,4 @@ If you're using **Kapitan** in your organization, please let us know by adding t
- [![Ubisoft](adopters_logos/ubisoft.png){: style="height:100px"}](https://www.ubisoft.com/)
- [![VSHN AG](adopters_logos/vhsn.png){: style="height:100px"}](https://www.vshn.ch)
- [![Flower Labs](adopters_logos/flower.png){: style="height:100px"}](https://www.flower.ai)
-
\ No newline at end of file
+
diff --git a/docs/CNAME b/docs/CNAME
index a6b29dc21..4dbe9c735 100644
--- a/docs/CNAME
+++ b/docs/CNAME
@@ -1 +1 @@
-kapitan.dev
\ No newline at end of file
+kapitan.dev
diff --git a/docs/README.md b/docs/README.md
index 442b31243..6ac03b9ef 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -3,7 +3,7 @@
![GitHub Sponsors](https://img.shields.io/github/sponsors/kapicorp?style=for-the-badge)
![GitHub Stars](https://img.shields.io/github/stars/kapicorp/kapitan?style=for-the-badge)
-**Kapitan** aims to be your *one-stop configuration management solution* to help you manage the ever growing complexity of your configurations by enabling **Platform Engineering** and **GitOps** workflows.
+**Kapitan** aims to be your *one-stop configuration management solution* to help you manage the ever growing complexity of your configurations by enabling **Platform Engineering** and **GitOps** workflows.
It streamlines complex deployments across heterogeneous environments while providing a secure and adaptable framework for managing infrastructure configurations. **Kapitan**'s inventory-driven model, powerful templating capabilities, and native secret management tools offer granular control, fostering consistency, reducing errors, and safeguarding sensitive data.
@@ -12,7 +12,7 @@ Empower your team to make changes to your infrastructure whilst maintaining full
* :fontawesome-brands-slack: Join the community [`#kapitan`](https://kubernetes.slack.com/archives/C981W2HD3)
* :fontawesome-brands-github: Help us grow: [give us a star](https://github.com/kapicorp/kapitan/stargazers) or even better [sponsor our project](pages/contribute/sponsor/)
-## [Why do I need **Kapitan**?](pages/blog/posts/2022-12-04.md#why-do-i-need-kapitan)
+## [Why do I need **Kapitan**?](pages/blog/posts/2022-12-04.md#why-do-i-need-kapitan)
## [Video Tutorials to get started](https://www.youtube.com/@kapitandev)
@@ -28,4 +28,4 @@ Empower your team to make changes to your infrastructure whilst maintaining full
=== "Rawkode: Introduction to Kapitan"
-
\ No newline at end of file
+
diff --git a/docs/getting_started.md b/docs/getting_started.md
index a4cd0cb6f..ec1576d26 100644
--- a/docs/getting_started.md
+++ b/docs/getting_started.md
@@ -1,6 +1,6 @@
# :kapitan-logo: **Kapitan Overview**
-## Setup your installation
+## Setup your installation
Using our reference repositories you can easily get started with **Kapitan**
@@ -94,7 +94,7 @@ Compiled echo-server (0.14s)
kapitan -h
```
-### Pip
+### Pip
#### Install Python
diff --git a/docs/images/logo.min.svg b/docs/images/logo.min.svg
index 1502f7cae..b0a9580b6 100644
--- a/docs/images/logo.min.svg
+++ b/docs/images/logo.min.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/docs/kap_proposals/kap_11_hashicorp_vault_transit.md b/docs/kap_proposals/kap_11_hashicorp_vault_transit.md
index 1f11c9fc1..47d00de59 100644
--- a/docs/kap_proposals/kap_11_hashicorp_vault_transit.md
+++ b/docs/kap_proposals/kap_11_hashicorp_vault_transit.md
@@ -66,7 +66,7 @@ parameters:
VAULT_SKIP_VERIFY: "True"
auth: token
mount: transit
- crypto_key: new_key
+ crypto_key: new_key
always_latest: False
```
@@ -76,7 +76,7 @@ Extra parameters that can be defined in inventory are:
* `auth`: specify which authentication method to use like `token`,`userpass`,`ldap`,`github` & `approle`
* `mount`: specify the mount point of key's path. e.g if path=`alpha-secret/foo/bar` then `mount: alpha-secret` (default `secret`)
* `crypto_key`: Name of the `encryption key` defined in vault
-* `always_latest`: Always rewrap ciphertext to latest rotated `crypto_key` version
+* `always_latest`: Always rewrap ciphertext to latest rotated `crypto_key` version
Environment variables __should NOT__ be defined in inventory are `VAULT_TOKEN`,`VAULT_USERNAME`,`VAULT_PASSWORD`,`VAULT_ROLE_ID`,`VAULT_SECRET_ID`.
This makes the secret_inside_kapitan file accessible throughout the inventory, where we can use the secret whenever necessary like `?{vaulttransit:${target_name}/secret_inside_kapitan}`
diff --git a/docs/kap_proposals/kap_1_external_dependencies.md b/docs/kap_proposals/kap_1_external_dependencies.md
index e23784939..ef974f664 100644
--- a/docs/kap_proposals/kap_1_external_dependencies.md
+++ b/docs/kap_proposals/kap_1_external_dependencies.md
@@ -14,10 +14,10 @@ parameters:
dependencies:
- type: git | http[s]
output_path:
- source:
+ source:
```
-The output path is the path to save the dependency into. For example, it could be `/components/external/manifest.jsonnet`. Then, the user can specify the fetched file as a `kapitan.compile` item along with the locally-created files.
+The output path is the path to save the dependency into. For example, it could be `/components/external/manifest.jsonnet`. Then, the user can specify the fetched file as a `kapitan.compile` item along with the locally-created files.
Git type may also include `ref` and `subdir` parameters as illustrated below:
diff --git a/docs/kap_proposals/kap_2_helm_charts_input_type.md b/docs/kap_proposals/kap_2_helm_charts_input_type.md
index 53322c3f0..aa3b854c1 100644
--- a/docs/kap_proposals/kap_2_helm_charts_input_type.md
+++ b/docs/kap_proposals/kap_2_helm_charts_input_type.md
@@ -6,7 +6,7 @@ Author: @yoshi-1224
## Specification
-This feature basically follows the `helm template` command available.
+This feature basically follows the `helm template` command available.
This will run after the fetching of the external dependencies takes place, such that users can simultaneously specify the fetch as well as the import of a helm chart dependency.
### Semantics
@@ -15,14 +15,14 @@ This will run after the fetching of the external dependencies takes place, such
kapitan:
compile:
- input_type: helm
- input_path:
+ input_path:
output_path:
set-file:
-
- ...
values_file:
namespace:
-
+
```
This mostly maps to the options available to `helm template` command (refer to [here](https://helm.sh/docs/helm/#helm-template)).
diff --git a/docs/kap_proposals/kap_3_schema_validation.md b/docs/kap_proposals/kap_3_schema_validation.md
index 81526b614..bfbbfa508 100644
--- a/docs/kap_proposals/kap_3_schema_validation.md
+++ b/docs/kap_proposals/kap_3_schema_validation.md
@@ -13,7 +13,7 @@ The following inventory will validate the structure of Kubernetes Service manife
parameters:
kapitan:
validate:
- - output_type: kubernetes.service
+ - output_type: kubernetes.service
version: 1.6.6
output_path: relative/path/in/target
```
diff --git a/docs/pages/blog/index.md b/docs/pages/blog/index.md
index c58f16c50..05761ac57 100644
--- a/docs/pages/blog/index.md
+++ b/docs/pages/blog/index.md
@@ -1,2 +1 @@
# Blog
-
diff --git a/docs/pages/blog/posts/2022-12-04.md b/docs/pages/blog/posts/2022-12-04.md
index d78b21edf..58caa190d 100644
--- a/docs/pages/blog/posts/2022-12-04.md
+++ b/docs/pages/blog/posts/2022-12-04.md
@@ -7,13 +7,13 @@ date: 2022-12-04
# :kapitan-logo: **5 Years** of **Kapitan**
-Last October we quietly celebrated [5 years of **Kapitan**](https://github.com/kapicorp/kapitan/releases/tag/v0.9.14).
+Last October we quietly celebrated [5 years of **Kapitan**](https://github.com/kapicorp/kapitan/releases/tag/v0.9.14).
In 5 years, we've been able to witness a steady and relentless of Kapitan, which has however never caught the full attention of the majority of the community.
The main issue has always been around an embarassing lack of **documentation**, and we've worked hard to improve on that, with more updates due soon.
-Let this first blog post from a revamped website be a promise to our community of a better effort in explaining what sets **Kapitan** apart, and makes it the only tool of its kind.
+Let this first blog post from a revamped website be a promise to our community of a better effort in explaining what sets **Kapitan** apart, and makes it the only tool of its kind.
And let's start with a simple question: Why do you even need **Kapitan**?
@@ -36,7 +36,7 @@ All I can say it is very rewarding once you get to use it, so stick with me whil
It would be reductive to list the problems that **Kapitan** solves, because sometimes we ourselves are stunned by what **Kapitan** is being used for, so I will start with some common relatable ones, and perhaps that will give you the right framing to understand how to use it with your setup.
-In its most basic explanation, **Kapitan** solves the problem of avoiding duplication of *configuration data*: by consolidating it in one place (the [**Inventory**](/inventory.md)), and making it accessible by all the tools and languages it integrates with (see [**Input Types**](/kapitan_overview.md#input-types)).
+In its most basic explanation, **Kapitan** solves the problem of avoiding duplication of *configuration data*: by consolidating it in one place (the [**Inventory**](/inventory.md)), and making it accessible by all the tools and languages it integrates with (see [**Input Types**](/kapitan_overview.md#input-types)).
This *configuration data* is then used by **Kapitan** (templates) to configure and operate a number of completely distinct and unaware tools which would normally not be able to share their configurations.
@@ -77,7 +77,7 @@ graph LR
SCRIPT --> BUCKET_SCRIPT
HELM --> BUCKET_HELM
-
+
DATA[("All your data")]
BUCKET("bucket_name")
KAPITAN(("")):::blue
@@ -105,29 +105,29 @@ graph LR
end
```
-Thanks to its flexiblility, you can use **Kapitan** to generate all sorts of configurations: Kubernetes and Terraform resources, ArgoCD pipelines, Docker Compose files, random configs, scripts, documentations and anything else you find relevant.
+Thanks to its flexiblility, you can use **Kapitan** to generate all sorts of configurations: Kubernetes and Terraform resources, ArgoCD pipelines, Docker Compose files, random configs, scripts, documentations and anything else you find relevant.
The trick is obviously on how to drive these changes, but it is not as complicated as it sounds. We'll get there soon enough!
Let's see now another example of things that are so established in the way to do things that become elusivly impossible to see. As a way to highlight the potential issues with this way of doing things, let's ask some questions on your current setup. We pick on **Kubernetes** this time.
-## Kubernetes
+## Kubernetes
-I’ll start with **Kubernetes**, such a popular and brilliant solution to problems most people should not be concerned with (jokes apart, I adore Kubernetes).
+I’ll start with **Kubernetes**, such a popular and brilliant solution to problems most people should not be concerned with (jokes apart, I adore Kubernetes).
To most, **Kubernetes** is that type of solution that quickly turns into a problem of its own right.
> So.. how do you deploy to Kubernetes right now?
-**Helm** comes to mind first, right?
+**Helm** comes to mind first, right?
!!! note ":kapitan-logo: **Kapitan** + **Helm**: BFF :heart:"
- In spite of **Kapitan** being initially considered (even by ourselves) as an alternative to **Helm**, we’ve actually enjoyed the benefits of integrating with this amazing tool and the ecosystem it gives us access to. So yes, good news: you can use **Helm** right from within **Kapitan**!.
+ In spite of **Kapitan** being initially considered (even by ourselves) as an alternative to **Helm**, we’ve actually enjoyed the benefits of integrating with this amazing tool and the ecosystem it gives us access to. So yes, good news: you can use **Helm** right from within **Kapitan**!.
Well, let’s put that to a test. How do you manage your **Helm** charts? I’ll attempt to break these questions down into categories.
=== "Code Organization"
!!! note ""
- * Where do you keep your **Helm** charts?
+ * Where do you keep your **Helm** charts?
* In a single repository?
* How many repositories?
* Alongside the code you develop?
@@ -138,16 +138,16 @@ Well, let’s put that to a test. How do you manage your **Helm** charts? I’ll
* How many `values.yaml` files do you have?
* How much consistency is there between them? any ***snowflakes***?
* If you change something, like with the `bucket_name` example above:
- * how many places do you need to go and update?
+ * how many places do you need to go and update?
* And how many times do you get it wrong?
- * Don't you feel all your charts look the same?
- * Yet how many times do you need to deviate from the one you thought captured everything?
+ * Don't you feel all your charts look the same?
+ * Yet how many times do you need to deviate from the one you thought captured everything?
* What if you need to make a change to all your charts at once: how do you deal with it?
* What about configuration files, how do you deal with templating those?
=== "Maintenance"
!!! note ""
- * How do you deal with “official” charts, do they always cover what you want to do?
+ * How do you deal with “official” charts, do they always cover what you want to do?
* How do you deal with modifications that you need to apply to your own version of a an official chart?
* What if you need to make a change that affects ALL your charts?
* Or if the change is for all the charts for a set of microservices?
@@ -159,35 +159,35 @@ Well, let’s put that to a test. How do you manage your **Helm** charts? I’ll
* How many of your colleagues have the same clean context setup as you have?
* How many things are there that you wish you were tracking?
* How do I connect to the production database? Which user is it again?
- * How easy is it for you to create a new environment from scratch?
- * Are you sure?
+ * How easy is it for you to create a new environment from scratch?
+ * Are you sure?
* When was the last time you tried?
=== "Documentation"
!!! note ""
* How easy is it to keep your configuration up to date?
* Does your documentation need to be “understood” or can be just executed on?
- * How many conditionals like this do you have in your documentation?
+ * How many conditionals like this do you have in your documentation?
> NOTE: Cluster X in project Y has an older version of Q and requires you to do Z instead N because of A, B and C!
* Would you be able to follow those instructions at 3am on a Sunday morning?
=== "Secrets management"
!!! note ""
- * How do you handle secrets in your repository?
- * Do you know how to create your secrets from scratch?
+ * How do you handle secrets in your repository?
+ * Do you know how to create your secrets from scratch?
* Do you remember that token you created 4 months ago? How did you do that?
- * How long would it take you?
- * Is the process of creating them “secure”?
+ * How long would it take you?
+ * Is the process of creating them “secure”?
* Or does it leave you with random certificates and tokens unencrypted on your “Downloads” folder?
=== "Everything else"
!!! note ""
- * The above concerns: do they also apply to other things you manage?
- * Terraform?
- * Pipelines?
+ * The above concerns: do they also apply to other things you manage?
+ * Terraform?
+ * Pipelines?
* Random other systems you interact with?
-I’ll stop here because I do not want to lose you, and neither do I want to discourage you.
+I’ll stop here because I do not want to lose you, and neither do I want to discourage you.
But if you look around it’s true, you do have a very complicated setup. And **Kapitan** can help you streamline it for you. In fact, **Kapitan** can leave you with a consistent and uniform way to manage all these concerns at once.
diff --git a/docs/pages/blog/posts/2023-08-27.md b/docs/pages/blog/posts/2023-08-27.md
index 6743e8010..31bfa9905 100644
--- a/docs/pages/blog/posts/2023-08-27.md
+++ b/docs/pages/blog/posts/2023-08-27.md
@@ -29,7 +29,7 @@ The content of this tutorial is already available on the [`kapitan-reference`](h
### Define parameters
-```yaml
+```yaml
## inventory/classes/components/keda.yml
parameters:
keda:
@@ -51,7 +51,7 @@ parameters:
```yaml
helm_values:
operator:
- replicaCount: 2
+ replicaCount: 2
```
### Download the chart
@@ -167,7 +167,7 @@ Let's add this configuration:
# Configures a helm generator to compile files for the given chart
keda:
chart_dir: ${keda:params:chart_dir}
- ...
+ ...
mutations:
bundle:
- conditions:
diff --git a/docs/pages/commands/kapitan_dotfile.md b/docs/pages/commands/kapitan_dotfile.md
index c2b5408db..07967efac 100644
--- a/docs/pages/commands/kapitan_dotfile.md
+++ b/docs/pages/commands/kapitan_dotfile.md
@@ -6,7 +6,7 @@ Kapitan allows you to coveniently override defaults by specifying a local `.kapi
This comes handy to make sure **Kapitan** runs consistently for your specific setup.
-!!! info
+!!! info
Any **Kapitan** command can be overridden in the `.kapitan` dotfile, but here are some of the most common examples.
### `version`
diff --git a/docs/pages/commands/kapitan_inventory.md b/docs/pages/commands/kapitan_inventory.md
index d2b7048d5..17bc8e0fa 100644
--- a/docs/pages/commands/kapitan_inventory.md
+++ b/docs/pages/commands/kapitan_inventory.md
@@ -12,7 +12,7 @@ For example, rendering the inventory for the `mysql` target:
kapitan inventory -t mysql
```
- ??? example "click to expand output"
+ ??? example "click to expand output"
```yaml
__reclass__:
environment: base
diff --git a/docs/pages/commands/kapitan_lint.md b/docs/pages/commands/kapitan_lint.md
index 6779aac4b..13c83be62 100644
--- a/docs/pages/commands/kapitan_lint.md
+++ b/docs/pages/commands/kapitan_lint.md
@@ -1,6 +1,6 @@
# :kapitan-logo: **CLI Reference** | `kapitan lint`
-## `kapitan lint`
+## `kapitan lint`
Perform a checkup on your inventory or refs.
@@ -10,7 +10,7 @@ Perform a checkup on your inventory or refs.
./kapitan lint
```
- ??? example "click to expand output"
+ ??? example "click to expand output"
```shell
Running yamllint on all inventory files...
diff --git a/docs/pages/commands/kapitan_searchvar.md b/docs/pages/commands/kapitan_searchvar.md
index 6b306ba60..b8eca5561 100644
--- a/docs/pages/commands/kapitan_searchvar.md
+++ b/docs/pages/commands/kapitan_searchvar.md
@@ -10,7 +10,7 @@ Shows all inventory files where a variable is declared:
./kapitan searchvar parameters.components.*.image
```
- ??? example "click to expand output"
+ ??? example "click to expand output"
```shell
./inventory/classes/components/vault.yml ${vault:image}
./inventory/classes/components/logstash.yml eu.gcr.io/antha-images/logstash:7.5.1
diff --git a/docs/pages/commands/kapitan_validate.md b/docs/pages/commands/kapitan_validate.md
index 84f4ffa17..e5d883d39 100644
--- a/docs/pages/commands/kapitan_validate.md
+++ b/docs/pages/commands/kapitan_validate.md
@@ -13,8 +13,8 @@ Validates the schema of compiled output. Validate options are specified in the i
kapitan validate
```
- ??? example "click to expand output"
- ```shell
+ ??? example "click to expand output"
+ ```shell
created schema-cache-path at ./schemas
Validation: manifest validation successful for ./compiled/minikube-mysql/manifests/mysql_secret.yml
Validation: manifest validation successful for ./compiled/minikube-mysql/manifests/mysql_service_jsonnet.yml
@@ -26,7 +26,7 @@ Validates the schema of compiled output. Validate options are specified in the i
kapitan compile --validate
```
- ??? example "click to expand output"
+ ??? example "click to expand output"
```shell
Rendered inventory (0.27s)
Compiled labels (0.23s)
@@ -47,7 +47,7 @@ Validates the schema of compiled output. Validate options are specified in the i
You can leverage the `.kapitan` dotfile to make sure validate runs every time you run compile.
-
+
!!! example ""
!!! quote "example `.kapitan`"
```yaml
@@ -56,13 +56,13 @@ Validates the schema of compiled output. Validate options are specified in the i
compile:
validate: true
```
-
+
The `validate` command will now be implied for every compile run
```shell
kapitan compile
```
- ??? example "click to expand output"
+ ??? example "click to expand output"
```shell
Rendered inventory (0.27s)
Compiled labels (0.23s)
@@ -90,10 +90,10 @@ Validates the schema of compiled output. Validate options are specified in the i
!!! info
- **Kapitan** will automatically download the schemas for Kubernetes Manifests directly from
-
+ **Kapitan** will automatically download the schemas for Kubernetes Manifests directly from
+
By default, the schemas are cached into `./schemas/`, which can be modified with the `--schemas-path` option.
-
+
!!! tip "override permanently `schema-path`"
Remember to use the `.kapitan` dotfile configuration to override permanently the `schema-path` location.
diff --git a/docs/pages/contribute/documentation.md b/docs/pages/contribute/documentation.md
index 2feef6d3e..e7523695c 100644
--- a/docs/pages/contribute/documentation.md
+++ b/docs/pages/contribute/documentation.md
@@ -31,4 +31,4 @@ Submit a PR for our master branch that updates the `.md` file(s). Test how the c
### Submit a PR
-Once the above PR has been merged, our CI will deploy your docs automatically.
\ No newline at end of file
+Once the above PR has been merged, our CI will deploy your docs automatically.
diff --git a/docs/pages/contribute/sponsor.md b/docs/pages/contribute/sponsor.md
index de695df85..98f6a8786 100644
--- a/docs/pages/contribute/sponsor.md
+++ b/docs/pages/contribute/sponsor.md
@@ -3,7 +3,7 @@ comments: true
tags:
- community
---
-# :kapitan-logo: **Sponsor Kapitan**
+# :kapitan-logo: **Sponsor Kapitan**
Do you want to help the project? Great! There are many ways to do it
diff --git a/docs/pages/external_dependencies.md b/docs/pages/external_dependencies.md
index 5a11eefac..9263c4e46 100644
--- a/docs/pages/external_dependencies.md
+++ b/docs/pages/external_dependencies.md
@@ -1,6 +1,6 @@
# :kapitan-logo: External dependencies
-**Kapitan** has the functionality to fetch external dependencies from remote locations.
+**Kapitan** has the functionality to fetch external dependencies from remote locations.
Supported dependencies types are:
@@ -23,23 +23,23 @@ You can use the `fetch` option to explicitly fetch the dependencies:
kapitan compile --fetch
```
-=== "dotfile"
+=== "dotfile"
!!! code "`.kapitan`"
to make it default, then simply use `kapitan compile`
- ```yaml
+ ```yaml
...
compile:
- fetch: true
+ fetch: true
```
-
+
This will download the dependencies and store them at their respective `output_path`.
### Overwrite local changes
-When fetching a dependency, **Kapitan** will refuse to overwrite existing files to preserve your local modifications.
+When fetching a dependency, **Kapitan** will refuse to overwrite existing files to preserve your local modifications.
Use the `force-fetch` option to force overwrite your local files in the `output_path`.
@@ -50,15 +50,15 @@ Use the `force-fetch` option to force overwrite your local files in the `output_
kapitan compile --force-fetch
```
-=== "dotfile"
+=== "dotfile"
!!! code "`.kapitan`"
to make it default, then simply use `kapitan compile`
- ```yaml
+ ```yaml
...
compile:
- force-fetch: true
+ force-fetch: true
```
### Caching
@@ -87,7 +87,7 @@ Kapitan also supports caching Use the `--cache` flag to cache the fetched items
submodules: true/false (optional) # mkdocs (4)!
```
- 1. Git types can fetch external `git` repositories through either HTTP/HTTPS or SSH URLs.
+ 1. Git types can fetch external `git` repositories through either HTTP/HTTPS or SSH URLs.
2. Optional supports for cloning just a sub-directory
3. Optional support for accessing them in specific commits and branches (refs).
4. Optional support to disable fetching the submodules of a repo.
@@ -130,7 +130,7 @@ Kapitan also supports caching Use the `--cache` flag to cache the fetched items
- type: http | https # mkdocs (2)!
output_path: path/to/file # mkdocs (1)!
source: http[s]:// # mkdocs (2)!
- unpack: True | False # mkdocs (3)!
+ unpack: True | False # mkdocs (3)!
```
1. `output_path` must fully specify the file name. For example:
@@ -214,4 +214,3 @@ Kapitan also supports caching Use the `--cache` flag to cache the fetched items
namespace: monitoring
name: prometheus
```
-
diff --git a/docs/pages/input_types/copy.md b/docs/pages/input_types/copy.md
index f14140563..d8ab72a52 100644
--- a/docs/pages/input_types/copy.md
+++ b/docs/pages/input_types/copy.md
@@ -16,4 +16,3 @@ Example
- resources/state/${target_name}/.terraform.lock.hcl
output_path: terraform/
```
-
diff --git a/docs/pages/input_types/introduction.md b/docs/pages/input_types/introduction.md
index f42cd2e50..aabce4cf4 100644
--- a/docs/pages/input_types/introduction.md
+++ b/docs/pages/input_types/introduction.md
@@ -22,7 +22,7 @@ graph LR
subgraph "fetch"
F{"fetch?"}
FETCH["fetch dependencies"]
- end
+ end
subgraph "validate"
V{"validate?"}
@@ -47,7 +47,7 @@ graph LR
V ==> |no| FINISH
VALIDATE --> FINISH
-
+
```
| Step | Flag | Description | Configuration |
@@ -70,8 +70,8 @@ Input types can be specified in the inventory under `kapitan.compile` in the fol
kapitan:
compile:
- output_path:
- input_type: jinja2
- input_params: # (1)!
+ input_type: jinja2
+ input_params: # (1)!
input_paths:
- directory/
- file
@@ -88,8 +88,8 @@ Input types can be specified in the inventory under `kapitan.compile` in the fol
kapitan:
compile:
- output_path:
- input_type: jsonnet
- prune: false # (1)!
+ input_type: jsonnet
+ prune: false # (1)!
input_paths:
- directory/
- file
@@ -105,8 +105,8 @@ Input types can be specified in the inventory under `kapitan.compile` in the fol
kapitan:
compile:
- output_path:
- input_type: kadet
- prune: false # (1)!
+ input_type: kadet
+ prune: false # (1)!
input_paths:
- directory/
- file
@@ -124,8 +124,8 @@ Input types can be specified in the inventory under `kapitan.compile` in the fol
kapitan:
compile:
- output_path:
- input_type: helm
- prune: false # (1)!
+ input_type: helm
+ prune: false # (1)!
input_paths:
- directory/
- file
@@ -141,8 +141,8 @@ Input types can be specified in the inventory under `kapitan.compile` in the fol
kapitan:
compile:
- output_path:
- input_type: copy
- prune: false # (1)!
+ input_type: copy
+ prune: false # (1)!
input_paths:
- directory/
- file
diff --git a/docs/pages/input_types/jinja.md b/docs/pages/input_types/jinja.md
index e801d05aa..eb8fb0bf3 100644
--- a/docs/pages/input_types/jinja.md
+++ b/docs/pages/input_types/jinja.md
@@ -62,7 +62,7 @@ We usually store script templates under the `templates/scripts` directory.
--8<-- "kubernetes/compiled/minikube-nginx-jsonnet/nginx-deploy.sh"
```
- 1. The script is now a "canned script" and ready to be used for this specif target.
+ 1. The script is now a "canned script" and ready to be used for this specif target.
2. You can see that the namespace has been replaced with the target's one.
@@ -115,64 +115,62 @@ Templates will be provided at runtime with 3 variables:
We support the following custom filters for use in Jinja2 templates:
=== "Encoding"
- === "`sha256`"
- !!! example "SHA256 hashing of text"
+ === "`sha256`"
+ !!! example "SHA256 hashing of text"
`{{ text | sha256 }}`
- === "`yaml`"
- !!! example "Dump text as YAML"
+ === "`yaml`"
+ !!! example "Dump text as YAML"
`{{ text | yaml }}`
- === "`toml`"
- !!! example "Dump text as TOML"
+ === "`toml`"
+ !!! example "Dump text as TOML"
`{{ text | toml }}`
- === "`b64encode`"
- !!! example "base64 encode text"
+ === "`b64encode`"
+ !!! example "base64 encode text"
`{{ text | b64encode }}`
- === "`b64decode`"
- !!! example "base64 decode text"
+ === "`b64decode`"
+ !!! example "base64 decode text"
`{{ text | b64decode }}`
=== "Time"
- === "`to_datetime`"
+ === "`to_datetime`"
!!! example "return datetime object for string"
`{{ "2019-03-07 13:37:00" | to_datetime }}`
- === "`strftime`"
+ === "`strftime`"
!!! example "return current date string for format"
`{{ "%a, %d %b %Y %H:%M" | strftime }}`
=== "Regexp"
- === "`regex_replace`"
+ === "`regex_replace`"
!!! example "perform a `re.sub` returning a string"
`{{ hello world | regex_replace(pattern="world", replacement="kapitan")}}`
- === "`regex_escape`"
+ === "`regex_escape`"
!!! example "escape all regular expressions special characters from string"
`{{ "+s[a-z].*" | regex_escape}}`
- === "`regex_search`"
+ === "`regex_search`"
!!! example "perform `re.search` and return the list of matches or a backref"
`{{ hello world | regex_search("world.*")}}`
- === "`regex_findall`"
+ === "`regex_findall`"
!!! example "perform `re.findall` and return the list of matches as array"
- `{{ hello world | regex_findall("world.*")}}`
-=== "`fileglob`"
- !!! example "return list of matched regular files for glob"
+ `{{ hello world | regex_findall("world.*")}}`
+=== "`fileglob`"
+ !!! example "return list of matched regular files for glob"
`{{ ./path/file* | fileglob }}`
-=== "`bool`"
- !!! example "return the bool for value"
+=== "`bool`"
+ !!! example "return the bool for value"
`{{ yes | bool }}`
-=== "`ternary`"
- !!! example "`value ? true_val : false_val`"
+=== "`ternary`"
+ !!! example "`value ? true_val : false_val`"
`{{ condition | ternary("yes", "no")}}`
-=== "`shuffle`"
- !!! example "randomly shuffle elements of a list"
+=== "`shuffle`"
+ !!! example "randomly shuffle elements of a list"
`{{ [1, 2, 3, 4, 5] | shuffle }}`
-=== "`reveal_maybe`"
- !!! example "reveal `ref/secret` tag only if `compile --reveal` flag is set"
+=== "`reveal_maybe`"
+ !!! example "reveal `ref/secret` tag only if `compile --reveal` flag is set"
`{{ "?{base64:my_ref}" | reveal_maybe}}`
!!! tip
You can also provide path to your custom filter modules in CLI. By default, you can put your filters in `lib/jinja2_filters.py` and they will automatically get loaded.
-
-
diff --git a/docs/pages/input_types/jsonnet.md b/docs/pages/input_types/jsonnet.md
index 1b86023e7..342d49cc3 100644
--- a/docs/pages/input_types/jsonnet.md
+++ b/docs/pages/input_types/jsonnet.md
@@ -133,4 +133,3 @@ If `validation.valid` is not true, it will then fail compilation and display `va
Compile error: failed to compile target: minikube-mysql
```
-
diff --git a/docs/pages/input_types/kadet.md b/docs/pages/input_types/kadet.md
index a84f09717..970981433 100644
--- a/docs/pages/input_types/kadet.md
+++ b/docs/pages/input_types/kadet.md
@@ -1,6 +1,6 @@
# :kapitan-logo: **Input Type | Kadet**
-Kadet is an extensible **input type** for **Kapitan** that enables you to generate templates using **Python**.
+Kadet is an extensible **input type** for **Kapitan** that enables you to generate templates using **Python**.
The key benefit being the ability to utilize familiar programing principles while having access to **Kapitan**'s powerful inventory system.
@@ -36,9 +36,9 @@ class Deployment(BaseObj): # (1)!
self.root.spec.template.spec.containers = self.kwargs.containers
```
-1. The deployment is an `BaseObj()` which has two main functions.
+1. The deployment is an `BaseObj()` which has two main functions.
2. `new(self)` is used to perform parameter validation & template compilation
-3. `body(self)` is utilized to set those parameters to be rendered.
+3. `body(self)` is utilized to set those parameters to be rendered.
4. `self.root.metadata.name` is a direct reference to a key in the corresponding yaml.
diff --git a/docs/pages/input_types/remove.md b/docs/pages/input_types/remove.md
index 660112765..d68eba737 100644
--- a/docs/pages/input_types/remove.md
+++ b/docs/pages/input_types/remove.md
@@ -45,4 +45,3 @@ parameters:
The first input block would throw an error because the copy input command hasn't run yet to produce the file being removed by the remove input block.
*Supported output types*: N/A (no need to specify `output_type`)
-
diff --git a/docs/pages/inventory/advanced.md b/docs/pages/inventory/advanced.md
index ef70fdbab..0057f80da 100644
--- a/docs/pages/inventory/advanced.md
+++ b/docs/pages/inventory/advanced.md
@@ -40,5 +40,3 @@ For instance you could define the following:
Compiled acme (0.06s)
Compiled acme-documentation (0.09s)
```
-
-
diff --git a/docs/pages/inventory/classes.md b/docs/pages/inventory/classes.md
index 72a8c404b..d11812737 100644
--- a/docs/pages/inventory/classes.md
+++ b/docs/pages/inventory/classes.md
@@ -6,7 +6,7 @@ The next thing you want to learn about the inventory are [**classes**](#classes)
[**Classes**](#classes) are *fragments* of yaml: feature sets, commonalities between targets. [**Classes**](#classes) let you compose your [**Inventory**](/inventory/) from smaller bits, eliminating duplication and exposing all important parameters from a single, logically organised place. As the [**Inventory**](#inventory) lets you reference other parameters in the hierarchy, [**classes**](#classes) become places where you can define something that will then get referenced from another section of the inventory, allowing for composition.
-[**Classes**](#classes) are organised under the [`inventory/classes`](#classes) directory substructure.
+[**Classes**](#classes) are organised under the [`inventory/classes`](#classes) directory substructure.
They are organised hierarchically in subfolders, and the way they can be imported into a [**target**](#targets) or other [**classes**](#classes) depends on their location relative to the [`inventory/classes`](#classes) directory.
@@ -52,4 +52,3 @@ If we open the file, we find another familiar yaml fragment.
Notice that this class includes an import definition for another class, `kapitan.common`. We've already learned this means that kapitan will import a file on disk called `inventory/classes/kapitan/common.yml`
You can also see that in the `parameters` section we now encounter a new syntax which unlocks another powerful inventory feature: *parameters interpolation*!
-
diff --git a/docs/pages/inventory/introduction.md b/docs/pages/inventory/introduction.md
index 3858c9d7d..5e0cc318f 100644
--- a/docs/pages/inventory/introduction.md
+++ b/docs/pages/inventory/introduction.md
@@ -6,9 +6,9 @@ The **Inventory** is a core component of Kapitan: this section aims to explain h
The **Inventory** is a hierarchical `YAML` based structure which you use to capture anything that you want to make available to **Kapitan**, so that it can be passed on to its templating engines.
-The first concept to learn about the **Inventory** is the [**target**](#targets). A target is a file, found under the [`inventory/targets`](#targets) substructure, that tells Kapitan what you want to compile. It will usually map to something you want to do with **Kapitan**.
+The first concept to learn about the **Inventory** is the [**target**](#targets). A target is a file, found under the [`inventory/targets`](#targets) substructure, that tells Kapitan what you want to compile. It will usually map to something you want to do with **Kapitan**.
-For instance, you might want to define a [**target**](#targets) for each environment that you want to deploy using **Kapitan**.
+For instance, you might want to define a [**target**](#targets) for each environment that you want to deploy using **Kapitan**.
The **Inventory** lets you also define and reuse common configurations through YAML files that are referred to as [**classes**](#classes): by listing classes into [**target**](#targets), their content gets merged together and allows you to compose complex configurations without repetitions.
diff --git a/docs/pages/inventory/parameters_interpolation.md b/docs/pages/inventory/parameters_interpolation.md
index 04bc273b5..cda59c1b6 100644
--- a/docs/pages/inventory/parameters_interpolation.md
+++ b/docs/pages/inventory/parameters_interpolation.md
@@ -9,20 +9,20 @@
components:
nginx:
image: nginx:latest
- ```
+ ```
+
+ Usually when we want to talk about the `image` subkey, we normally use either of the following:
- Usually when we want to talk about the `image` subkey, we normally use either of the following:
-
* `parameters.components.nginx.image`
* `components.nginx.image`
However, when used in parameter expansion, remember to:
-
- * replace the `.` with `:`
+
+ * replace the `.` with `:`
* omit the `parameters` initial key which is implied
* wrap it into the `${}` variable interpolation syntax
- The correct way to reference `parameters.nginx.image` then becomes `${components:nginx:image}`.
+ The correct way to reference `parameters.nginx.image` then becomes `${components:nginx:image}`.
The [**Inventory**](#inventory) allows you to refer to other values defined elsewhere in the structure, using parameter interpolation.
@@ -33,7 +33,7 @@ Given the example:
parameters:
cluster:
location: europe
-
+
application:
location: ${cluster:location}
@@ -64,4 +64,3 @@ classes:
Here in this case `application.location` refers to a value `location` which has been defined elsewhere, perhaps (but not necessarily) in the `project.production` class.
Also notice that the class name (`project.production`) is not in any ways influencing the name or the structed of the yaml it imports into the file
-
diff --git a/docs/pages/inventory/targets.md b/docs/pages/inventory/targets.md
index 48da8a0f5..439bcb000 100644
--- a/docs/pages/inventory/targets.md
+++ b/docs/pages/inventory/targets.md
@@ -92,7 +92,7 @@ A typical [**target**](#targets) might look like this:
Note that it is made of 2 sections:
* `classes` is a list of class files you will want to import.
-* `parameters` allows for local override of what is unique to this target.
+* `parameters` allows for local override of what is unique to this target.
!!! info
diff --git a/docs/pages/kapitan_overview.md b/docs/pages/kapitan_overview.md
index d75a5a933..0313444d9 100644
--- a/docs/pages/kapitan_overview.md
+++ b/docs/pages/kapitan_overview.md
@@ -2,7 +2,7 @@
## **Kapitan** at a glance
-**Kapitan** is a powerful configuration management tool designed to help engineers manage complex systems through code. It centralizes and simplifies the management of configurations with a structured approach that revolves around a few core concepts.
+**Kapitan** is a powerful configuration management tool designed to help engineers manage complex systems through code. It centralizes and simplifies the management of configurations with a structured approach that revolves around a few core concepts.
??? note "**Kapitan** diagram"
```mermaid
@@ -31,12 +31,12 @@
OTHER --> REFERENCES
PLAIN --> REFERENCES
OUTPUT --> TARGETN_OUTPUT
- OUTPUT --> TARGET1_OUTPUT
- OUTPUT --> TARGET2_OUTPUT
+ OUTPUT --> TARGET1_OUTPUT
+ OUTPUT --> TARGET2_OUTPUT
REFERENCES --> KAPITAN
- TARGET1_OUTPUT --> DOCUMENTATION
+ TARGET1_OUTPUT --> DOCUMENTATION
TARGET1_OUTPUT --> KUBERNETES
- TARGET1_OUTPUT --> SCRIPTS
+ TARGET1_OUTPUT --> SCRIPTS
TARGET1_OUTPUT --> TERRAFORM
CLASSES --> TARGET1
CLASSES --> TARGET2
@@ -62,7 +62,7 @@
KAPITAN(("")):::blue
click EXTERNAL "/compile#external"
- subgraph "Input Types"
+ subgraph "Input Types"
EXTERNAL["external"]
GENERATORS["generators"]
HELM["helm"]
@@ -82,7 +82,7 @@
SCRIPTS["scripts"]
TERRAFORM["terraform"]
end
-
+
TARGET2_OUTPUT(["target 2"])
TARGETN_OUTPUT(["target N"])
@@ -92,7 +92,7 @@ Let's explore these concepts in a way that's accessible to new users:
## [**Inventory**](/pages/inventory/introduction/)
-At the core of **Kapitan** lies the **Inventory**, a structured database of variables meticulously organized in YAML files.
+At the core of **Kapitan** lies the **Inventory**, a structured database of variables meticulously organized in YAML files.
This hierarchical setup serves as the single source of truth (SSOT) for your system's configurations, making it easier to manage and reference the essential components of your infrastructure. Whether you're dealing with Kubernetes configurations, Terraform resources, or even business logic, the Inventory allows you to define and store these elements efficiently. This central repository then feeds into **Kapitan**'s templating engines, enabling seamless reuse across various applications and services.
diff --git a/docs/pages/remote_repositories.md b/docs/pages/remote_repositories.md
index b9001b167..2ef9b8ce9 100644
--- a/docs/pages/remote_repositories.md
+++ b/docs/pages/remote_repositories.md
@@ -30,13 +30,13 @@ parameters:
### Example
Lets say we want to fetch a class from our kapitan repository, specifically
-`kapicorp/kapitan/tree/master/examples/docker/inventory/classes/dockerfiles.yml`.
+`kapicorp/kapitan/tree/master/examples/docker/inventory/classes/dockerfiles.yml`.
Lets create a simple target file `docker.yml`
!!! example ""
- !!! note
+ !!! note
[external dependencies](external_dependencies.md) are used to fetch dependency items in this example.
@@ -77,7 +77,7 @@ Lets create a simple target file `docker.yml`
kapitan compile --fetch
```
- ??? example "click to expand output"
+ ??? example "click to expand output"
```shell
[WARNING] Reclass class not found: 'dockerfiles'. Skipped!
[WARNING] Reclass class not found: 'dockerfiles'. Skipped!
@@ -136,13 +136,13 @@ parameters:
kapitan compile --fetch
```
- ??? example "click to expand output"
+ ??? example "click to expand output"
```shell
./kapitan compile -t mysql-generator-fetch --fetch
Inventory https://raw.githubusercontent.com/kapicorp/kapitan-reference/master/inventory/classes/kapitan/generators/kubernetes.yml: fetching now
Inventory https://raw.githubusercontent.com/kapicorp/kapitan-reference/master/inventory/classes/kapitan/generators/kubernetes.yml: successfully fetched
Inventory https://raw.githubusercontent.com/kapicorp/kapitan-reference/master/inventory/classes/kapitan/generators/kubernetes.yml: saved to inventory/classes/kapitan/generators/kubernetes.yml
-
+
...
cut
...
diff --git a/docs/references.md b/docs/references.md
index 59ca998cf..93783d67f 100644
--- a/docs/references.md
+++ b/docs/references.md
@@ -25,7 +25,7 @@ Some reference backends require configuration, both in the Inventory and to conf
!!! tip "**Get started**"
If you want to get started with references but don't want to deal with the initial setup, you can use the `plain` and `base64` reference types. These are great for demos, but we will see they are extremely helpful even in Production environments.
-
+
!!! danger
Both `plain` and `base64` references do not support encryption: they are intended for development or demo purposes only.
*DO NOT* use `plain` or `base64` for storing sensitive information!
@@ -126,8 +126,8 @@ Some reference backends require configuration, both in the Inventory and to conf
```
??? tip "ADVANCED: Mix-and-Match backends"
- Remember that you can use multiple backends at the same time, and also use variable interpolation for an even greater flexibility.
-
+ Remember that you can use multiple backends at the same time, and also use variable interpolation for an even greater flexibility.
+
In a multi-cloud setup, for instance, you could configure both **GKMS**
!!! quote "GCP configuration"
@@ -165,7 +165,7 @@ Some reference backends require configuration, both in the Inventory and to conf
- security.backends.awskms
...
```
-
+
Now because they both set the `parameters.backend` variable, you can define a reference whose backend changes based on what class is assigned to the target
!!! example "`inventory/targets/cloud/gcp/acme.yml`"
@@ -188,9 +188,9 @@ Some reference backends require configuration, both in the Inventory and to conf
References can be defined in the inventory following the syntax ***spaces added for clarity***:
`?{` **``** `:` **``** `}`
-
+
??? tip "expand for advanced features"
- The syntax also supports for **process functions** and **create_functions** which we will discuss later, which brings the full syntax to
+ The syntax also supports for **process functions** and **create_functions** which we will discuss later, which brings the full syntax to
!!! example ""
`?{` **``** `:` **``** `}` |**``** ||**``**
@@ -208,7 +208,7 @@ Some reference backends require configuration, both in the Inventory and to conf
!!! danger "not encrypted"
This reference type does not support encryption: it is intended for non sensitive data only. *DO NOT* use `plain` for storing sensitive information!
- === "base64"
+ === "base64"
```yaml
parameters:
...
@@ -359,8 +359,8 @@ You can assign values to your reference using the command line. Both reading fro
!!! note "Setting default value only"
The `env` backend works in a slightly different ways, as it allows you to reference environment variables at runtime.
- For example, for a reference called **`{?env:targets/envs_defaults/mysql_port_${target_name}}`**, **Kapitan** would look for an environment variable called **`KAPITAN_ENV_mysql_port_${TARGET_NAME}`**.
-
+ For example, for a reference called **`{?env:targets/envs_defaults/mysql_port_${target_name}}`**, **Kapitan** would look for an environment variable called **`KAPITAN_ENV_mysql_port_${TARGET_NAME}`**.
+
If that variable cannot be found in the **Kapitan** environment, the default will be taken from the **`refs/targets/envs_defaults/mysql_port_${TARGET_NAME}`** file instead.
```shell
@@ -385,7 +385,7 @@ You can assign values to your reference using the command line. Both reading fro
```
=== "vaulttransit"
- This backend expects the value to be stored as a `key:value` pair.
+ This backend expects the value to be stored as a `key:value` pair.
```shell
echo "a_key:a_value" | kapitan refs --write vaulttransit:refs/targets/${TARGET_NAME}/mysql/root_password -t ${TARGET_NAME} -f -
@@ -412,8 +412,8 @@ For instance, to automatically initialise a reference with a ***random string***
```
!!! note "Initialise non existent references"
- The first operator here `||` is more similar to a ***logical OR***.
-
+ The first operator here `||` is more similar to a ***logical OR***.
+
* If the reference file does not exist, **Kapitan** will use the function to initialise it
* If the reference file exists, no functions will run.
@@ -468,7 +468,7 @@ For instance, to automatically initialise a reference with a ***random string***
=== "private keys"
=== "rsa"
!!! quote ""
- Generates an RSA 4096 private key (PKCS#8). You can optionally pass the key size
+ Generates an RSA 4096 private key (PKCS#8). You can optionally pass the key size
```yaml
?{${backend}:targets/${target_name}/private_key||rsa}
```
@@ -619,7 +619,7 @@ I can not reference the link to the cluster in the inventory using:
```yaml
parameters:
cluster:
- name: ?{plain:clusters/${target_name}/cluster@name}
+ name: ?{plain:clusters/${target_name}/cluster@name}
release_channel: ?{plain:clusters/${target_name}/cluster@releaseChannel.channel}
link: ?{plain:clusters/${target_name}/cluster@selfLink}
```
@@ -655,7 +655,7 @@ To write a secret in the vault with kapitan use a ref tag with following structu
...
```
-Leave `mount` empty to use the specified mount from vault params from the inventory (see below). Same applies to the `path/in/vault` where the ref path in kapitan gets taken as default value.
+Leave `mount` empty to use the specified mount from vault params from the inventory (see below). Same applies to the `path/in/vault` where the ref path in kapitan gets taken as default value.
Parameters in the secret file are collected from the inventory of the target we gave from CLI `-t `. If target isn't provided then kapitan will identify the variables from the environment when revealing secret.
diff --git a/kapitan/__init__.py b/kapitan/__init__.py
index cdc55f2c1..f91ad742c 100755
--- a/kapitan/__init__.py
+++ b/kapitan/__init__.py
@@ -5,9 +5,9 @@
#
# SPDX-License-Identifier: Apache-2.0
+import logging
import os
import sys
-import logging
def setup_logging(name=None, level=logging.INFO, force=False):
diff --git a/kapitan/cached.py b/kapitan/cached.py
index 9a44c38ca..d4dd1aebf 100644
--- a/kapitan/cached.py
+++ b/kapitan/cached.py
@@ -19,7 +19,7 @@
dot_kapitan = {}
ref_controller_obj = None
revealer_obj = None
-args = Namespace() # args won't need resetting
+args = Namespace() # args won't need resetting
inv_sources = set()
diff --git a/kapitan/cli.py b/kapitan/cli.py
index 062a78c54..db6bc477a 100644
--- a/kapitan/cli.py
+++ b/kapitan/cli.py
@@ -94,14 +94,20 @@ def trigger_compile(args):
jinja2_filters=args.jinja2_filters,
verbose=args.verbose,
use_go_jsonnet=args.use_go_jsonnet,
- compose_target_name=args.compose_target_name
+ compose_target_name=args.compose_target_name,
)
def build_parser():
parser = argparse.ArgumentParser(prog=PROJECT_NAME, description=DESCRIPTION)
parser.add_argument("--version", action="version", version=VERSION)
- parser.add_argument("--mp-method", action="store", default=from_dot_kapitan("global", "mp-method", "spawn"), help="set multiprocessing start method", choices=["spawn", "fork", "forkserver"])
+ parser.add_argument(
+ "--mp-method",
+ action="store",
+ default=from_dot_kapitan("global", "mp-method", "spawn"),
+ help="set multiprocessing start method",
+ choices=["spawn", "fork", "forkserver"],
+ )
subparser = parser.add_subparsers(help="commands", dest="subparser_name")
inventory_backend_parser = argparse.ArgumentParser(add_help=False)
@@ -120,10 +126,13 @@ def build_parser():
)
inventory_backend_parser.add_argument(
- "--compose-target-name", "--compose-target-name",
+ "--compose-target-name",
+ "--compose-target-name",
help="Create same subfolder structure from inventory/targets inside compiled folder",
action="store_true",
- default=from_dot_kapitan("global", "compose-target-name", from_dot_kapitan("compile", "compose-node-name", False)),
+ default=from_dot_kapitan(
+ "global", "compose-target-name", from_dot_kapitan("compile", "compose-node-name", False)
+ ),
)
eval_parser = subparser.add_parser("eval", aliases=["e"], help="evaluate jsonnet file")
@@ -612,7 +621,7 @@ def main():
# and will raise RuntimeError
except RuntimeError:
pass
-
+
if getattr(args, "func", None) == generate_inventory and args.pattern and args.target_name == "":
parser.error("--pattern requires --target_name")
@@ -622,8 +631,8 @@ def main():
parser.print_help()
sys.exit(1)
- cached.args = args
-
+ cached.args = args
+
if hasattr(args, "verbose") and args.verbose:
logging_level = logging.DEBUG
elif hasattr(args, "quiet") and args.quiet:
diff --git a/kapitan/dependency_manager/base.py b/kapitan/dependency_manager/base.py
index 7b218d4ff..3aae6b3a7 100644
--- a/kapitan/dependency_manager/base.py
+++ b/kapitan/dependency_manager/base.py
@@ -11,17 +11,17 @@
from mimetypes import MimeTypes
from shutil import copyfile, rmtree
-from git import GitCommandError
-from git import Repo
-from kapitan.errors import GitSubdirNotFoundError, GitFetchingError, HelmFetchingError
+from git import GitCommandError, Repo
+
+from kapitan.errors import GitFetchingError, GitSubdirNotFoundError, HelmFetchingError
from kapitan.helm_cli import helm_cli
from kapitan.utils import (
copy_tree,
make_request,
- unpack_downloaded_file,
- safe_copy_tree,
- safe_copy_file,
normalise_join_path,
+ safe_copy_file,
+ safe_copy_tree,
+ unpack_downloaded_file,
)
logger = logging.getLogger(__name__)
@@ -235,10 +235,12 @@ def fetch_helm_chart(dep_mapping, save_dir, force):
for dep in deps:
output_path = dep["output_path"]
-
+
if not os.path.exists(output_path) or force:
if not exists_in_cache(cached_repo_path):
- fetch_helm_archive(source.helm_path, source.repo, source.chart_name, source.version, cached_repo_path)
+ fetch_helm_archive(
+ source.helm_path, source.repo, source.chart_name, source.version, cached_repo_path
+ )
else:
logger.debug("Using cached helm chart at %s", cached_repo_path)
diff --git a/kapitan/initialiser.py b/kapitan/initialiser.py
index 46d699150..f77ae8256 100644
--- a/kapitan/initialiser.py
+++ b/kapitan/initialiser.py
@@ -9,6 +9,7 @@
import logging
import os
+
from kapitan.utils import copy_tree
logger = logging.getLogger(__name__)
diff --git a/kapitan/inputs/base.py b/kapitan/inputs/base.py
index 63de2d26d..a38a72783 100644
--- a/kapitan/inputs/base.py
+++ b/kapitan/inputs/base.py
@@ -12,13 +12,13 @@
import os
from collections.abc import Mapping
-import yaml
import toml
+import yaml
+from kapitan import cached
from kapitan.errors import CompileError, KapitanError
from kapitan.refs.base import Revealer
from kapitan.utils import PrettyDumper
-from kapitan import cached
logger = logging.getLogger(__name__)
@@ -129,14 +129,14 @@ def write_yaml(self, obj):
# TODO(ademaria): make it configurable per input type
style_selection = cached.inv[target_name]["parameters"].get("multiline_string_style", None)
- if not style_selection:
+ if not style_selection:
if hasattr(cached.args, "multiline_string_style"):
style_selection = cached.args.multiline_string_style
elif hasattr(cached.args, "yaml_multiline_string_style"):
style_selection = cached.args.yaml_multiline_string_style
dumper = PrettyDumper.get_dumper_for_style(style_selection)
-
+
if reveal:
obj = self.revealer.reveal_obj(obj)
else:
diff --git a/kapitan/inputs/copy.py b/kapitan/inputs/copy.py
index 4706950bd..4dd7eba82 100644
--- a/kapitan/inputs/copy.py
+++ b/kapitan/inputs/copy.py
@@ -8,9 +8,9 @@
import logging
import os
import shutil
-from kapitan.utils import copy_tree
from kapitan.inputs.base import InputType
+from kapitan.utils import copy_tree
logger = logging.getLogger(__name__)
diff --git a/kapitan/inputs/external.py b/kapitan/inputs/external.py
index 6faaaa02b..ec0a55260 100644
--- a/kapitan/inputs/external.py
+++ b/kapitan/inputs/external.py
@@ -5,14 +5,14 @@
#
# SPDX-License-Identifier: Apache-2.0
-import subprocess
-import re
import logging
import os
+import re
import shutil
-from kapitan.utils import copy_tree
+import subprocess
from kapitan.inputs.base import InputType
+from kapitan.utils import copy_tree
logger = logging.getLogger(__name__)
diff --git a/kapitan/inputs/jinja2.py b/kapitan/inputs/jinja2.py
index 0f741ba70..ba083e483 100644
--- a/kapitan/inputs/jinja2.py
+++ b/kapitan/inputs/jinja2.py
@@ -8,10 +8,11 @@
import logging
import os
+from kapitan import cached
from kapitan.inputs.base import CompiledFile, InputType
from kapitan.resources import inventory
from kapitan.utils import render_jinja2
-from kapitan import cached
+
logger = logging.getLogger(__name__)
diff --git a/kapitan/inputs/jinja2_filters.py b/kapitan/inputs/jinja2_filters.py
index c810ac541..b55fe793c 100644
--- a/kapitan/inputs/jinja2_filters.py
+++ b/kapitan/inputs/jinja2_filters.py
@@ -18,9 +18,10 @@
import toml
import yaml
+from six import string_types
+
from kapitan import cached, defaults, utils
from kapitan.errors import CompileError
-from six import string_types
logger = logging.getLogger(__name__)
diff --git a/kapitan/inputs/kadet.py b/kapitan/inputs/kadet.py
index 2363f8b09..30c95f927 100644
--- a/kapitan/inputs/kadet.py
+++ b/kapitan/inputs/kadet.py
@@ -10,16 +10,17 @@
import logging
import os
import sys
-from importlib.util import module_from_spec, spec_from_file_location
import time
+from functools import lru_cache
+from importlib.util import module_from_spec, spec_from_file_location
+
import kadet
from kadet import BaseModel, BaseObj, Dict
+from kapitan import cached
from kapitan.errors import CompileError
-from functools import lru_cache
from kapitan.inputs.base import CompiledFile, InputType
from kapitan.utils import prune_empty
-from kapitan import cached
# Set external kadet exception to kapitan.error.CompileError
kadet.ABORT_EXCEPTION_TYPE = CompileError
@@ -65,6 +66,7 @@ def module_from_path(path, check_name=None):
return mod, spec
+
def load_from_search_paths(module_name):
"""
loads and executes python module with module_name from search paths
diff --git a/kapitan/inputs/remove.py b/kapitan/inputs/remove.py
index 3213d8e73..20015fca1 100644
--- a/kapitan/inputs/remove.py
+++ b/kapitan/inputs/remove.py
@@ -8,9 +8,9 @@
import logging
import os
import shutil
-from kapitan.utils import copy_tree
from kapitan.inputs.base import InputType
+from kapitan.utils import copy_tree
logger = logging.getLogger(__name__)
diff --git a/kapitan/inputs/templates/inventory/classes/my_component.yml b/kapitan/inputs/templates/inventory/classes/my_component.yml
index ed6cf270a..d70ffd84c 100644
--- a/kapitan/inputs/templates/inventory/classes/my_component.yml
+++ b/kapitan/inputs/templates/inventory/classes/my_component.yml
@@ -26,4 +26,4 @@ parameters:
input_type: kadet
output_type: yaml
input_paths:
- - components/other_component/
\ No newline at end of file
+ - components/other_component/
diff --git a/kapitan/inputs/templates/templates/scripts/my_script.sh b/kapitan/inputs/templates/templates/scripts/my_script.sh
index 3a0690074..ba8c80105 100644
--- a/kapitan/inputs/templates/templates/scripts/my_script.sh
+++ b/kapitan/inputs/templates/templates/scripts/my_script.sh
@@ -5,4 +5,3 @@ DIR=$(dirname ${BASH_SOURCE[0]})
echo "Running for target {{ i.target_name }}"
echo ${DIR}
-
diff --git a/kapitan/inventory/__init__.py b/kapitan/inventory/__init__.py
index be670c104..b61057664 100644
--- a/kapitan/inventory/__init__.py
+++ b/kapitan/inventory/__init__.py
@@ -12,6 +12,7 @@ class InventoryBackends(StrEnum):
"""
Enumeration of available inventory backends.
"""
+
RECLASS = "reclass"
RECLASS_RS = "reclass-rs"
OMEGACONF = "omegaconf"
@@ -23,6 +24,7 @@ def load_reclass_backend():
Enable the reclass inventory backend.
"""
from .inv_reclass import ReclassInventory
+
return ReclassInventory
@@ -31,6 +33,7 @@ def load_reclass_rs_backend():
Enable the reclass-rs inventory backend.
"""
from .inv_reclass_rs import ReclassRsInventory
+
return ReclassRsInventory
@@ -39,6 +42,7 @@ def load_omegaconf_backend():
Enable the omegaconf inventory backend.
"""
from .inv_omegaconf.inv_omegaconf import OmegaConfInventory
+
return OmegaConfInventory
@@ -55,4 +59,4 @@ def get_inventory_backend(backend_name: str) -> Type[Inventory]:
"""
Get the `Inventory` subclass associated with the given `backend_name`.
"""
- return AVAILABLE_BACKENDS.get(backend_name, AVAILABLE_BACKENDS[InventoryBackends.DEFAULT])()
\ No newline at end of file
+ return AVAILABLE_BACKENDS.get(backend_name, AVAILABLE_BACKENDS[InventoryBackends.DEFAULT])()
diff --git a/kapitan/inventory/inv_omegaconf/inv_omegaconf.py b/kapitan/inventory/inv_omegaconf/inv_omegaconf.py
index a2449083d..f7c4a1bb7 100644
--- a/kapitan/inventory/inv_omegaconf/inv_omegaconf.py
+++ b/kapitan/inventory/inv_omegaconf/inv_omegaconf.py
@@ -10,17 +10,20 @@
import os
import time
from functools import singledispatch
-from cachetools import cached, LRUCache
-from omegaconf import OmegaConf, ListMergeMode, DictConfig
-from pydantic import ConfigDict
-from ..inventory import InventoryError, Inventory, InventoryTarget
-from .resolvers import register_resolvers, register_user_resolvers
+
+import yaml
+from cachetools import LRUCache, cached
from kadet import Dict
+from omegaconf import DictConfig, ListMergeMode, OmegaConf
+from pydantic import ConfigDict
+
+from ..inventory import Inventory, InventoryError, InventoryTarget
from .migrate import migrate
-import yaml
+from .resolvers import register_resolvers, register_user_resolvers
logger = logging.getLogger(__name__)
+
@singledispatch
def keys_to_strings(ob):
return ob
@@ -35,14 +38,14 @@ def _handle_dict(ob: dict):
def _handle_list(ob: list):
return [keys_to_strings(v) for v in ob]
-
+
class OmegaConfTarget(InventoryTarget):
resolved: bool = False
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.__add_metadata()
-
+
def __add_metadata(self):
metadata = {
"name": {
@@ -60,17 +63,21 @@ class OmegaConfInventory(Inventory):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs, target_class=OmegaConfTarget)
- def render_targets(self, targets: list[OmegaConfTarget] = None, ignore_class_not_found: bool = False) -> None:
+ def render_targets(
+ self, targets: list[OmegaConfTarget] = None, ignore_class_not_found: bool = False
+ ) -> None:
if not self.initialised:
manager = mp.Manager()
shared_targets = manager.dict()
with mp.Pool(min(len(targets), os.cpu_count())) as pool:
- r = pool.map_async(self.inventory_worker, [(self, target, shared_targets) for target in targets.values()])
+ r = pool.map_async(
+ self.inventory_worker, [(self, target, shared_targets) for target in targets.values()]
+ )
r.wait()
-
+
for target in shared_targets.values():
self.targets[target.name] = target
-
+
@staticmethod
def inventory_worker(zipped_args):
self, target, shared_targets = zipped_args
@@ -78,46 +85,45 @@ def inventory_worker(zipped_args):
register_resolvers()
self.load_target(target)
shared_targets[target.name] = target
-
+
except Exception as e:
logger.error(f"{target.name}: could not render due to error {e}")
raise
-
+
@cached(cache=LRUCache(maxsize=1024))
- def resolve_class_file_path(self, class_name: str, class_parent_dir: str = None, class_parent_name: str = None):
+ def resolve_class_file_path(
+ self, class_name: str, class_parent_dir: str = None, class_parent_name: str = None
+ ):
class_file = None
-
- # Finds relative paths based on the parent directory
+
+ # Finds relative paths based on the parent directory
if class_name.startswith(".") and class_parent_dir:
class_path_base = os.path.join(self.classes_path, class_parent_dir)
else:
class_path_base = self.classes_path
-
+
# Now try to find the class file
extension = ".yml"
-
+
cases = [
# case components.kapicorp is absolute and a directory, look for components/kapicorp/init.yml
# case .components.kapicorp is relative and a directory, look for /components/kapicorp/init.yml
os.path.join(class_path_base, *class_name.split("."), "init" + extension),
-
# case components.kapicorp is absolute and a file, look for components/kapicorp.yml
# case components.kapicorp is relative and a file, look for /components/kapicorp.yml
os.path.join(class_path_base, *class_name.split(".")) + extension,
-
# Reclass compatibility mode
# case .components.kapicorp points to /kapicorp.yml
os.path.join(class_path_base, *class_name.split(".")[2:]) + extension,
-
# case components.kapicorp points to components/kapicorp/init.yml
os.path.join(class_path_base, *class_name.split(".")[2:], "init" + extension),
]
-
+
for case in cases:
if os.path.isfile(case):
class_file = case
return class_file
-
+
logger.error(f"class file not found for class {class_name}, tried {cases}")
return None
@@ -125,49 +131,55 @@ def resolve_class_file_path(self, class_name: str, class_parent_dir: str = None,
def load_file(self, filename):
with open(filename, "r") as f:
return yaml.safe_load(f)
-
+
def load_parameters_from_file(self, filename, parameters={}) -> Dict:
parameters = OmegaConf.create(parameters)
applications = []
classes = []
exports = Dict()
-
+
content = self.load_file(filename)
-
+
_classes = content.get("classes", [])
_parameters = keys_to_strings(content.get("parameters", {}))
_applications = content.get("applications", [])
_exports = content.get("exports", {})
- # first processes all classes
+ # first processes all classes
for class_name in _classes:
class_parent_dir = os.path.dirname(filename.removeprefix(self.classes_path).removeprefix("/"))
class_parent_name = os.path.basename(filename)
- class_file = self.resolve_class_file_path(class_name, class_parent_dir=class_parent_dir, class_parent_name=class_parent_name)
+ class_file = self.resolve_class_file_path(
+ class_name, class_parent_dir=class_parent_dir, class_parent_name=class_parent_name
+ )
if not class_file:
if self.ignore_class_not_found:
continue
raise InventoryError(f"Class {class_name} not found")
p, c, a, e = self.load_parameters_from_file(class_file)
if p:
- parameters = OmegaConf.unsafe_merge(parameters, p, list_merge_mode=ListMergeMode.EXTEND_UNIQUE)
+ parameters = OmegaConf.unsafe_merge(
+ parameters, p, list_merge_mode=ListMergeMode.EXTEND_UNIQUE
+ )
classes.extend(c)
classes.append(class_name)
applications.extend(a)
exports.merge_update(e, box_merge_lists="unique")
-
+
# finally merges the parameters from the current file
if _parameters:
- parameters = OmegaConf.unsafe_merge(parameters, _parameters, list_merge_mode=ListMergeMode.EXTEND_UNIQUE)
-
+ parameters = OmegaConf.unsafe_merge(
+ parameters, _parameters, list_merge_mode=ListMergeMode.EXTEND_UNIQUE
+ )
+
exports.merge_update(_exports, box_merge_lists="unique")
applications.extend(_applications)
return parameters, classes, applications, exports
-
+
def load_target(self, target: OmegaConfTarget):
full_target_path = os.path.join(self.targets_path, target.path)
-
+
start = time.perf_counter()
parameters = OmegaConf.create(keys_to_strings(target.parameters))
p, c, a, e = self.load_parameters_from_file(full_target_path, parameters=parameters)
@@ -178,12 +190,14 @@ def load_target(self, target: OmegaConfTarget):
target.applications = a
target.exports = e
finish_loading = time.perf_counter() - start
- logger.debug(f"{target.name}: Config loaded in {load_parameters:.2f}s, resolved in {to_container:.2f}s. Total {finish_loading:.2f}s")
-
+ logger.debug(
+ f"{target.name}: Config loaded in {load_parameters:.2f}s, resolved in {to_container:.2f}s. Total {finish_loading:.2f}s"
+ )
+
def migrate(self):
migrate(self.inventory_path)
-
+
def resolve_targets(self, targets: list[OmegaConfTarget] = None) -> None:
if not targets:
targets = self.targets.values()
- map(lambda target: target.resolve(), targets)
\ No newline at end of file
+ map(lambda target: target.resolve(), targets)
diff --git a/kapitan/inventory/inv_omegaconf/migrate.py b/kapitan/inventory/inv_omegaconf/migrate.py
index fe5afff53..b452a40f6 100644
--- a/kapitan/inventory/inv_omegaconf/migrate.py
+++ b/kapitan/inventory/inv_omegaconf/migrate.py
@@ -54,7 +54,14 @@ def migrate_str(content: str):
# migrate meta data name
updated_content = regex.sub(
r"(?")
sys.exit(1)
-
+
print(f"Migrating all .yml/.yaml files in {sys.argv[1]}")
migrate(sys.argv[1])
diff --git a/kapitan/inventory/inv_omegaconf/resolvers.py b/kapitan/inventory/inv_omegaconf/resolvers.py
index 43fd8db99..462099bc5 100644
--- a/kapitan/inventory/inv_omegaconf/resolvers.py
+++ b/kapitan/inventory/inv_omegaconf/resolvers.py
@@ -8,11 +8,12 @@
import copy
import logging
import os
-import yaml
import sys
from typing import Any
-from omegaconf import Container, Node, OmegaConf, ListMergeMode
+import yaml
+from omegaconf import Container, ListMergeMode, Node, OmegaConf
+
logger = logging.getLogger(__name__)
@@ -241,7 +242,6 @@ def register_resolvers() -> None:
OmegaConf.register_new_resolver("not", condition_not, replace=replace)
OmegaConf.register_new_resolver("equal", condition_equal, replace=replace)
-
# user defined resolvers
user_resolver_file = os.path.join(os.getcwd(), "system/omegaconf/resolvers/resolvers.py")
@@ -282,4 +282,4 @@ def register_user_resolvers(user_resolver_file: str) -> None:
try:
OmegaConf.register_new_resolver(name, func, replace=True)
except:
- logger.warning(f"Could not load resolver {name}")
\ No newline at end of file
+ logger.warning(f"Could not load resolver {name}")
diff --git a/kapitan/inventory/inv_reclass.py b/kapitan/inventory/inv_reclass.py
index ecb22f331..5db4650f9 100644
--- a/kapitan/inventory/inv_reclass.py
+++ b/kapitan/inventory/inv_reclass.py
@@ -1,6 +1,5 @@
import logging
import os
-
from datetime import datetime
import reclass
@@ -16,8 +15,10 @@
class ReclassInventory(Inventory):
-
- def render_targets(self, targets: list[InventoryTarget] = None, ignore_class_not_found: bool = False) -> None:
+
+ def render_targets(
+ self, targets: list[InventoryTarget] = None, ignore_class_not_found: bool = False
+ ) -> None:
"""
Runs a reclass inventory in inventory_path
(same output as running ./reclass.py -b inv_base_uri/ --inventory)
diff --git a/kapitan/inventory/inv_reclass_rs.py b/kapitan/inventory/inv_reclass_rs.py
index 75f6c76e4..ac3c99336 100644
--- a/kapitan/inventory/inv_reclass_rs.py
+++ b/kapitan/inventory/inv_reclass_rs.py
@@ -1,13 +1,13 @@
import logging
import os
-import reclass_rs
-
from datetime import datetime
+import reclass_rs
+
from kapitan.errors import InventoryError
-from .inventory import Inventory, InventoryTarget
from .inv_reclass import get_reclass_config
+from .inventory import Inventory, InventoryTarget
logger = logging.getLogger(__name__)
diff --git a/kapitan/inventory/inventory.py b/kapitan/inventory/inventory.py
index 364791e9c..be81bce1b 100644
--- a/kapitan/inventory/inventory.py
+++ b/kapitan/inventory/inventory.py
@@ -5,13 +5,16 @@
#
# SPDX-License-Identifier: Apache-2.0
+import functools
import logging
import os
from abc import ABC, abstractmethod
-import functools
+from typing import Dict
+
from pydantic import BaseModel, Field
+
from kapitan.errors import KapitanError
-from typing import Dict
+
logger = logging.getLogger(__name__)
@@ -25,19 +28,26 @@ class InventoryTarget(BaseModel):
class Inventory(ABC):
- def __init__(self, inventory_path: str = "inventory", compose_target_name: bool = False, ignore_class_not_found=False, initialise=True, target_class=InventoryTarget):
+ def __init__(
+ self,
+ inventory_path: str = "inventory",
+ compose_target_name: bool = False,
+ ignore_class_not_found=False,
+ initialise=True,
+ target_class=InventoryTarget,
+ ):
self.inventory_path = inventory_path
self.compose_target_name = compose_target_name
- self.targets_path = os.path.join(self.inventory_path, 'targets')
- self.classes_path = os.path.join(self.inventory_path, 'classes')
+ self.targets_path = os.path.join(self.inventory_path, "targets")
+ self.classes_path = os.path.join(self.inventory_path, "classes")
self.initialised: bool = False
self.targets: dict[str, target_class] = {}
self.ignore_class_not_found = ignore_class_not_found
self.target_class = target_class
-
+
if initialise:
self.__initialise(ignore_class_not_found=ignore_class_not_found)
-
+
@functools.cached_property
def inventory(self) -> dict:
"""
@@ -62,7 +72,7 @@ def __initialise(self, ignore_class_not_found) -> bool:
name = name.replace(os.sep, ".")
else:
name, ext = os.path.splitext(file)
-
+
if ext not in (".yml", ".yaml"):
logger.debug(f"ignoring {file}: targets have to be .yml or .yaml files.")
continue
@@ -74,9 +84,9 @@ def __initialise(self, ignore_class_not_found) -> bool:
f"Conflicting targets {target.name}: {target.path} and {self.targets[target.name].path}. "
f"Consider using '--compose-target-name'."
)
-
+
self.targets[target.name] = target
-
+
self.render_targets(self.targets, ignore_class_not_found=ignore_class_not_found)
self.initialised = True
return self.initialised
@@ -91,12 +101,16 @@ def get_targets(self, target_names: list[str] = [], ignore_class_not_found: bool
"""
helper function to get rendered InventoryTarget objects for multiple targets
"""
-
+
if target_names:
- return {target_name: self.targets[target_name] for target_name in target_names if target_name in self.targets}
+ return {
+ target_name: self.targets[target_name]
+ for target_name in target_names
+ if target_name in self.targets
+ }
else:
return self.targets
-
+
def get_parameters(self, target_names: str | list[str], ignore_class_not_found: bool = False) -> dict:
"""
helper function to get rendered parameters for single target or multiple targets
@@ -105,10 +119,14 @@ def get_parameters(self, target_names: str | list[str], ignore_class_not_found:
target = self.get_target(target_names, ignore_class_not_found)
return target.parameters
- return {name: {"parameters": Dict(target.parameters)} for name, target in self.get_targets(target_names)}
+ return {
+ name: {"parameters": Dict(target.parameters)} for name, target in self.get_targets(target_names)
+ }
@abstractmethod
- def render_targets(self, targets: list[InventoryTarget] = None, ignore_class_not_found: bool = False) -> None:
+ def render_targets(
+ self, targets: list[InventoryTarget] = None, ignore_class_not_found: bool = False
+ ) -> None:
"""
create the inventory depending on which backend gets used
"""
diff --git a/kapitan/lint.py b/kapitan/lint.py
index 54dd7fe3d..9b2a9c1c4 100644
--- a/kapitan/lint.py
+++ b/kapitan/lint.py
@@ -12,11 +12,12 @@
import sys
from pprint import pformat
-from kapitan.errors import KapitanError
-from kapitan.utils import list_all_paths
from yamllint import linter
from yamllint.config import YamlLintConfig
+from kapitan.errors import KapitanError
+from kapitan.utils import list_all_paths
+
logger = logging.getLogger(__name__)
yamllint_config = """
diff --git a/kapitan/refs/base.py b/kapitan/refs/base.py
index 6ef5d1ff6..81dc36dd0 100644
--- a/kapitan/refs/base.py
+++ b/kapitan/refs/base.py
@@ -18,7 +18,12 @@
import yaml
-from kapitan.errors import RefBackendError, RefError, RefFromFuncError, RefHashMismatchError
+from kapitan.errors import (
+ RefBackendError,
+ RefError,
+ RefFromFuncError,
+ RefHashMismatchError,
+)
from kapitan.refs.functions import eval_func, get_func_lookup
from kapitan.utils import PrettyDumper, list_all_paths
diff --git a/kapitan/refs/base64.py b/kapitan/refs/base64.py
index fea2cacdd..20795c2ce 100644
--- a/kapitan/refs/base64.py
+++ b/kapitan/refs/base64.py
@@ -11,6 +11,7 @@
import logging
import yaml
+
from kapitan.refs.base import PlainRef, PlainRefBackend
try:
diff --git a/kapitan/refs/functions.py b/kapitan/refs/functions.py
index 76ced7dd9..124f1e42b 100644
--- a/kapitan/refs/functions.py
+++ b/kapitan/refs/functions.py
@@ -14,6 +14,7 @@
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import ed25519, rsa
+
from kapitan.errors import RefError
logger = logging.getLogger(__name__)
diff --git a/kapitan/refs/vault_resources.py b/kapitan/refs/vault_resources.py
index 5a581c616..5f56ac008 100644
--- a/kapitan/refs/vault_resources.py
+++ b/kapitan/refs/vault_resources.py
@@ -5,8 +5,9 @@
"hashicorp vault resource functions"
-import os
import logging
+import os
+
import hvac
from kapitan.errors import KapitanError
diff --git a/kapitan/resources.py b/kapitan/resources.py
index dc02f04eb..aa410207f 100644
--- a/kapitan/resources.py
+++ b/kapitan/resources.py
@@ -22,10 +22,16 @@
import kapitan.cached as cached
from kapitan import __file__ as kapitan_install_path
-from kapitan.inputs.kadet import Dict
from kapitan.errors import CompileError, InventoryError, KapitanError
+from kapitan.inputs.kadet import Dict
from kapitan.inventory import Inventory, get_inventory_backend
-from kapitan.utils import PrettyDumper, deep_get, flatten_dict, render_jinja2_file, sha256_string
+from kapitan.utils import (
+ PrettyDumper,
+ deep_get,
+ flatten_dict,
+ render_jinja2_file,
+ sha256_string,
+)
logger = logging.getLogger(__name__)
@@ -328,14 +334,18 @@ def get_inventory(inventory_path, ignore_class_not_found: bool = False) -> Inven
backend_id = hasattr(cached.args, "inventory_backend") and cached.args.inventory_backend
compose_target_name = hasattr(cached.args, "compose_target_name") and cached.args.compose_target_name
backend = get_inventory_backend(backend_id)
-
+
logger.debug(f"Using {backend.__name__} as inventory backend")
- inventory_backend = backend(inventory_path=inventory_path, compose_target_name=compose_target_name, ignore_class_not_found=ignore_class_not_found)
+ inventory_backend = backend(
+ inventory_path=inventory_path,
+ compose_target_name=compose_target_name,
+ ignore_class_not_found=ignore_class_not_found,
+ )
cached.inv = inventory_backend
cached.global_inv = cached.inv.inventory
- # if we use forked processes, we need to load the inventory for kadet once
+ # if we use forked processes, we need to load the inventory for kadet once
# and pass it to the children, to avoid re-reading the inventory for each child
# TODO(adenaria): Improve to only do it for kadet
if hasattr(cached.args, "mp_method") and cached.args.mp_method != "spawn":
diff --git a/kapitan/targets.py b/kapitan/targets.py
index 5611a828e..8449942c8 100644
--- a/kapitan/targets.py
+++ b/kapitan/targets.py
@@ -51,7 +51,10 @@ def compile_targets(
inventory = get_inventory(inventory_path)
discovered_targets = inventory.targets.keys()
- logger.info(f"Rendered inventory (%.2fs): discovered {len(discovered_targets)} targets.", time.time() - rendering_start)
+ logger.info(
+ f"Rendered inventory (%.2fs): discovered {len(discovered_targets)} targets.",
+ time.time() - rendering_start,
+ )
if discovered_targets == 0:
raise CompileError("No inventory targets discovered at path: {inventory_path}")
@@ -60,19 +63,22 @@ def compile_targets(
try:
targets = search_targets(inventory, targets, labels)
-
+
except CompileError as e:
raise CompileError(f"Error searching targets: {e}")
if len(targets) == 0:
raise CompileError(f"No matching targets found in inventory: {labels if labels else desired_targets}")
-
if parallelism is None:
parallelism = min(len(targets), os.cpu_count())
- logger.debug(f"Parallel not set, defaulting to {parallelism} processes {os.cpu_count()} {len(targets)}")
-
- logger.info(f"Compiling {len(targets)}/{len(discovered_targets)} targets using {parallelism} concurrent processes: ({os.cpu_count()} CPU detected)")
+ logger.debug(
+ f"Parallel not set, defaulting to {parallelism} processes {os.cpu_count()} {len(targets)}"
+ )
+
+ logger.info(
+ f"Compiling {len(targets)}/{len(discovered_targets)} targets using {parallelism} concurrent processes: ({os.cpu_count()} CPU detected)"
+ )
with multiprocessing.Pool(parallelism) as pool:
try:
@@ -124,7 +130,7 @@ def compile_targets(
if fetch_objs:
fetch_dependencies(output_path, fetch_objs, dep_cache_dir, True, pool)
logger.info("Fetched dependencies (%.2fs)", time.time() - fetching_start)
-
+
compile_start = time.time()
worker = partial(
compile_target,
@@ -202,7 +208,7 @@ def load_target_inventory(inventory, requested_targets, ignore_class_not_found=F
continue
else:
raise InventoryError(f"InventoryError: {target_name}: parameters is empty")
-
+
kapitan_target_configs = target.parameters["kapitan"]
for comp_obj in kapitan_target_configs["compile"]:
comp_obj.setdefault("input_params", {})
@@ -242,7 +248,9 @@ def search_targets(inventory, targets, labels):
matched_all_labels = True
continue
except KeyError:
- logger.debug(f"search_targets: label {label}={value} didn't match target {target.name} {target_labels}")
+ logger.debug(
+ f"search_targets: label {label}={value} didn't match target {target.name} {target_labels}"
+ )
matched_all_labels = False
break
@@ -266,7 +274,7 @@ def compile_target(target_obj, search_paths, compile_path, ref_controller, globa
# Only populates the cache if the subprocess doesn't have it
if globals_cached and not cached.inv:
cached.from_dict(globals_cached)
-
+
use_go_jsonnet = kwargs.get("use_go_jsonnet", False)
if use_go_jsonnet:
logger.debug("Using go-jsonnet over jsonnet")
@@ -309,7 +317,8 @@ def compile_target(target_obj, search_paths, compile_path, ref_controller, globa
continue
else:
import traceback
+
traceback.print_exception(type(e), e, e.__traceback__)
raise CompileError(f"Error compiling {target_name}: {e}")
- logger.info("Compiled %s (%.2fs)", target_obj["target_full_path"], time.time() - start)
\ No newline at end of file
+ logger.info("Compiled %s (%.2fs)", target_obj["target_full_path"], time.time() - start)
diff --git a/kapitan/utils.py b/kapitan/utils.py
index 1924a5145..442671669 100644
--- a/kapitan/utils.py
+++ b/kapitan/utils.py
@@ -7,16 +7,15 @@
from __future__ import print_function
import collections
-import json
import functools
+import glob
+import json
import logging
-import magic
import math
import os
import re
-import stat
import shutil
-import glob
+import stat
import sys
import tarfile
import traceback
@@ -26,12 +25,16 @@
from zipfile import ZipFile
import jinja2
+import magic
import requests
import yaml
from kapitan import cached, defaults
from kapitan.errors import CompileError
-from kapitan.inputs.jinja2_filters import load_jinja2_filters, load_jinja2_filters_from_file
+from kapitan.inputs.jinja2_filters import (
+ load_jinja2_filters,
+ load_jinja2_filters_from_file,
+)
from kapitan.version import VERSION
logger = logging.getLogger(__name__)
@@ -217,6 +220,7 @@ def get_dumper_for_style(cls, style_selection="double-quotes"):
cls.add_representer(str, functools.partial(multiline_str_presenter, style_selection=style_selection))
return cls
+
def multiline_str_presenter(dumper, data, style_selection="double-quotes"):
"""
Configures yaml for dumping multiline strings with given style.
@@ -224,11 +228,7 @@ def multiline_str_presenter(dumper, data, style_selection="double-quotes"):
Ref: https://github.com/yaml/pyyaml/issues/240#issuecomment-1018712495
"""
- supported_styles = {
- "literal": "|",
- "folded": ">",
- "double-quotes": '"'
- }
+ supported_styles = {"literal": "|", "folded": ">", "double-quotes": '"'}
style = supported_styles.get(style_selection)
@@ -635,7 +635,7 @@ def copy_tree(src: str, dst: str) -> list:
"""
if not os.path.isdir(src):
raise SafeCopyError(f"Cannot copy tree {src}: not a directory")
-
+
if not os.path.isdir(dst):
raise SafeCopyError(f"Cannot copy tree {dst}: not a directory")
diff --git a/overrides/.icons/kapitan/logo.svg b/overrides/.icons/kapitan/logo.svg
index 426380625..2569d2409 100644
--- a/overrides/.icons/kapitan/logo.svg
+++ b/overrides/.icons/kapitan/logo.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/overrides/main.html b/overrides/main.html
index a8d15cdc6..64c418219 100644
--- a/overrides/main.html
+++ b/overrides/main.html
@@ -24,4 +24,4 @@
{% endif %}
{{ page.content }}
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/overrides/partials/comments.html b/overrides/partials/comments.html
index e8a40ecfd..3b8748feb 100644
--- a/overrides/partials/comments.html
+++ b/overrides/partials/comments.html
@@ -25,7 +25,7 @@