Using ArgoCD together with Kapitan is actually pretty easy and only requires the kapitan binary in the argo-repo-server and a ConfigManagement plugin in ArgocD (https://argoproj.github.io/argo-cd/user-guide/config-management-plugins/)
configManagementPlugins: |
- name: kapitan
init:
command: [sh]
args: ["kapitan-base-compile.sh"]
generate:
command: [sh]
args: ["kapitan-release.sh"]
volumes
initContainers
See the file below for an example
kapitan-base-compile.sh
cd $(git rev-parse --show-toplevel)
kapitan compile --fetch --t $ARGOCD_APP_NAME
kapitan-release.sh
find ./compiled/$ARGOCD_APP_NAME -type f -name '*.yml' -exec printf "\n\n---\n\n" \; -exec cat {} \; | tee /tmp/all.yaml
--repo https://github.com/acme/demo.git \
--path . \
--dest-server https://mycluster.azmk8s.io:443 \
--dest-namespace euw-dev-cd
The target name in your kapitan inventory should match the application name parameter in step 3
During the refresh step of ArgoCD the kapitan plugin (first) compile the target and then join all the relevant .yml files from the compiled folder to one big yaml file that is outputted to stdout
for ArgoCD to consume.
when your kapitan produces .yaml files instead of .yml, update the kapitan-release.sh
file accordingly
find ./compiled/$ARGOCD_APP_NAME -type f -name '*.yml' -exec printf "\n\n---\n\n" \; -exec cat {} \; | tee /tmp/all.yaml