Closed dmitry-mightydevops closed 5 months ago
I wonder if it's auto-detecting it as a helm-chart-in-a-repo?
What happens if you try?:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: root
namespace: argo-cd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
destination:
server: https://kubernetes.default.svc
namespace: argo-cd
project: default
source:
directory:
recurse: true
path: staging/argocd/apps/
repoURL: git@github.com:org/gitops.git
targetRevision: main
syncPolicy:
automated:
prune: true
selfHeal: true
(The directory
section under source
)
I believe I may be running into a similar situation and I think ArgoCD is in fact expecting a Helm chart values variable to be coming through instead of go-template variable...
I am trying to use an existing secret and pass that into the body of this API call:
...
body: |
{"username": "{{ .auth.username }}", "password": "{{ .auth.password }}"}
secrets:
- name: auth
secretRef:
name: external-secrets-test-secret
However, ArgoCD is complaining the following:
rpc error: code = Unknown desc = Manifest generation error (cached): `helm template...--values ../../<app in git>/values.yaml
...
at <.auth.username>: nil pointer evaluating interface {}.username Use --debug flag to render out invalid YAML
So I am going to assume we can't use go-templates in ArgoCD then?
You can use Go Templates in ApplicationSets since 2.5.x.
Summary
I'm using argocd 2.1.2 via helm chart.
So i have a root app looking into
git@github.com:org/gitops.git
inside
staging/argocd/apps
I have prometheus app, based on community chart, where I define custom alertmanager slack notification templates as shown belowstaging/argocd/apps/prometheus.yaml
I can apply this app via kubectl without any issues
However if I submit into git and then call for root sync I get this
Error: parse error at (root/templates/prometheus.yaml:127): function "toUpper" not defined
Motivation
Support go templates inside yaml files.