@@ -111,6 +111,78 @@ applicationsets:
111
111
targetRevision: HEAD
112
112
path: "{{`{{ .values.appInstancePath }}`}}"
113
113
114
+ withConfig:
115
+ namespace: argocd
116
+ finalizers:
117
+ - resources-finalizer.argocd.argoproj.io
118
+ goTemplate: true
119
+ goTemplateOptions: ["missingkey=invalid"]
120
+
121
+ generators:
122
+ - matrix:
123
+ generators:
124
+ # Original app deployment generators
125
+ - matrix:
126
+ generators:
127
+ - clusters:
128
+ selectors:
129
+ values:
130
+ clusterGroup: "{{`{{ or .metadata.labels.clusterGroup nil }}`}}"
131
+ clusterName: "{{`{{ or .metadata.labels.clusterId .name }}`}}"
132
+ clusterSlug: "{{`{{ if .metadata.labels.clusterGroup }}{{ .metadata.labels.clusterGroup }}-{{ end }}{{ or .metadata.labels.clusterId .name }}`}}"
133
+
134
+ - git:
135
+ repoURL: {{ .Values | get "repoUrl" "repoUrl missing"}}
136
+ revision: HEAD
137
+ files:
138
+ # global - on every cluster
139
+ - path: "{{ .Values | get "baseDir" "baseDir missing" }}/apps/*/config.yaml"
140
+ # per clusterGroup - on every cluster in a group
141
+ - path: "{{ .Values | get "baseDir" "baseDir missing" }}{{`/{{ .values.clusterGroup }}/apps/*/config.yaml`}}"
142
+ # on a specific single cluster, either grouped or ungrouped
143
+ - path: "{{ .Values | get "baseDir" "baseDir missing" }}{{`/{{ .values.clusterGroup }}/{{ .values.clusterName }}/apps/*/config.yaml`}}"
144
+ - path: "{{ .Values | get "baseDir" "baseDir missing" }}{{`/{{ .values.clusterName }}/apps/*/config.yaml`}}"
145
+ values:
146
+ appInstance: '{{ printf "%s" "{{- printf `{{ .path.basename }}` -}}" }}'
147
+ appInstancePath: '{{ printf "%s" "{{- printf `{{ .path.path }}` -}}" }}'
148
+ baseApp: '{{ printf "%s" "{{- printf `{{ .baseApp }}` -}}" }}'
149
+
150
+ - git:
151
+ repoURL: {{ .Values | get "repoUrl" "repoUrl missing"}}
152
+ revision: HEAD
153
+ files:
154
+ - path: "apps/{{ `{{ .baseApp }}` }}/helmfile.yaml"
155
+ pathParamPrefix: "appSettings"
156
+ selector:
157
+ matchExpressions:
158
+ - key: baseApp
159
+ operator: Exists
160
+ template:
161
+ metadata:
162
+ name: "{{`{{ .values.clusterName }}-{{ .values.appInstance }}`}}"
163
+ labels:
164
+ debug: "{{`{{ . | toYaml }}`}}"
165
+ spec:
166
+ project: default # {{"{{ or .project \"default\" }}"}}
167
+ destination:
168
+ name: "{{`{{ .values.clusterSlug }}`}}"
169
+ namespace: "{{`{{ or .namespace .values.appInstance }}`}}"
170
+ syncPolicy:
171
+ syncOptions:
172
+ - CreateNamespace=true
173
+ templatePatch: |
174
+ spec:
175
+ sources:
176
+ {{`{{- if .baseApp }}`}}
177
+ - repoURL: {{ .Values | get "repoUrl" "repoUrl missing"}}
178
+ targetRevision: HEAD
179
+ path: {{ `apps/{{ .baseApp }}` }}
180
+ {{`{{- end }}`}}
181
+ - repoURL: {{ .Values | get "repoUrl" "repoUrl missing"}}
182
+ targetRevision: HEAD
183
+ path: {{`{{ .values.appInstancePath }}`}}
184
+
185
+
114
186
root:
115
187
namespace: argocd
116
188
finalizers:
0 commit comments