Customizing Helm Chart Output

Sometimes you must modify the output of a MATRIXX Helm chart, but there is no configuration property available for the change you want to make. Changes of this kind can be made with less potential cost using Helm post rendering. A post renderer takes the output of the Helm chart in YAML format from standard input (STDIN) and makes required changes before outputting to standard output (STDOUT).

Note: Modifying the Helm chart can lead to unintended consequences, including but not limited to issues when it comes time to upgrade MATRIXX. For these reasons, do not modify the MATRIXX Helm chart itself.

The Kustomize post renderer can be run as included with kubectl or installed independently. (For information about running it from kubectl, run kubectl kustomize --help.) The Kustomize tool reads in the YAML from files in a directory. A simple script is required which bridges from STDIN to files.

Here is an example wrapper script which uses the kubectl kustomize command.

#!/bin/sh
 
# Save the STDIN as the chart output
cat <&0 > chartoutput.yaml
 
# Run the kustomize tool with kubectl
kubectl kustomize .
 
# Clean up
rm -rf chartoutput.yaml

Run the script with a command similar to the following:

helm install ag1 matrixx/matrixx -n matrixx --post-renderer ./kustomize-with-kubectl.sh
Important: Set the file permissions of kustomize-with-kubectl.sh to be executable.
Note: The use of Helm chart post renderers like Kustomize works well for resources created directly by the Helm chart. However, there are a number of Kubernetes objects for MATRIXX Engine, such as StatefulSets and services, which are created by the engine and so cannot be modified in this way.