Skip to content

Commit ed4ad90

Browse files
committed
Add ApplicationSet configuration for local charts; introduce new helmfile.yaml for test-local-chart and update kubevirt-operator helmfile.yaml. Add config.yaml for uses-app-with-local-chart to establish base application configuration.
1 parent a6f36b6 commit ed4ad90

File tree

4 files changed

+78
-1
lines changed

4 files changed

+78
-1
lines changed

appSets.yaml.gotmpl

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,78 @@ applicationsets:
111111
targetRevision: HEAD
112112
path: "{{`{{ .values.appInstancePath }}`}}"
113113

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+
114186
root:
115187
namespace: argocd
116188
finalizers:

apps/kubevirt-operator/helmfile.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
releases:
33
- name: kubevirt-operator
4-
chart: ../kubevirt-operator
4+
chart: ./

apps/test-local-chart/helmfile.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
releases:
3+
- name: test-local-chart
4+
chart: ./
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
baseApp: test-local-chart

0 commit comments

Comments
 (0)