Helm Multi-Values Plugin with Argo's CMP
Introduction
With the current version of Helm, it’s not possible to merge multiple values files. It will override the list from the preceding values file. While trying to solve this problem, I stumbled upon this custom plugin that can take a folder of values files and split them into individual files. This plugin is what I was looking for to solve my problem. Finally, I want to integrate this plugin into my ArgoCD instance.
You’ll need to perform the following steps:
- Install Helm Plugin using InitContainer of the repo server.
- The configuration management plugin installation entails two steps. First, create a ConfigMap of your CMP configuration, then configure the plugin via sidecar for the repo server. For additional details, see the ArgoCD documentation.
- Finally, create an Argo Application to test the multi-values plugin.
Prerequisites
- Make sure you have access to the OpenShift cluster with cluster-admin privileges.
- The OpenShift GitOps Operator must be installed and configured
- It would help if you had some understanding of ArgoCD and Helm Charts.
Install Helm Plugin in repo server
We’ll use the custom tooling methodology to add the helm multivalues plugin to the repo server. Update the ArgoCD operator CR to add an init container to the repo spec and volumes to install the helm plugin. We must also add Helm environment variables to override default data
, config
, and cache
paths.
|
|
Configure Argo CMP
Next, create a ConfigMap with the configuration for the plugin. The generate
command under spec
section runs in the Application source directory each time manifests need to generate output. As per the plugin documentation, we need to run the helm multivalues [ORIGINAL_COMMAND] -f [VALUES_FOLDER_PATH] [ORIGINAL_ARGS]
to generate the output as a stdout
|
|
The next step is to add the sidecar to the ArgoCD operator CR.
|
|
A few things to review:
- The code snippet above uses an argocd image to mount the plugin we installed in the earlier step and
plugin.yaml
in the container using the ConfigMap we just created. - Other mounts from Argo CD are necessary, like
/var/run/argocd
(that contains the argocd-cmp-server command that needs to run) and/home/argocd/cmp-server/plugins
.
Apply the changes; Operator will rollout a latest changes of the repo-server pod.
Argo Application to Validate
Let’s set up an ArgoCD application to test the changes
|
|
Success! The Config Management Plugin ran the commands in the generate section to render out the YAML and Argo CD applied that YAML to the destination cluster.
Resources
- Helm Chart Repository
- Helm MultiValues Folder