Skip to content

Commit 94ad32f

Browse files
authored
Tidy up the examples repo + add a Helm hooks examples (argoproj#40)
1 parent 5c2d89b commit 94ad32f

File tree

8 files changed

+126
-16
lines changed

8 files changed

+126
-16
lines changed

apps/templates/helm-guestbook.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ metadata:
77
- resources-finalizer.argocd.argoproj.io
88
spec:
99
destination:
10-
namespace: argocd
10+
namespace: helm-guestbook
1111
server: {{ .Values.spec.destination.server }}
1212
project: default
1313
source:
1414
path: helm-guestbook
15-
repoURL: https://github.com/argoproj/argocd-example-apps
15+
repoURL: {{ .Values.spec.source.repoURL }}
1616
targetRevision: {{ .Values.spec.source.targetRevision }}
1717
syncPolicy:
1818
automated:

apps/templates/guestbook.yaml apps/templates/helm-hooks.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
apiVersion: argoproj.io/v1alpha1
22
kind: Application
33
metadata:
4-
name: guestbook
4+
name: helm-hooks
55
namespace: argocd
66
finalizers:
77
- resources-finalizer.argocd.argoproj.io
88
spec:
99
destination:
10-
namespace: argocd
10+
namespace: helm-hooks
1111
server: {{ .Values.spec.destination.server }}
1212
project: default
1313
source:
14-
path: guestbook
15-
repoURL: https://github.com/argoproj/argocd-example-apps
14+
path: helm-hooks
15+
repoURL: {{ .Values.spec.source.repoURL }}
1616
targetRevision: {{ .Values.spec.source.targetRevision }}
1717
syncPolicy:
1818
automated:

apps/templates/kustomize-guestbook.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ metadata:
77
- resources-finalizer.argocd.argoproj.io
88
spec:
99
destination:
10-
namespace: argocd
10+
namespace: kustomize-guestbook
1111
server: {{ .Values.spec.destination.server }}
1212
project: default
1313
source:
1414
path: kustomize-guestbook
15-
repoURL: https://github.com/argoproj/argocd-example-apps
15+
repoURL: {{ .Values.spec.source.repoURL }}
1616
targetRevision: {{ .Values.spec.source.targetRevision }}
1717
syncPolicy:
1818
automated:

apps/templates/namespaces.yaml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: helm-guestbook
5+
annotations:
6+
argocd.argoproj.io/sync-wave: "-1"
7+
---
8+
apiVersion: v1
9+
kind: Namespace
10+
metadata:
11+
name: helm-hooks
12+
annotations:
13+
argocd.argoproj.io/sync-wave: "-1"
14+
---
15+
apiVersion: v1
16+
kind: Namespace
17+
metadata:
18+
name: kustomize-guestbook
19+
annotations:
20+
argocd.argoproj.io/sync-wave: "-1"
21+
---
22+
apiVersion: v1
23+
kind: Namespace
24+
metadata:
25+
name: sync-waves
26+
annotations:
27+
argocd.argoproj.io/sync-wave: "-1"

apps/templates/helm-dependency.yaml apps/templates/sync-waves.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
apiVersion: argoproj.io/v1alpha1
22
kind: Application
33
metadata:
4-
name: helm-dependency
4+
name: sync-waves
55
namespace: argocd
66
finalizers:
77
- resources-finalizer.argocd.argoproj.io
88
spec:
99
destination:
10-
namespace: argocd
10+
namespace: sync-waves
1111
server: {{ .Values.spec.destination.server }}
1212
project: default
1313
source:
14-
path: helm-dependency
15-
repoURL: https://github.com/argoproj/argocd-example-apps
14+
path: sync-waves
15+
repoURL: {{ .Values.spec.source.repoURL }}
1616
targetRevision: {{ .Values.spec.source.targetRevision }}
1717
syncPolicy:
1818
automated:

apps/values.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ spec:
22
destination:
33
server: https://kubernetes.default.svc
44
source:
5+
repoURL: https://github.com/argoproj/argocd-example-apps
56
targetRevision: HEAD

helm-hooks/manifests.yaml

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
apiVersion: batch/v1
3+
kind: Job
4+
metadata:
5+
generateName: upgrade-sql-schema
6+
annotations:
7+
helm.sh/hook: pre-install
8+
helm.sh/hook-weight: "-2"
9+
spec:
10+
template:
11+
spec:
12+
containers:
13+
- name: upgrade-sql-schema
14+
image: alpine:latest
15+
command: ["sleep", "5"]
16+
restartPolicy: Never
17+
---
18+
apiVersion: batch/v1
19+
kind: Job
20+
metadata:
21+
name: maint-page-up
22+
annotations:
23+
helm.sh/hook: pre-install
24+
helm.sh/hook-delete-policy: before-hook-creation
25+
helm.sh/hook-weight: "-1"
26+
spec:
27+
template:
28+
spec:
29+
containers:
30+
- name: page-up
31+
image: alpine:latest
32+
command: ["sleep", "2"]
33+
restartPolicy: Never
34+
backoffLimit: 0
35+
---
36+
apiVersion: apps/v1
37+
kind: ReplicaSet
38+
metadata:
39+
name: frontend
40+
spec:
41+
replicas: 1
42+
selector:
43+
matchLabels:
44+
tier: frontend
45+
template:
46+
metadata:
47+
labels:
48+
tier: frontend
49+
spec:
50+
containers:
51+
- name: main
52+
image: nginx:latest
53+
---
54+
apiVersion: v1
55+
kind: Service
56+
metadata:
57+
name: frontend
58+
annotations:
59+
helm.sh/hook-weight: "2"
60+
spec:
61+
selector:
62+
tier: frontend
63+
ports:
64+
- protocol: TCP
65+
port: 80
66+
targetPort: 80
67+
---
68+
apiVersion: batch/v1
69+
kind: Job
70+
metadata:
71+
name: maint-page-down
72+
annotations:
73+
helm.sh/hook: post-install
74+
helm.sh/hook-delete-policy: before-hook-creation
75+
spec:
76+
template:
77+
spec:
78+
containers:
79+
- name: page-down
80+
image: alpine:latest
81+
command: ["sleep", "2"]
82+
restartPolicy: Never

sync-waves/manifests.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ spec:
4747
apiVersion: batch/v1
4848
kind: Job
4949
metadata:
50-
generateName: maint-page-up-
50+
name: maint-page-up
5151
annotations:
5252
argocd.argoproj.io/hook: Sync
53-
argocd.argoproj.io/hook-delete-policy: HookSucceeded
53+
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
5454
argocd.argoproj.io/sync-wave: "1"
5555
spec:
5656
template:
@@ -99,10 +99,10 @@ spec:
9999
apiVersion: batch/v1
100100
kind: Job
101101
metadata:
102-
generateName: maint-page-down-
102+
name: maint-page-down
103103
annotations:
104104
argocd.argoproj.io/hook: Sync
105-
argocd.argoproj.io/hook-delete-policy: HookSucceeded
105+
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
106106
argocd.argoproj.io/sync-wave: "3"
107107
spec:
108108
template:

0 commit comments

Comments
 (0)