Skip to content

Commit 172d68b

Browse files
Added image updater examples
1 parent 9bf0de0 commit 172d68b

File tree

11 files changed

+273
-31
lines changed

11 files changed

+273
-31
lines changed

image-updater/01-always-latest/service.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

image-updater/applications/always-latest.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@ kind: Application
33
metadata:
44
name: always-latest01
55
namespace: argocd
6-
finalizers:
7-
- resources-finalizer.argocd.argoproj.io
6+
annotations:
7+
argocd-image-updater.argoproj.io/image-list: example=ghcr.io/codefresh-contrib/gitops-cert-level-2-examples
8+
argocd-image-updater.argoproj.io/example.update-strategy: latest
89
spec:
910
project: default
1011

1112
source:
1213
repoURL: https://github.com/codefresh-contrib/gitops-cert-level-2-examples.git
1314
targetRevision: HEAD
14-
path: ./image-updater/01-always-latest
15+
path: ./image-updater/example-app/envs/qa/
1516

1617
destination:
1718
server: https://kubernetes.default.svc
18-
namespace: example02
19+
namespace: qa
1920

2021
# Sync policy
2122
syncPolicy:

image-updater/applications/semver.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ kind: Application
33
metadata:
44
name: follow-semver02
55
namespace: argocd
6-
finalizers:
7-
- resources-finalizer.argocd.argoproj.io
6+
annotations:
7+
argocd-image-updater.argoproj.io/image-list: ghcr.io/codefresh-contrib/gitops-cert-level-2-examples:~1
88
spec:
99
project: default
1010

1111
source:
1212
repoURL: https://github.com/codefresh-contrib/gitops-cert-level-2-examples.git
1313
targetRevision: HEAD
14-
path: ./image-updater/02-semver-example
14+
path: ./image-updater/example-app/envs/staging/
1515

1616
destination:
1717
server: https://kubernetes.default.svc
18-
namespace: example01
18+
namespace: staging
1919

