Skip to content

Commit 02eee1d

Browse files
Add e2e tests for apps in any namespace feature (#844)
Signed-off-by: Ishita Sequeira <ishiseq29@gmail.com>
1 parent 3e7378a commit 02eee1d

File tree

6 files changed

+304
-0
lines changed

6 files changed

+304
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
metadata:
4+
name: image-updater-006
5+
namespace: image-updater-e2e-006-01
6+
status:
7+
health:
8+
status: Healthy
9+
sync:
10+
status: Synced
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: image-updater-e2e-006-01
5+
---
6+
apiVersion: rbac.authorization.k8s.io/v1
7+
kind: Role
8+
metadata:
9+
name: argocd-application-controller
10+
namespace: image-updater-e2e-006-01 # Target namespace where the app will be deployed
11+
rules:
12+
- apiGroups: [""]
13+
resources: ["pods", "services", "replicationcontrollers"]
14+
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
15+
- apiGroups: ["apps"]
16+
resources: ["deployments", "daemonsets", "replicasets", "statefulsets"]
17+
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
18+
- apiGroups: ["extensions"]
19+
resources: ["ingresses"]
20+
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
21+
---
22+
apiVersion: rbac.authorization.k8s.io/v1
23+
kind: RoleBinding
24+
metadata:
25+
name: argocd-application-controller-binding
26+
namespace: image-updater-e2e-006-01 # Namespace where the Argo CD application is managed
27+
roleRef:
28+
apiGroup: rbac.authorization.k8s.io
29+
kind: Role
30+
name: argocd-application-controller
31+
namespace: argocd-image-updater-e2e # Namespace where the Argo CD application controller is running
32+
subjects:
33+
- kind: ServiceAccount
34+
name: argocd-application-controller
35+
namespace: argocd-image-updater-e2e # Namespace where the Argo CD application controller is running
36+
---
37+
apiVersion: v1
38+
kind: ConfigMap
39+
metadata:
40+
name: argocd-cmd-params-cm
41+
namespace: argocd-image-updater-e2e
42+
labels:
43+
app.kubernetes.io/name: argocd-cmd-params-cm
44+
app.kubernetes.io/part-of: argocd
45+
data:
46+
application.namespaces: '*'
47+
---
48+
kind: AppProject
49+
apiVersion: argoproj.io/v1alpha1
50+
metadata:
51+
name: project-one
52+
namespace: argocd-image-updater-e2e
53+
spec:
54+
sourceRepos:
55+
- '*'
56+
destinations:
57+
- namespace: '*'
58+
server: '*'
59+
sourceNamespaces:
60+
- image-updater-e2e-006-01
61+
---
62+
apiVersion: kuttl.dev/v1beta1
63+
kind: TestStep
64+
commands:
65+
- script: |
66+
kubectl rollout restart -n argocd-image-updater-e2e deployment argocd-server
67+
kubectl rollout restart -n argocd-image-updater-e2e statefulset argocd-application-controller
68+
sleep 30
69+
---
70+
apiVersion: argoproj.io/v1alpha1
71+
kind: Application
72+
metadata:
73+
name: image-updater-006
74+
namespace: image-updater-e2e-006-01
75+
annotations:
76+
argocd-image-updater.argoproj.io/image-list: guestbook=gcr.io/heptio-images/ks-guestbook-demo:~0
77+
argocd-image-updater.argoproj.io/guestbook.update-strategy: semver
78+
spec:
79+
project: project-one
80+
source:
81+
repoURL: https://github.com/argoproj/argocd-example-apps.git
82+
path: kustomize-guestbook
83+
targetRevision: HEAD
84+
destination:
85+
server: https://kubernetes.default.svc
86+
namespace: image-updater-e2e-006-01
87+
syncPolicy:
88+
automated:
89+
prune: true
90+
selfHeal: true
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
apiVersion: argoproj.io/v1alpha1
3+
kind: Application
4+
metadata:
5+
name: image-updater-006
6+
namespace: image-updater-e2e-006-01
7+
spec:
8+
source:
9+
kustomize:
10+
images:
11+
- gcr.io/heptio-images/ks-guestbook-demo:0.2
12+
status:
13+
health:
14+
status: Healthy
15+
sync:
16+
status: Synced
17+
---
18+
apiVersion: v1
19+
kind: Pod
20+
metadata:
21+
namespace: image-updater-e2e-006-01
22+
spec:
23+
containers:
24+
- image: gcr.io/heptio-images/ks-guestbook-demo:0.2
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestStep
3+
commands:
4+
- script: |
5+
${SRC_DIR}/dist/argocd-image-updater run --once \
6+
--argocd-namespace argocd-image-updater-e2e \
7+
--loglevel trace
8+
sleep 30
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestStep
3+
timeout: 120
4+
delete:
5+
- apiVersion: argoproj.io/v1alpha1
6+
kind: Application
7+
name: image-updater-006
8+
namespace: image-updater-e2e-006-01
9+
- apiVersion: argoproj.io/v1alpha1
10+
kind: AppProject
11+
name: project-one
12+
- apiVersion: v1
13+
kind: Namespace
14+
name: image-updater-e2e-006-01
15+
- apiVersion: v1
16+
kind: Namespace
17+
name: image-updater-e2e-006
18+
- apiVersion: rbac.authorization.k8s.io/v1
19+
kind: Role
20+
name: argocd-application-controller
21+
namespace: image-updater-e2e-006-01
22+
- apiVersion: rbac.authorization.k8s.io/v1
23+
kind: RoleBinding
24+
name: argocd-application-controller-binding
25+
namespace: image-updater-e2e-006-01
26+
script: |
27+
kubectl patch configmap argocd-cmd-params-cm -n argocd-image-updater-e2e --type=json -p='[{"op": "remove", "path": "/data/application.namespaces"}]'
28+
kubectl rollout restart -n argocd-image-updater-e2e deployment argocd-server
29+
kubectl rollout restart -n argocd-image-updater-e2e statefulset argocd-application-controller
30+
sleep 30

0 commit comments

Comments
 (0)