Skip to content

Add e2e tests for apps in any namespace feature #844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions test/e2e/suite/006-apps-in-any-namespace/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: image-updater-006
namespace: image-updater-e2e-006-01
status:
health:
status: Healthy
sync:
status: Synced
90 changes: 90 additions & 0 deletions test/e2e/suite/006-apps-in-any-namespace/01-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
apiVersion: v1
kind: Namespace
metadata:
name: image-updater-e2e-006-01
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: argocd-application-controller
namespace: image-updater-e2e-006-01 # Target namespace where the app will be deployed
rules:
- apiGroups: [""]
resources: ["pods", "services", "replicationcontrollers"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["apps"]
resources: ["deployments", "daemonsets", "replicasets", "statefulsets"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["extensions"]
resources: ["ingresses"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: argocd-application-controller-binding
namespace: image-updater-e2e-006-01 # Namespace where the Argo CD application is managed
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: argocd-application-controller
namespace: argocd-image-updater-e2e # Namespace where the Argo CD application controller is running
subjects:
- kind: ServiceAccount
name: argocd-application-controller
namespace: argocd-image-updater-e2e # Namespace where the Argo CD application controller is running
---
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-cmd-params-cm
namespace: argocd-image-updater-e2e
labels:
app.kubernetes.io/name: argocd-cmd-params-cm
app.kubernetes.io/part-of: argocd
data:
application.namespaces: '*'
---
kind: AppProject
apiVersion: argoproj.io/v1alpha1
metadata:
name: project-one
namespace: argocd-image-updater-e2e
spec:
sourceRepos:
- '*'
destinations:
- namespace: '*'
server: '*'
sourceNamespaces:
- image-updater-e2e-006-01
---
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
kubectl rollout restart -n argocd-image-updater-e2e deployment argocd-server
kubectl rollout restart -n argocd-image-updater-e2e statefulset argocd-application-controller
sleep 30
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: image-updater-006
namespace: image-updater-e2e-006-01
annotations:
argocd-image-updater.argoproj.io/image-list: guestbook=gcr.io/heptio-images/ks-guestbook-demo:~0
argocd-image-updater.argoproj.io/guestbook.update-strategy: semver
spec:
project: project-one
source:
repoURL: https://github.com/argoproj/argocd-example-apps.git
path: kustomize-guestbook
targetRevision: HEAD
destination:
server: https://kubernetes.default.svc
namespace: image-updater-e2e-006-01
syncPolicy:
automated:
prune: true
selfHeal: true
24 changes: 24 additions & 0 deletions test/e2e/suite/006-apps-in-any-namespace/02-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: image-updater-006
namespace: image-updater-e2e-006-01
spec:
source:
kustomize:
images:
- gcr.io/heptio-images/ks-guestbook-demo:0.2
status:
health:
status: Healthy
sync:
status: Synced
---
apiVersion: v1
kind: Pod
metadata:
namespace: image-updater-e2e-006-01
spec:
containers:
- image: gcr.io/heptio-images/ks-guestbook-demo:0.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
${SRC_DIR}/dist/argocd-image-updater run --once \
--argocd-namespace argocd-image-updater-e2e \
--loglevel trace
sleep 30
30 changes: 30 additions & 0 deletions test/e2e/suite/006-apps-in-any-namespace/99-delete.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 120
delete:
- apiVersion: argoproj.io/v1alpha1
kind: Application
name: image-updater-006
namespace: image-updater-e2e-006-01
- apiVersion: argoproj.io/v1alpha1
kind: AppProject
name: project-one
- apiVersion: v1
kind: Namespace
name: image-updater-e2e-006-01
- apiVersion: v1
kind: Namespace
name: image-updater-e2e-006
- apiVersion: rbac.authorization.k8s.io/v1
kind: Role
name: argocd-application-controller
namespace: image-updater-e2e-006-01
- apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
name: argocd-application-controller-binding
namespace: image-updater-e2e-006-01
script: |
kubectl patch configmap argocd-cmd-params-cm -n argocd-image-updater-e2e --type=json -p='[{"op": "remove", "path": "/data/application.namespaces"}]'
kubectl rollout restart -n argocd-image-updater-e2e deployment argocd-server
kubectl rollout restart -n argocd-image-updater-e2e statefulset argocd-application-controller
sleep 30
Loading