1+ {{- range .Values.projects }}
2+ apiVersion : argoproj.io/v1alpha1
3+ kind : ApplicationSet
4+ metadata :
5+ annotations :
6+ argocd.argoproj.io/sync-wave : " 0"
7+ name : " {{ . }}"
8+ namespace : " {{ $.Values.argoNamespace }}"
9+ spec :
10+ goTemplate : true
11+ goTemplateOptions : ["missingkey=default"]
12+ generators :
13+ - git :
14+ repoURL : " {{ $.Values.repoURL }}"
15+ revision : " HEAD"
16+ requeueAfterSeconds : 20
17+ files :
18+ - path : " apps/*/{{ . }}/**/config.yaml"
19+ values :
20+ cluster : " {{ `{{index .path.segments 1}}` }}"
21+ project : " {{ `{{index .path.segments 2`}} }}"
22+ app_path : " {{ `{{.path.path}}` }}"
23+ name : " {{ `{{.path.basename}}` }}"
24+ template :
25+ metadata :
26+ name : ' {{ `{{ default ( printf "%s-%s" .values.cluster ( .values.app_path | replace "/" "-" | trimPrefix ( printf "apps-%s-%s-" .values.cluster .values.project ) ) ) .appName }}` }}'
27+ namespace : " {{ $.Values.argoNamespace }}"
28+ spec :
29+ destination :
30+ namespace : ' {{ `{{ default ( .values.app_path | replace "/" "-" | trimPrefix ( printf "apps-%s-%s-" .values.cluster .values.project ) ) .destNamespace }}` }}'
31+ name : " {{ `{{ default .values.cluster .destServer }}` }}"
32+ project : " {{ `{{.values.project}}` }}"
33+ source :
34+ repoURL : {{ printf "{{ default \"%s\" .repoURL }}" $.Values.repoURL | quote }}
35+ targetRevision : ' {{ `{{ default "HEAD" .srcTargetRevision }}` }}'
36+ path : ' {{ `{{ default .values.app_path .srcPath }}` }}'
37+ syncPolicy :
38+ automated :
39+ allowEmpty : true
40+ prune : true
41+ selfHeal : true
42+ retry :
43+ limit : 30
44+ backoff :
45+ duration : 20s
46+ factor : 1
47+ maxDuration : 20s
48+ syncOptions :
49+ - CreateNamespace=true
50+ templatePatch : |
51+ metadata:
52+ labels:
53+ app.kubernetes.io/name: '{{ `{{.values.app_path | replace "/" "-" | trimPrefix (printf "apps-%s-%s-" .values.cluster .values.project)}}` }}'
54+ {{ `{{- range $key, $value := .labels }}` }}
55+ {{ `{{ $key }}` }}: {{ `{{ $value | quote }}` }}
56+ {{ `{{- end }}` }}
57+ annotations:
58+ {{ `{{- range $key, $value := .annotations }}` }}
59+ {{ `{{ $key }}` }}: {{ `{{ $value | quote }}` }}
60+ {{ `{{- end }}` }}
61+ syncPolicy : {}
62+ ---
63+ {{- end }}
0 commit comments