2020
# Sync policy
2121
syncPolicy:
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
labels:
5+
app.kubernetes.io/component: controller
6+
app.kubernetes.io/name: argocd-image-updater
7+
app.kubernetes.io/part-of: argocd-image-updater
8+
name: argocd-image-updater
9+
---
10+
apiVersion: rbac.authorization.k8s.io/v1
11+
kind: Role
12+
metadata:
13+
labels:
14+
app.kubernetes.io/component: controller
15+
app.kubernetes.io/name: argocd-image-updater
16+
app.kubernetes.io/part-of: argocd-image-updater
17+
name: argocd-image-updater
18+
rules:
19+
- apiGroups:
20+
- ""
21+
resources:
22+
- secrets
23+
- configmaps
24+
verbs:
25+
- get
26+
- list
27+
- watch
28+
- apiGroups:
29+
- argoproj.io
30+
resources:
31+
- applications
32+
verbs:
33+
- get
34+
- list
35+
- update
36+
- patch
37+
- apiGroups:
38+
- ""
39+
resources:
40+
- events
41+
verbs:
42+
- create
43+
---
44+
apiVersion: rbac.authorization.k8s.io/v1
45+
kind: RoleBinding
46+
metadata:
47+
labels:
48+
app.kubernetes.io/component: controller
49+
app.kubernetes.io/name: argocd-image-updater
50+
app.kubernetes.io/part-of: argocd-image-updater
51+
name: argocd-image-updater
52+
roleRef:
53+
apiGroup: rbac.authorization.k8s.io
54+
kind: Role
55+
name: argocd-image-updater
56+
subjects:
57+
- kind: ServiceAccount
58+
name: argocd-image-updater
59+
---
60+
apiVersion: v1
61+
kind: ConfigMap
62+
metadata:
63+
labels:
64+
app.kubernetes.io/name: argocd-image-updater-config
65+
app.kubernetes.io/part-of: argocd-image-updater
66+
name: argocd-image-updater-config
67+
---
68+
apiVersion: v1
69+
kind: ConfigMap
70+
metadata:
71+
labels:
72+
app.kubernetes.io/name: argocd-image-updater-ssh-config
73+
app.kubernetes.io/part-of: argocd-image-updater
74+
name: argocd-image-updater-ssh-config
75+
---
76+
apiVersion: v1
77+
kind: Secret
78+
metadata:
79+
labels:
80+
app.kubernetes.io/name: argocd-image-updater-secret
81+
app.kubernetes.io/part-of: argocd-image-updater
82+
name: argocd-image-updater-secret
83+
---
84+
apiVersion: apps/v1
85+
kind: Deployment
86+
metadata:
87+
labels:
88+
app.kubernetes.io/component: controller
89+
app.kubernetes.io/name: argocd-image-updater
90+
app.kubernetes.io/part-of: argocd-image-updater
91+
name: argocd-image-updater
92+
spec:
93+
selector:
94+
matchLabels:
95+
app.kubernetes.io/name: argocd-image-updater
96+
strategy:
97+
type: Recreate
98+
template:
99+
metadata:
100+
labels:
101+
app.kubernetes.io/name: argocd-image-updater
102+
spec:
103+
containers:
104+
- args:
105+
- '--interval'
106+
- 1m
107+
command:
108+
- /usr/local/bin/argocd-image-updater
109+
- run
110+
env:
111+
- name: APPLICATIONS_API
112+
valueFrom:
113+
configMapKeyRef:
114+
key: applications_api
115+
name: argocd-image-updater-config
116+
optional: true
117+
- name: ARGOCD_GRPC_WEB
118+
valueFrom:
119+
configMapKeyRef:
120+
key: argocd.grpc_web
121+
name: argocd-image-updater-config
122+
optional: true
123+
- name: ARGOCD_SERVER
124+
valueFrom:
125+
configMapKeyRef:
126+
key: argocd.server_addr
127+
name: argocd-image-updater-config
128+
optional: true
129+
- name: ARGOCD_INSECURE
130+
valueFrom:
131+
configMapKeyRef:
132+
key: argocd.insecure
133+
name: argocd-image-updater-config
134+
optional: true
135+
- name: ARGOCD_PLAINTEXT
136+
valueFrom:
137+
configMapKeyRef:
138+
key: argocd.plaintext
139+
name: argocd-image-updater-config
140+
optional: true
141+
- name: ARGOCD_TOKEN
142+
valueFrom:
143+
secretKeyRef:
144+
key: argocd.token
145+
name: argocd-image-updater-secret
146+
optional: true
147+
- name: IMAGE_UPDATER_LOGLEVEL
148+
valueFrom:
149+
configMapKeyRef:
150+
key: log.level
151+
name: argocd-image-updater-config
152+
optional: true
153+
- name: GIT_COMMIT_USER
154+
valueFrom:
155+
configMapKeyRef:
156+
key: git.user
157+
name: argocd-image-updater-config
158+
optional: true
159+
- name: GIT_COMMIT_EMAIL
160+
valueFrom:
161+
configMapKeyRef:
162+
key: git.email
163+
name: argocd-image-updater-config
164+
optional: true
165+
- name: IMAGE_UPDATER_KUBE_EVENTS
166+
valueFrom:
167+
configMapKeyRef:
168+
key: kube.events
169+
name: argocd-image-updater-config
170+
optional: true
171+
image: quay.io/argoprojlabs/argocd-image-updater:v0.12.0
172+
imagePullPolicy: Always
173+
livenessProbe:
174+
httpGet:
175+
path: /healthz
176+
port: 8080
177+
initialDelaySeconds: 3
178+
periodSeconds: 30
179+
name: argocd-image-updater
180+
ports:
181+
- containerPort: 8080
182+
readinessProbe:
183+
httpGet:
184+
path: /healthz
185+
port: 8080
186+
initialDelaySeconds: 3
187+
periodSeconds: 30
188+
volumeMounts:
189+
- mountPath: /app/config
190+
name: image-updater-conf
191+
- mountPath: /app/config/ssh
192+
name: ssh-known-hosts
193+
- mountPath: /app/.ssh
194+
name: ssh-config
195+
serviceAccountName: argocd-image-updater
196+
volumes:
197+
- configMap:
198+
items:
199+
- key: registries.conf
200+
path: registries.conf
201+
- key: git.commit-message-template
202+
path: commit.template
203+
name: argocd-image-updater-config
204+
optional: true
205+
name: image-updater-conf
206+
- configMap:
207+
name: argocd-ssh-known-hosts-cm
208+
optional: true
209+
name: ssh-known-hosts
210+
- configMap:
211+
name: argocd-image-updater-ssh-config
212+
optional: true
213+
name: ssh-config

image-updater/01-always-latest/deployment.yaml renamed to image-updater/example-app/base/deployment.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ apiVersion: apps/v1
33
kind: Deployment
44
metadata:
55
name: simple-deployment
6+
annotations:
7+
codefresh.io/app: simple-go-app
68
spec:
79
replicas: 1
810
selector:
@@ -15,6 +17,9 @@ spec:
1517
spec:
1618
containers:
1719
- name: webserver-simple
20+
imagePullPolicy: Always
1821
image: ghcr.io/codefresh-contrib/gitops-cert-level-2-examples:latest
1922
ports:
20-
- containerPort: 8080
23+
- containerPort: 8080
24+
25+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
resources:
5+
- deployment.yml
6+
- service.yml
File renamed without changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
namespace: qa
5+
namePrefix: qa-
6+
7+
resources:
8+
- ../../base
9+
10+
11+
patchesStrategicMerge:
12+
- version.yml
13+
14+

image-updater/02-semver-example/deployment.yaml renamed to image-updater/example-app/envs/qa/version.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,8 @@ kind: Deployment
44
metadata:
55
name: simple-deployment
66
spec:
7-
replicas: 1
8-
selector:
9-
matchLabels:
10-
app: trivial-go-web-app
117
template:
12-
metadata:
13-
labels:
14-
app: trivial-go-web-app
158
spec:
169
containers:
1710
- name: webserver-simple
18-
image: ghcr.io/codefresh-contrib/gitops-cert-level-2-examples:2.0
19-
ports:
20-
- containerPort: 8080
11+
image: ghcr.io/codefresh-contrib/gitops-cert-level-2-examples:demo
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
namespace: staging
5+
namePrefix: staging-
6+
7+
resources:
8+
- ../../base
9+
10+
patchesStrategicMerge:
11+
- version.yml
12+
13+

0 commit comments

Comments
 (0)