Open ckav370 opened 8 months ago
It's not an issue related to ArgoCD, it's related to JavaScript/TypeScript. And one piece of advice, I'd recommend you update your go and Kubernetes versions up to date. I think you should look at the error for JavaScript and then we can proceed from here.
FYI- this vanilla Argo running the recommended upstream container image as per the helm chart, this also includes Go. Running on EKS version 1.28
@Killpit Argo CD ships with JavaScript for the UI. This problem should be unrelated to the go and Kubernetes versions. @ckav370 has already posted the (redacted) JS error.
I know, it's just a piece of advice, I think we need to see the application he created.
Dupe of https://github.com/argoproj/argo-cd/issues/15545 (albeit w/o the same repro steps)?
Dupe of #15545 (albeit w/o the same repro steps)?
Looks like it, yup it's quite same, we don't know other tools that are being used here and I think this issue can be a good reference point for @ckav370
I have received same error. In my case it was an issue with one of ArgoCD CRD "Application". After deletion of broken CRD the error is gone.
I actually noticed this error again by adding a small change to an applicationset but refreshing the UI is resolved. After fixing the template patch from the original issue, I updated an appset adding releaseName: "{{
{{.values.env}}}}"
as below which seems to be the only change. This error has not reoccured yet and i have combed the repo server logs but see nothing unusual
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: name
namespace: argocd
spec:
syncPolicy:
preserveResourcesOnDeletion: true
ignoreApplicationDifferences:
- jsonPointers:
- /spec/source/targetRevision
goTemplate: true
goTemplateOptions: ["missingkey=error"]
generators:
- matrix:
generators:
- list:
elements:
- cluster: cluster
url: url
branch: main
autoSync: false
- git:
repoURL: https://github.com/repo.git
revision: main
files:
- path: env/cluster/*.yaml
values:
env: |-
{{"{{`{{ trimSuffix \".yaml\" .path.filename }}`}}"}}
app: |-
{{"{{`{{ index .path.segments 1 }}`}}"}}
template:
metadata:
name: "{{ `{{.values.app}}` }}-{{ `{{.values.env}}` }}"
spec:
project: my-project
source:
repoURL: https://github.com/repos.git
targetRevision: "{{ `{{ .branch }}` }}"
path: charts/{{ `{{.values.env}}`}}
helm:
releaseName: "{{ `{{.values.env}}` }}" -> adding this
valueFiles:
- values.yaml
- "../../env/{{ `{{.cluster}}` }}/{{ `{{.values.env}}` }}.yaml"
destination:
server: "{{ `{{ .url }}` }}"
namespace: "{{ `{{.values.env}}` }}"
syncPolicy:
syncOptions:
- CreateNamespace=true
- ServerSideApply=true
templatePatch: |-
{{`{{ if .autoSync }}
spec:
syncPolicy:
syncOptions:
- CreateNamespace=true
- ServerSideApply=true
syncPolicy:
automated:
prune: true
selfHeal: true
{{ end }}`}}
i encounter the same error when not specify spec.source in templatePatch
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: my-test-applicationset
namespace: argocd
spec:
goTemplate: true
goTemplateOptions: ["missingkey=error"]
syncPolicy:
preserveResourcesOnDeletion: true
generators:
- matrix:
generators:
- list:
elements:
- repoURL: <my-repo>
- list:
elements:
- name: 'reloader'
namespace: reloader
clusterName: in-cluster
path: others/reloader-1.0.121
releaseName: reloader
autoSync: false
valueFiles:
- values.yaml
template:
metadata:
name: '{{.name}}'
spec:
project: default
source:
repoURL: '{{.repoURL}}'
targetRevision: HEAD
path: '{{.path}}'
helm:
releaseName: '{{.releaseName}}'
valueFiles:
- values.yaml
destination:
name: '{{.clusterName}}'
namespace: '{{.namespace}}'
templatePatch: |
spec:
{{- if .autoSync }}
syncPolicy:
automated:
prune: {{ .prune | default "false" }}
selfHeal: {{ .selfHeal | default "false" }}
allowEmpty: {{ .allowEmpty | default "false" }}
{{- end }}
i just found that i need to change in templatePatch like this:
templatePatch: |
{{- if .autoSync }}
spec:
syncPolicy:
automated:
prune: {{ .prune | default "false" }}
selfHeal: {{ .selfHeal | default "false" }}
allowEmpty: {{ .allowEmpty | default "false" }}
{{- end }}
and it will work, but still need to review this feature because it affects the UI if not carefully config
ArgoCD versions 2.10 and below have reached EOL. Can you upgrade and tell us if the issue is still present, please?
Checklist:
argocd version
.Describe the bug
ArgoCD is managing itself.
Using a template patch to set sync policy in an applicationset and make it configurable across different apps. It seems there was an issue with the
templatePatch
which has caused ArgoCD to throw an error and the UI to no longer be availableExample template Patch (using helm, not kustomize hence the escape characters)
To Reproduce
Adding an invalid template patch like above which has a patch for an existing sync policy, sync and watch the UI become unavailable
Expected behavior
Template patch is anything invalid which I would expect the applicationset controller to report and degraded or out of sync, not throwing an error which renders the UI inaccessible
The fix was to define the templatePatch properly, eg:
But it seems very unexpected behaviour that a misconfigured applicationset such as this should cause the UI to become unavailable
Screenshots
Once the broken patch has been synced by ArgoCD, this is what the UI does. Once the broken template patch has been reverted, the UI returns to usual working state
Version
Logs Surprisingly, nothing stand out in the logs