Open brucec5 opened 1 year ago
is this not a know restriction with goTemplate: true
?
I interpreted that as specifically referring to using a nested key as the merge key in the merge generator. In my case, I'm merging on name
, so that should be allowed.
Checklist:
argocd version
.Describe the bug
When using go templating, the matrix generator seems to create aliased maps. This is a problem when using the matrix generator alongside a merge generator, since if one of the matching parameter sets modifies a map in the base config it will end up getting updated for all other clusters. I'm sorry if I'm bad at explaining this.
To Reproduce
go-template appset
```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: nested-config-test-appset-go-templating spec: generators: - merge: mergeKeys: [name] generators: - matrix: # Set base config for all clusters generators: - git: repoURL: https://example.com/my-applications revision: HEAD files: - path: "nested-config-test/config.yaml" - clusters: selector: matchLabels: argocd.argoproj.io/secret-type: cluster production: "false" - git: # Apply per-cluster overrides on top of the base config repoURL: https://example.com/my-applications revision: HEAD files: - path: "nested-config-test/config/*.yaml" goTemplate: true goTemplateOptions: ["missingkey=error"] template: metadata: name: 'nested-config-test-appset-go-{{ .name }}' spec: project: example source: repoURL: https://example.com/test-chart path: . targetRevision: '{{ .revision }}' helm: releaseName: '{{ .releaseName }}' valueFiles: - values.yaml parameters: - name: nestedConfig.enabled value: '{{ .nestedConfig.enabled }}' destination: name: '{{ .name }}' namespace: '{{ .namespace }}' ```traditional appset
```yaml apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: nested-config-test-appset spec: generators: - merge: mergeKeys: [name] generators: - matrix: # Set base config for all clusters generators: - git: repoURL: https://example.com/my-applications revision: HEAD files: - path: "nested-config-test/config.yaml" - clusters: selector: matchLabels: argocd.argoproj.io/secret-type: cluster production: "false" - git: # Apply per-cluster overrides on top of the base config repoURL: https://example.com/my-applications revision: HEAD files: - path: "nested-config-test/config/*.yaml" template: metadata: name: 'nested-config-test-appset-{{ name }}' spec: project: example source: repoURL: https://example.com/test-chart path: . targetRevision: '{{ revision }}' helm: releaseName: '{{ releaseName }}' valueFiles: - values.yaml parameters: - name: nestedConfig.enabled value: '{{ nestedConfig.enabled }}' destination: name: '{{ name }}' namespace: '{{ namespace }}' ```nested-config-test/config.yaml
```yaml revision: 1.2.3 namespace: test-ns nestedConfig: enabled: true ```nested-config-test/config/qa.yaml
```yaml name: qa nestedConfig: enabled: false ```Expected behavior
I'd expect all clusters except for the
qa
cluster have thenestedConfig.enabled
helm parameter set totrue
. This was the case for the traditional templating. However, with Go templatingnestedConfig.enabled
ends up getting set tofalse
everywhere. A workaround is to just not nest configuration provided by the git files generator, but this still feels like a bug that should be fixed.Screenshots
Version