Crates.io | helm-templexer |
lib.rs | helm-templexer |
version | 2.0.7 |
source | src |
created_at | 2020-07-27 09:10:15.119471 |
updated_at | 2023-05-09 08:23:27.468684 |
description | Render Kubernetes Helm charts for multiple environments with _explicit config_ while keeping the overhead at ease |
homepage | |
repository | |
max_upload_size | |
id | 270016 |
size | 122,514 |
Render Helm charts for multiple environments with explicit config while keeping the overhead at ease.
The
helm-templexer
wraps Helm v3+, please ensure that it is installed and in thePATH
.
cat > my-app.yaml <<EOF
version: v2
chart: tests/data/nginx-chart
release_name: my-app
output_path: manifests
deployments:
- name: edge
- name: stage
- name: prod
EOF
helm-templexer render my-app.yaml
Outcome:
❯ exa -T manifests
manifests
├── edge
│ └── my-app
│ └── manifest.yaml
├── prod
│ └── my-app
│ └── manifest.yaml
└── stage
└── my-app
└── manifest.yaml
Configuration can be provided as YAML format.
All paths are evaluated relative to the configuration file during execution.
Looking for schema
v1
? Please see helm-templexer 1.x.
Parameter | Description | Condition | Default | Example |
---|---|---|---|---|
version |
Schema version to use | required | "v2" |
|
enabled |
Whether to render deployments or not | optional | true |
|
chart |
Path to the chart to render | required | "path/to/some-chart" |
|
namespace |
Namespace to pass on to helm ; when omitted, no namespace is passed |
optional | "" |
|
release_name |
Release name to pass to helm |
required | "some-release" |
|
output_path |
Base path to use for writing the manifests to disk. The fully-qualified output path is built as follows ( config refers to the top-level):config.output_path/deployment.name/<[config/deployment].release_name>/manifest.yaml |
required | ||
additional_options |
Pass additional options to helm template ; you can use all supported options of the tool.Common use case: use --set-string to provide a container tag to use.This can be achieved by modifying the configuration file in your build pipeline using mikefarah/yq |
optional | [] |
["--set-string image.tag=42"] |
values |
A list of base value files which are passed to each helm template call.This is commonly used to provide a sane base config. |
optional | [] |
|
deployments |
The list of deployments to render. | required | [[deployments]] name = "edge" |
Deployments can override several top-level fields:
Parameter | Description | Condition | Default | Example |
---|---|---|---|---|
name |
Name of the deployment; only used in the output path | required | "edge-eu-w4" |
|
enabled |
Allows for disabling individual deployments | optional | true |
|
release_name |
Override the release name | optional | "" |
|
additional_options |
Additional options, as seen above, but specific to this deployment | optional | [] |
|
values |
Value files to use for this deployment | optional | [] |
helm template
CallUse --additional-options
to pass data to the underlying helm template
call. Beware that these additional options get added to every call, i.e. to each deployment.
A common use case we found was to provide the container tag:
helm-templexer render --additional-options="--set-string image.tag=${revision}" my-app.yaml
Use --filter
to render a specific deployment. Example: To render only the prod
, pass the regex to the filter option.
helm-templexer render --filter="prod" my-app.yaml
Use --update-dependencies
to run helm dependencies update
once before starting to render the deployments.
helm-templexer render --update-dependencies my-app.yaml
Use --pipe
to pass the manifest output through a tool or set of tools before writing to a file.
Please mind that this option requires an equal sign (=
), i.e. `--pipe="
helm-templexer render --pipe="kbld -f -" my-app.yaml
You can define the argument multiple times; the commands will be added in order of appearance to the final command.
helm-templexer render --pipe="kbld -f -" --pipe="tee /dev/stdout" my-app.yaml
If anything unexpected happens, you can use -v
, -vv
and -vvv
to increase the log level and see the underlying command.
# create the directory where helm-templexer will render to
mkdir -p tests/data/manifests
# let helm-templexer's user id (1001) own the directory
sudo chown -R 1001 tests/data/manifests
# pull and run the image
docker pull ghcr.io/hendrikmaus/helm-templexer
docker run --rm --volume $(pwd):/srv --workdir /srv/tests/data ghcr.io/hendrikmaus/helm-templexer render config_example.yaml
Include helm-templexer
in your Dockerfile
:
FROM ghcr.io/hendrikmaus/helm-templexer AS helm-templexer-provider
COPY --from=helm-templexer-provider /usr/bin/helm-templexer /usr/bin
COPY --from=helm-templexer-provider /usr/bin/helm /usr/bin
Please set/replace $TARGET
and $VERSION
accordingly.
wget https://github.com/hendrikmaus/helm-templexer/releases/download/v$VERSION/helm-templexer-$VERSION-$TARGET.tar.gz -O - | tar xz && mv helm-templexer /usr/bin/helm-templexer
For example VERSION=2.0.0
and TARGET=aarch64-apple-darwin
The mv
to /usr/bin
might require sudo
.
To validate the downloaded archive against the checksum:
wget https://github.com/hendrikmaus/helm-templexer/releases/download/v$VERSION/helm-templexer-$VERSION-$TARGET.tar.gz
echo "$(wget https://github.com/hendrikmaus/helm-templexer/releases/download/v$VERSION/helm-templexer-$VERSION-$TARGET.tar.gz.sha256 -O -) helm-templexer-$VERSION-$TARGET.tar.gz" | sha256sum --check --strict --status
brew tap hendrikmaus/tap
brew install helm-templexer
Helm Templexer is written in Rust. You will need rustc
version 1.35.0 or higher. The recommended way to install Rust is from the official download page. Once you have it set up, a simple make install
will compile helm-templexer
and install it into $HOME/.cargo/bin
.
If you’re using a recent version of Cargo (0.5.0 or higher), you can use the cargo install
command:
cargo install helm-templexer
Cargo will build the binary and place it in $HOME/.cargo/bin
(this location can be overridden by setting the --root option).