ArgoCD
Run kdef as an ArgoCD Config Management Plugin (CMP) that renders .kdef files natively.
kdef ships as an ArgoCD Config Management Plugin (CMP). Drop the sidecar into your argocd-repo-server, point an Application at a .kdef directory, and ArgoCD renders and deploys it.
1. Build the sidecar image
git clone https://github.com/gsid-nl/kdef.git
cd kdef
make argocd-plugin # stages a linux/amd64 kdef binary in argocd-plugin/
cd argocd-plugin
docker build -t your-registry/kdef-argocd-plugin:latest .
docker push your-registry/kdef-argocd-plugin:latest
2. Add the sidecar to argocd-repo-server
In your ArgoCD Helm values (or patch the repo-server Deployment directly):
repoServer:
extraContainers:
- name: kdef
image: your-registry/kdef-argocd-plugin:latest
command: ["/var/run/argocd/argocd-cmp-server"]
securityContext:
runAsNonRoot: true
runAsUser: 999
volumeMounts:
- { mountPath: /var/run/argocd, name: var-files }
- { mountPath: /home/argocd/cmp-server/plugins, name: plugins }
- { mountPath: /tmp, name: cmp-tmp }
volumes:
- name: cmp-tmp
emptyDir: {}
The plugin manifest (plugin.yaml) inside the sidecar image tells ArgoCD how to detect kdef projects (presence of *.kdef files) and run kdef render.
3. Point an Application at it
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: my-app
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/example/my-app-k8s.git
path: k8s/
plugin:
name: kdef
destination:
server: https://kubernetes.default.svc
namespace: production
syncPolicy:
automated:
prune: true
selfHeal: true
ArgoCD auto-detects .kdef files in path and invokes the plugin to produce manifests.
Environment overrides
Pass an env through plugin parameters:
source:
plugin:
name: kdef
env:
- name: KDEF_ENV
value: production
The plugin.yaml shipped in the sidecar image already honours it, and KDEF_VALUES for a values file:
generate:
command: ["sh", "-c", "kdef render --dir . ${KDEF_ENV:+--env $KDEF_ENV} ${KDEF_VALUES:+--values $KDEF_VALUES}"]
Tips
- Cluster generators: ApplicationSet + the
listgenerator is the cleanest way to deploy the same kdef project to multiple environments. Point each generated Application at a differentKDEF_ENV. - Variable overrides: set
KDEF_VALUESto avalues/*.jsonfile committed alongside your kdef project, or extend thegeneratecommand with--setfor simple scalars. - Validation: kdef exits non-zero on validation failures, so ArgoCD's sync will fail fast instead of applying broken manifests.
When Flux and when ArgoCD?
Both work. If you already run one, use that one. If you're choosing:
- Flux + kdef's
KdefReleaseCR is the lighter-weight option: fewer moving parts, CRD-first UX. - ArgoCD + CMP sidecar gives you ArgoCD's UI and its multi-cluster / multi-project story out of the box.