Install Helper
There are a lot of charts and components required to be installed and managed for PrimeHub. We need a way to manage common settings across all these components. And provide a way to template the helm value files by feature flags.
Design
In the common helm installation, it may look like the following command.
However, it is not convenient to issue this long command for each installation and not easy to be source-controlled as well. To solve this problem, we make use of helmfile. The above command would turn into the yaml file below.
and the install command would change to
In this way, we make the installation declarative and easy to run. All these helmfiles are located at helm/helmfile.d
.
As more and more releases need to be installed, we also categorize these releases by label. There are two labels defined
Here are the available releases
To diff, install/upgrade the helm release, we can use these commands
or these equivalent make commands
Template the Value
Helm provides a great way to template the kubernetes resources. In the helm installation or upgrade, helm consolidates all the values to a single value tree and uses it to generate the final resource YAMLs and apply them to cluster.
However, helm does not provide a way to template the value, this is why helmfile templating comes in. Helmfile provides a way to template the value files by environment valuable.
We can notice that in the helm/<component>/*
, these values file have .yaml.gotmpl
file extension. When helmfile is run, it would template these value files and output the final plain values.
The environment variable is from the <config-path>/.env
. And the config path is searched in the following order
~/.primehub/config/<cluster name>/
( iskubectl config current-context
)./etc
The helper script bin/phenv
would find if ${CONFIG_PATH}/.env
is in the folder and determine if it is qualified as a config folder.
Configuration Files
In the previous section, we talk about the config folder. In addition to .env
file, the folder also contains these files and folders.
Last updated