Skip to content

Commit 6ae99c6

Browse files
committed
Progress on git generator
1 parent df0f609 commit 6ae99c6

File tree

2 files changed

+50
-18
lines changed

2 files changed

+50
-18
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: ApplicationSet
3+
metadata:
4+
name: web-nodejs
5+
namespace: $USER-argocd
6+
finalizers:
7+
- resources-finalizer.argocd.argoproj.io/background
8+
spec:
9+
goTemplate: true
10+
goTemplateOptions: ["missingkey=error"]
11+
generators:
12+
- git:
13+
repoURL: https://github.com/OpenShiftDemos/advanced-gitops-workshop
14+
revision: HEAD
15+
directories:
16+
- path: content/modules/ROOT/examples/coolstore/overlays/*
17+
values:
18+
user: $USER
19+
template:
20+
metadata:
21+
name: coolstore-{{.path.basename}}
22+
namespace: '{{ .values.user }}-argocd'
23+
spec:
24+
destination:
25+
name: in-cluster
26+
namespace: '{{ .values.user }}-{{.path.basename}}'
27+
project: '{{ .values.user }}'
28+
source:
29+
path: '{{.path.path}}'
30+
repoURL: https://github.com/OpenShiftDemos/advanced-gitops-workshop
31+
targetRevision: main
32+
syncPolicy:
33+
automated:

content/modules/ROOT/pages/04-applicationsets.adoc

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -252,22 +252,31 @@ You can view this structure in your cloned repository:
252252
[.console-input]
253253
[source,sh,subs="attributes",role=execute]
254254
----
255-
find ~/workshop/content/modules/ROOT/examples/coolstore -print | sort|sed -e 's;[^/]*/;|____;g;s;____|; |;g'
255+
find ~/workshop/content/modules/ROOT/examples/coolstore -print | sort|sed -e 's;[^/]*/;|--;g;s;--|; |;g'
256256
----
257257

258258
[.console-output]
259-
[source,yaml,subs="attributes+,+macros"]
259+
[source,bash,subs="attributes+,+macros"]
260260
----
261-
261+
| | | | | | | |--coolstore
262+
| | | | | | | | |--base
263+
| | | | | | | | | |--coolstore.yaml
264+
| | | | | | | | | |--kustomization.yaml
265+
| | | | | | | | |--overlays
266+
| | | | | | | | | |--dev
267+
| | | | | | | | | | |--kustomization.yaml
268+
| | | | | | | | | |--prod
269+
| | | | | | | | | | |--kustomization.yaml
270+
| | | | | | | | | |--stage
271+
| | | | | | | | | | |--kustomization.yaml
262272
----
263273

264-
265274
Let's deploy these applications using an ApplicationSet as we did previously but this time we will use a git generator.
266275

267276
[.console-input]
268277
[source,sh,subs="attributes",role=execute]
269278
----
270-
sed 's/$USER/{user}/' ~/workshop/content/modules/ROOT/examples/web-nodejs-appset.yaml | sed 's/$SUBDOMAIN/{subdomain}/' | oc apply -f - -n {user}-argocd
279+
sed 's/$USER/{user}/' ~/workshop/content/modules/ROOT/examples/applicationsets/coolstore-list-git.yaml | oc apply -n {user}-argocd -f -
271280
----
272281

273282
Let's have a quick look at our new ApplicationSet:
@@ -284,16 +293,14 @@ oc get appset web-nodejs -o yaml -n {user}-argocd | oc neat
284293
apiVersion: argoproj.io/v1alpha1
285294
kind: ApplicationSet
286295
metadata:
287-
name: web-nodejs
296+
name: coolstore
288297
namespace: {user}-argocd
289-
finalizers:
290-
- resources-finalizer.argocd.argoproj.io <1>
291298
spec:
292299
generators:
293300
- git: <1>
294301
directories:
295-
- path: globex/overlays/* <2>
296-
repoURL: https://gitea-gitea.{subdomain}/{user}/gitops.git <3>
302+
- path: content/modules/ROOT/examples/coolstore/overlays/* <2>
303+
repoURL: https://github.com/OpenShiftDemos/advanced-gitops-workshop <3>
297304
revision: HEAD
298305
values:
299306
user: {user} <4>
@@ -311,14 +318,6 @@ spec:
311318
project: '{{ .values.user }}'
312319
source:
313320
kustomize:
314-
patches:
315-
- patch: |-
316-
- op: replace
317-
path: /spec/template/spec/containers/0/env/0/value
318-
value: 'gateway-vertx-{{ .values.user }}-{{.path.basename}}'
319-
target:
320-
kind: Deployment
321-
name: web-nodejs
322321
path: '{{.path.path}}' <6>
323322
repoURL: https://gitea-gitea.{subdomain}/{user}/gitops.git
324323
targetRevision: main

0 commit comments

Comments
 (0)