argo-cd
argo-cd copied to clipboard
paramPrefix to go with pathParamPrefix
Summary
Add a paramPrefix
to an application set git generator file template, so imported variables can be imported without fear of merge if desired.
Motivation
While pathParamPrefix
can prevent duplicate .path variables from colliding/overwriting, it does not offer a way to protect other variables from overwriting each other. This would allow devs to comfortably accept yaml structures without fear of overwriting other arbitrary values from another when creating a composite.
Proposal
Implementation would be pretty straight forward, just an additional attribute I could use:
---
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: yippie
spec:
goTemplate: true
generators:
- matrix:
generators:
# git file generator referencing individual deployments
- git:
repoURL: https://github.com/me/myrepo.git
revision: main
files:
- path: "coolyamls/*.yaml"
# git file genereator referencing infrastructure
- git:
repoURL: https://github.com/me/myrepo.git
revision: main
files:
- path: 'infrastructure/{{.infra_name}}.yaml'
paramPrefix: infraVars
pathParamPrefix: infraVars
template:
metadata:
name: 'myapp-{{.path.filename | trimSuffix ".yaml"}}'
spec:
project: default
source:
helm:
values: |
{{.chart_values}}
infravar: {{ .infraVars.chart_value}}
path: '{{.chart_path}}'
repoURL: '{{.chart_url}}'
targetRevision: '{{.chart_version}}'
destination:
name: '{{.path.filename | trimSuffix ".yaml"}}'
namespace: 'thisplace'
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
- PrunePropagationPolicy=foreground
- PruneLast=true
retry:
limit: 2
backoff:
duration: 5s
factor: 2
maxDuration: 3m
The idea here is that I can now group/pass multiple yaml files together and then choose if they overwrite each other or stay isolated simply by adding paramPrefix
to each imported file.
@Justin-DynamicD Can I take this up?
@nikzayn by all means, please do!