Plugin Installation
The Nyl ArgoCD plugin enables ArgoCD to render Nyl manifests directly from Git repositories. This guide covers plugin installation and configuration.
If you do not need ArgoCD to render Nyl inputs at sync time, consider the simpler rendered manifest GitOps workflow first. It lets ArgoCD sync ordinary YAML without installing a CMP sidecar.
Prerequisites
Section titled “Prerequisites”- ArgoCD 2.4+ installed in your cluster
- Access to modify ArgoCD’s configuration
- Nyl binary available in the ArgoCD repo-server
Installation Methods
Section titled “Installation Methods”Method 1: Custom ArgoCD Image (Recommended)
Section titled “Method 1: Custom ArgoCD Image (Recommended)”Build a custom ArgoCD repo-server image with Nyl included:
FROM quay.io/argoproj/argocd:v2.9.3
# Switch to root to install NylUSER root
# Download and install NylRUN curl -L https://github.com/NiklasRosenstein/nyl/releases/download/vX.Y.Z/nyl-linux-amd64 \ -o /usr/local/bin/nyl && \ chmod +x /usr/local/bin/nyl
# Switch back to argocd userUSER argocdDeploy this custom image by updating the argocd-repo-server deployment:
spec: template: spec: containers: - name: argocd-repo-server image: your-registry/argocd-with-nyl:v2.9.3Method 2: Init Container
Section titled “Method 2: Init Container”Use an init container to download Nyl into a shared volume:
spec: template: spec: initContainers: - name: install-nyl image: alpine:3.18 command: - sh - -c - | apk add --no-cache curl curl -L https://github.com/NiklasRosenstein/nyl/releases/download/vX.Y.Z/nyl-linux-amd64 \ -o /plugins/nyl chmod +x /plugins/nyl volumeMounts: - name: plugins mountPath: /plugins containers: - name: argocd-repo-server volumeMounts: - name: plugins mountPath: /usr/local/bin/nyl subPath: nyl volumes: - name: plugins emptyDir: {}Plugin Configuration
Section titled “Plugin Configuration”Configure the Nyl plugin in the ArgoCD ConfigMap:
apiVersion: v1kind: ConfigMapmetadata: name: argocd-cm namespace: argocddata: configManagementPlugins: | - name: nyl-v2 generate: command: ["/bin/sh", "-c"] args: - | TEMPLATE_INPUT="${ARGOCD_ENV_NYL_CMP_TEMPLATE_INPUT:-${NYL_CMP_TEMPLATE_INPUT:-}}" test -n "$TEMPLATE_INPUT" || { echo "NYL_CMP_TEMPLATE_INPUT is required" >&2; exit 1; } nyl render "$TEMPLATE_INPUT"NYL_CMP_TEMPLATE_INPUT path semantics:
- Values that start with
/are treated as repository-root-relative (for example:/gitops/system/argocd.yaml). - Values without a leading
/are treated as relative tospec.source.path(recommended, usually just the file name).
Verification
Section titled “Verification”Test the plugin installation:
- Create a test Application using the Nyl plugin:
apiVersion: argoproj.io/v1alpha1kind: Applicationmetadata: name: test-nyl namespace: argocdspec: project: default source: repoURL: https://github.com/your-org/your-repo targetRevision: HEAD path: path/to/nyl/manifests plugin: name: nyl-v2 destination: server: https://kubernetes.default.svc namespace: default- Check the Application status:
kubectl get application test-nyl -n argocdargocd app get test-nyl- Verify manifest rendering:
argocd app manifests test-nylPassing Environment Variables
Section titled “Passing Environment Variables”You can pass environment variables to the Nyl plugin for configuration:
source: plugin: name: nyl-v2 env: - name: NYL_CMP_TEMPLATE_INPUT value: apps.yaml - name: NYL_RELEASE_NAME value: my-app - name: NYL_RELEASE_NAMESPACE value: productionUse apps.yaml (source-path-relative) in most cases. Use a leading / only when you intentionally need a repository-root-relative path.
Troubleshooting
Section titled “Troubleshooting”Plugin Not Found
Section titled “Plugin Not Found”If ArgoCD reports “plugin not found”, check:
- The plugin name matches exactly:
nyl-v2 - The argocd-cm ConfigMap is in the
argocdnamespace - The repo-server pods have been restarted after configuration changes
kubectl rollout restart deployment argocd-repo-server -n argocdCommand Not Found
Section titled “Command Not Found”If the plugin fails with “nyl: command not found”:
- Verify Nyl binary is in the PATH:
/usr/local/bin/nyl - Check file permissions (should be executable)
- Test manually in the repo-server pod:
kubectl exec -it deployment/argocd-repo-server -n argocd -- nyl --versionProfile Not Found
Section titled “Profile Not Found”If Nyl reports “Profile ‘default’ not found”:
- Ensure your repository defines
[profile.default.values]innyl.toml - Check the profile name matches what you’re referencing
- Verify
nyl.tomlis in the repository root or search path