From 85e8586ca9dc89441dd4e87347060712b715559d Mon Sep 17 00:00:00 2001 From: Siddhesh Ghadi Date: Tue, 13 Feb 2024 23:47:28 +0530 Subject: [PATCH] Fix kuttl test Signed-off-by: Siddhesh Ghadi --- .../02-assert.yaml | 54 -------- .../02-enable-appset-in-any-ns.yaml | 2 +- .../{15-errors.yaml => 02-errors.yaml} | 0 .../03-add-new-appset-ns.yaml | 2 +- .../{03-assert.yaml => 03-errors.yaml} | 48 ------- .../04-assert.yaml | 65 ++-------- .../04-enable-apps-in-new-ns.yaml | 2 +- .../{05-errors.yaml => 04-errors.yaml} | 1 - .../05-assert.yaml | 117 ++++++++++++++++++ .../05-disable-appset-in-old-ns.yaml | 14 --- ...-ns.yaml => 05-enable-apps-in-old-ns.yaml} | 4 +- .../06-assert.yaml | 6 + .../06-disable-appset-in-new-ns.yaml | 6 +- .../07-assert.yaml | 85 ------------- ...ns.yaml => 07-disable-apps-in-all-ns.yaml} | 3 +- .../07-enable-apps-in-old-ns.yaml | 13 -- .../{13-errors.yaml => 07-errors.yaml} | 21 +++- .../08-assert.yaml | 67 ---------- .../09-assert.yaml | 54 -------- .../09-disable-apps-in-old-ns.yaml | 14 --- .../09-errors.yaml | 25 ---- .../10-assert.yaml | 54 -------- .../10-errors.yaml | 18 --- .../11-disable-appsets-in-old-ns.yaml | 6 - .../11-errors.yaml | 30 ----- .../12-assert.yaml | 67 ---------- .../12-enable-apps-and-appsets-in-new-ns.yaml | 14 --- .../13-disable-everything.yaml | 8 -- .../14-assert.yaml | 54 -------- .../14-enable-appset.yaml | 13 -- .../15-delete-argocd.yaml | 7 -- 31 files changed, 161 insertions(+), 713 deletions(-) delete mode 100644 tests/k8s/1-037_validate_applicationset_in_any_namespace/02-assert.yaml rename tests/k8s/1-037_validate_applicationset_in_any_namespace/{15-errors.yaml => 02-errors.yaml} (100%) rename tests/k8s/1-037_validate_applicationset_in_any_namespace/{03-assert.yaml => 03-errors.yaml} (61%) rename tests/k8s/1-037_validate_applicationset_in_any_namespace/{05-errors.yaml => 04-errors.yaml} (99%) delete mode 100644 tests/k8s/1-037_validate_applicationset_in_any_namespace/05-disable-appset-in-old-ns.yaml rename tests/k8s/1-037_validate_applicationset_in_any_namespace/{08-enable-appsets-in-old-ns.yaml => 05-enable-apps-in-old-ns.yaml} (58%) delete mode 100644 tests/k8s/1-037_validate_applicationset_in_any_namespace/07-assert.yaml rename tests/k8s/1-037_validate_applicationset_in_any_namespace/{10-disable-apps-in-new-ns.yaml => 07-disable-apps-in-all-ns.yaml} (76%) delete mode 100644 tests/k8s/1-037_validate_applicationset_in_any_namespace/07-enable-apps-in-old-ns.yaml rename tests/k8s/1-037_validate_applicationset_in_any_namespace/{13-errors.yaml => 07-errors.yaml} (60%) delete mode 100644 tests/k8s/1-037_validate_applicationset_in_any_namespace/08-assert.yaml delete mode 100644 tests/k8s/1-037_validate_applicationset_in_any_namespace/09-assert.yaml delete mode 100644 tests/k8s/1-037_validate_applicationset_in_any_namespace/09-disable-apps-in-old-ns.yaml delete mode 100644 tests/k8s/1-037_validate_applicationset_in_any_namespace/09-errors.yaml delete mode 100644 tests/k8s/1-037_validate_applicationset_in_any_namespace/10-assert.yaml delete mode 100644 tests/k8s/1-037_validate_applicationset_in_any_namespace/10-errors.yaml delete mode 100644 tests/k8s/1-037_validate_applicationset_in_any_namespace/11-disable-appsets-in-old-ns.yaml delete mode 100644 tests/k8s/1-037_validate_applicationset_in_any_namespace/11-errors.yaml delete mode 100644 tests/k8s/1-037_validate_applicationset_in_any_namespace/12-assert.yaml delete mode 100644 tests/k8s/1-037_validate_applicationset_in_any_namespace/12-enable-apps-and-appsets-in-new-ns.yaml delete mode 100644 tests/k8s/1-037_validate_applicationset_in_any_namespace/13-disable-everything.yaml delete mode 100644 tests/k8s/1-037_validate_applicationset_in_any_namespace/14-assert.yaml delete mode 100644 tests/k8s/1-037_validate_applicationset_in_any_namespace/14-enable-appset.yaml delete mode 100644 tests/k8s/1-037_validate_applicationset_in_any_namespace/15-delete-argocd.yaml diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/02-assert.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/02-assert.yaml deleted file mode 100644 index 5bc6a11fe..000000000 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/02-assert.yaml +++ /dev/null @@ -1,54 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example_appset-old-ns - namespace: appset-old-ns -rules: -- apiGroups: - - argoproj.io - resources: - - applicationsets - verbs: - - create - - get - - list - - patch - - update - - watch - - delete ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: example_appset-old-ns - namespace: appset-old-ns -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: example_appset-old-ns -subjects: -- kind: ServiceAccount - name: example-argocd-server - namespace: appset-argocd -- kind: ServiceAccount - name: example-argocd-application-controller - namespace: appset-argocd ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example-appset-argocd-applicationset - namespace: appset-old-ns ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: example-appset-argocd-applicationset - namespace: appset-old-ns ---- -apiVersion: v1 -kind: Namespace -metadata: - name: appset-old-ns - labels: - argocd.argoproj.io/applicationset-managed-by-cluster-argocd: appset-argocd \ No newline at end of file diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/02-enable-appset-in-any-ns.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/02-enable-appset-in-any-ns.yaml index 9aa818f48..8d49a7a63 100644 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/02-enable-appset-in-any-ns.yaml +++ b/tests/k8s/1-037_validate_applicationset_in_any_namespace/02-enable-appset-in-any-ns.yaml @@ -1,4 +1,4 @@ -# appset resources should be created in target ns +# appset resources shouldn' be created in target ns as apps in target ns is disabled apiVersion: argoproj.io/v1beta1 kind: ArgoCD metadata: diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/15-errors.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/02-errors.yaml similarity index 100% rename from tests/k8s/1-037_validate_applicationset_in_any_namespace/15-errors.yaml rename to tests/k8s/1-037_validate_applicationset_in_any_namespace/02-errors.yaml diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/03-add-new-appset-ns.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/03-add-new-appset-ns.yaml index 489ccccd8..68e584ce0 100644 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/03-add-new-appset-ns.yaml +++ b/tests/k8s/1-037_validate_applicationset_in_any_namespace/03-add-new-appset-ns.yaml @@ -1,4 +1,4 @@ -# appset resources should be created in all target namespaces +# appset resources shouldn't be created as apps in target ns is disabled apiVersion: argoproj.io/v1beta1 kind: ArgoCD metadata: diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/03-assert.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/03-errors.yaml similarity index 61% rename from tests/k8s/1-037_validate_applicationset_in_any_namespace/03-assert.yaml rename to tests/k8s/1-037_validate_applicationset_in_any_namespace/03-errors.yaml index 4e506d7f3..dc583797a 100644 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/03-assert.yaml +++ b/tests/k8s/1-037_validate_applicationset_in_any_namespace/03-errors.yaml @@ -3,36 +3,12 @@ kind: Role metadata: name: example_appset-new-ns namespace: appset-new-ns -rules: -- apiGroups: - - argoproj.io - resources: - - applicationsets - verbs: - - create - - get - - list - - patch - - update - - watch - - delete --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: example_appset-new-ns namespace: appset-new-ns -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: example_appset-new-ns -subjects: -- kind: ServiceAccount - name: example-argocd-server - namespace: appset-argocd -- kind: ServiceAccount - name: example-argocd-application-controller - namespace: appset-argocd --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role @@ -58,36 +34,12 @@ kind: Role metadata: name: example_appset-old-ns namespace: appset-old-ns -rules: -- apiGroups: - - argoproj.io - resources: - - applicationsets - verbs: - - create - - get - - list - - patch - - update - - watch - - delete --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: example_appset-old-ns namespace: appset-old-ns -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: example_appset-old-ns -subjects: -- kind: ServiceAccount - name: example-argocd-server - namespace: appset-argocd -- kind: ServiceAccount - name: example-argocd-application-controller - namespace: appset-argocd --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/04-assert.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/04-assert.yaml index 954d6eff9..763b7f172 100644 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/04-assert.yaml +++ b/tests/k8s/1-037_validate_applicationset_in_any_namespace/04-assert.yaml @@ -7,7 +7,7 @@ rules: - apiGroups: - argoproj.io resources: - - applicationsets + - applications verbs: - create - get @@ -16,10 +16,16 @@ rules: - update - watch - delete +- apiGroups: + - batch + resources: + - jobs + verbs: + - create - apiGroups: - argoproj.io resources: - - applications + - applicationsets verbs: - create - get @@ -65,58 +71,3 @@ metadata: labels: argocd.argoproj.io/applicationset-managed-by-cluster-argocd: appset-argocd argocd.argoproj.io/managed-by-cluster-argocd: appset-argocd ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example_appset-old-ns - namespace: appset-old-ns -rules: -- apiGroups: - - argoproj.io - resources: - - applicationsets - verbs: - - create - - get - - list - - patch - - update - - watch - - delete ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: example_appset-old-ns - namespace: appset-old-ns -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: example_appset-old-ns -subjects: -- kind: ServiceAccount - name: example-argocd-server - namespace: appset-argocd -- kind: ServiceAccount - name: example-argocd-application-controller - namespace: appset-argocd ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example-appset-argocd-applicationset - namespace: appset-old-ns ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: example-appset-argocd-applicationset - namespace: appset-old-ns ---- -apiVersion: v1 -kind: Namespace -metadata: - name: appset-old-ns - labels: - argocd.argoproj.io/applicationset-managed-by-cluster-argocd: appset-argocd \ No newline at end of file diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/04-enable-apps-in-new-ns.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/04-enable-apps-in-new-ns.yaml index 8966de5f3..697c8d0c7 100644 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/04-enable-apps-in-new-ns.yaml +++ b/tests/k8s/1-037_validate_applicationset_in_any_namespace/04-enable-apps-in-new-ns.yaml @@ -1,4 +1,4 @@ -# appset resources should be updated to include app-in-any-ns permissions in target appset-new-ns ns +# appset resources should be created in appset-new-ns namespace as it is subset of sourceNamespaces i.e apps in any ns is enabled on appset-new-ns namespace apiVersion: argoproj.io/v1beta1 kind: ArgoCD metadata: diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/05-errors.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/04-errors.yaml similarity index 99% rename from tests/k8s/1-037_validate_applicationset_in_any_namespace/05-errors.yaml rename to tests/k8s/1-037_validate_applicationset_in_any_namespace/04-errors.yaml index ea9c6a4e7..9200afa82 100644 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/05-errors.yaml +++ b/tests/k8s/1-037_validate_applicationset_in_any_namespace/04-errors.yaml @@ -1,4 +1,3 @@ ---- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/05-assert.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/05-assert.yaml index dba3ec2ed..69cc604dd 100644 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/05-assert.yaml +++ b/tests/k8s/1-037_validate_applicationset_in_any_namespace/05-assert.yaml @@ -1,14 +1,130 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: Role +metadata: + name: example_appset-old-ns + namespace: appset-old-ns +rules: +- apiGroups: + - argoproj.io + resources: + - applications + verbs: + - create + - get + - list + - patch + - update + - watch + - delete +- apiGroups: + - batch + resources: + - jobs + verbs: + - create +- apiGroups: + - argoproj.io + resources: + - applicationsets + verbs: + - create + - get + - list + - patch + - update + - watch + - delete +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: example_appset-old-ns + namespace: appset-old-ns +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: example_appset-old-ns +subjects: +- kind: ServiceAccount + name: example-argocd-server + namespace: appset-argocd +- kind: ServiceAccount + name: example-argocd-application-controller + namespace: appset-argocd +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: example-appset-argocd-applicationset + namespace: appset-old-ns +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: example-appset-argocd-applicationset + namespace: appset-old-ns +--- +apiVersion: v1 +kind: Namespace +metadata: + name: appset-old-ns + labels: + argocd.argoproj.io/applicationset-managed-by-cluster-argocd: appset-argocd + argocd.argoproj.io/managed-by-cluster-argocd: appset-argocd +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role metadata: name: example_appset-new-ns namespace: appset-new-ns +rules: +- apiGroups: + - argoproj.io + resources: + - applications + verbs: + - create + - get + - list + - patch + - update + - watch + - delete +- apiGroups: + - batch + resources: + - jobs + verbs: + - create +- apiGroups: + - argoproj.io + resources: + - applicationsets + verbs: + - create + - get + - list + - patch + - update + - watch + - delete --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: example_appset-new-ns namespace: appset-new-ns +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: example_appset-new-ns +subjects: +- kind: ServiceAccount + name: example-argocd-server + namespace: appset-argocd +- kind: ServiceAccount + name: example-argocd-application-controller + namespace: appset-argocd --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role @@ -28,3 +144,4 @@ metadata: name: appset-new-ns labels: argocd.argoproj.io/applicationset-managed-by-cluster-argocd: appset-argocd + argocd.argoproj.io/managed-by-cluster-argocd: appset-argocd \ No newline at end of file diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/05-disable-appset-in-old-ns.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/05-disable-appset-in-old-ns.yaml deleted file mode 100644 index b443bb329..000000000 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/05-disable-appset-in-old-ns.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# appset resources should be cleaned up from removed appset-old-ns ns -apiVersion: argoproj.io/v1beta1 -kind: ArgoCD -metadata: - name: example - namespace: appset-argocd -spec: - sourceNamespaces: - - appset-new-ns - applicationSet: - sourceNamespaces: - - appset-new-ns - scmProviders: - - github.com \ No newline at end of file diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/08-enable-appsets-in-old-ns.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/05-enable-apps-in-old-ns.yaml similarity index 58% rename from tests/k8s/1-037_validate_applicationset_in_any_namespace/08-enable-appsets-in-old-ns.yaml rename to tests/k8s/1-037_validate_applicationset_in_any_namespace/05-enable-apps-in-old-ns.yaml index d1ffbb8c3..895162076 100644 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/08-enable-appsets-in-old-ns.yaml +++ b/tests/k8s/1-037_validate_applicationset_in_any_namespace/05-enable-apps-in-old-ns.yaml @@ -1,4 +1,4 @@ -# existing resources in appset-old-ns ns should be modified to include appset permissions along with new appset specific roles & rolebindings +# appset resources should be created in appset-old-ns namespace as it is now a subset of sourceNamespaces i.e apps in any ns is enabled on appset-old-ns namespace apiVersion: argoproj.io/v1beta1 kind: ArgoCD metadata: @@ -11,6 +11,6 @@ spec: applicationSet: sourceNamespaces: - appset-old-ns + - appset-new-ns scmProviders: - github.com - diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/06-assert.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/06-assert.yaml index 2d990a61a..3d60b954c 100644 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/06-assert.yaml +++ b/tests/k8s/1-037_validate_applicationset_in_any_namespace/06-assert.yaml @@ -16,6 +16,12 @@ rules: - update - watch - delete +- apiGroups: + - batch + resources: + - jobs + verbs: + - create --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/06-disable-appset-in-new-ns.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/06-disable-appset-in-new-ns.yaml index 93c2b3d38..c50e59a03 100644 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/06-disable-appset-in-new-ns.yaml +++ b/tests/k8s/1-037_validate_applicationset_in_any_namespace/06-disable-appset-in-new-ns.yaml @@ -1,4 +1,4 @@ -# resources in target appset-new-ns ns should only have apps-in-any-ns permissions +# appset resources should be removed and server role in target namespace should be update to remove appset permissions apiVersion: argoproj.io/v1beta1 kind: ArgoCD metadata: @@ -7,7 +7,9 @@ metadata: spec: sourceNamespaces: - appset-new-ns + - appset-old-ns applicationSet: - sourceNamespaces: [] + sourceNamespaces: + - appset-old-ns scmProviders: - github.com diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/07-assert.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/07-assert.yaml deleted file mode 100644 index bd245c153..000000000 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/07-assert.yaml +++ /dev/null @@ -1,85 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example_appset-old-ns - namespace: appset-old-ns -rules: -- apiGroups: - - argoproj.io - resources: - - applications - verbs: - - create - - get - - list - - patch - - update - - watch - - delete ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: example_appset-old-ns - namespace: appset-old-ns -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: example_appset-old-ns -subjects: -- kind: ServiceAccount - name: example-argocd-server - namespace: appset-argocd -- kind: ServiceAccount - name: example-argocd-application-controller - namespace: appset-argocd ---- -apiVersion: v1 -kind: Namespace -metadata: - name: appset-old-ns - labels: - argocd.argoproj.io/managed-by-cluster-argocd: appset-argocd ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example_appset-new-ns - namespace: appset-new-ns -rules: -- apiGroups: - - argoproj.io - resources: - - applications - verbs: - - create - - get - - list - - patch - - update - - watch - - delete ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: example_appset-new-ns - namespace: appset-new-ns -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: example_appset-new-ns -subjects: -- kind: ServiceAccount - name: example-argocd-server - namespace: appset-argocd -- kind: ServiceAccount - name: example-argocd-application-controller - namespace: appset-argocd ---- -apiVersion: v1 -kind: Namespace -metadata: - name: appset-new-ns - labels: - argocd.argoproj.io/managed-by-cluster-argocd: appset-argocd diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/10-disable-apps-in-new-ns.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/07-disable-apps-in-all-ns.yaml similarity index 76% rename from tests/k8s/1-037_validate_applicationset_in_any_namespace/10-disable-apps-in-new-ns.yaml rename to tests/k8s/1-037_validate_applicationset_in_any_namespace/07-disable-apps-in-all-ns.yaml index e31d5bc4c..372db6039 100644 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/10-disable-apps-in-new-ns.yaml +++ b/tests/k8s/1-037_validate_applicationset_in_any_namespace/07-disable-apps-in-all-ns.yaml @@ -1,4 +1,4 @@ -# apps-in-any-ns resources should be cleaned up from appset-new-ns +# all appset resources from target ns should be removed apiVersion: argoproj.io/v1beta1 kind: ArgoCD metadata: @@ -11,4 +11,3 @@ spec: - appset-old-ns scmProviders: - github.com - diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/07-enable-apps-in-old-ns.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/07-enable-apps-in-old-ns.yaml deleted file mode 100644 index 57c4d20ed..000000000 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/07-enable-apps-in-old-ns.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# no appset permissions should be added to target namespaces -apiVersion: argoproj.io/v1beta1 -kind: ArgoCD -metadata: - name: example - namespace: appset-argocd -spec: - sourceNamespaces: - - appset-new-ns - - appset-old-ns - applicationSet: - scmProviders: - - github.com diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/13-errors.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/07-errors.yaml similarity index 60% rename from tests/k8s/1-037_validate_applicationset_in_any_namespace/13-errors.yaml rename to tests/k8s/1-037_validate_applicationset_in_any_namespace/07-errors.yaml index bbe17de0e..c830cfa04 100644 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/13-errors.yaml +++ b/tests/k8s/1-037_validate_applicationset_in_any_namespace/07-errors.yaml @@ -1,5 +1,17 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: Role +metadata: + name: example_appset-new-ns + namespace: appset-new-ns +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: example_appset-new-ns + namespace: appset-new-ns +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role metadata: name: example_appset-old-ns namespace: appset-old-ns @@ -28,4 +40,11 @@ metadata: name: appset-old-ns labels: argocd.argoproj.io/applicationset-managed-by-cluster-argocd: appset-argocd - argocd.argoproj.io/managed-by-cluster-argocd: appset-argocd \ No newline at end of file + argocd.argoproj.io/managed-by-cluster-argocd: appset-argocd +--- +apiVersion: v1 +kind: Namespace +metadata: + name: appset-new-ns + labels: + argocd.argoproj.io/managed-by-cluster-argocd: appset-argocd diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/08-assert.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/08-assert.yaml deleted file mode 100644 index 02c28ffd2..000000000 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/08-assert.yaml +++ /dev/null @@ -1,67 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example_appset-old-ns - namespace: appset-old-ns -rules: -- apiGroups: - - argoproj.io - resources: - - applicationsets - verbs: - - create - - get - - list - - patch - - update - - watch - - delete -- apiGroups: - - argoproj.io - resources: - - applications - verbs: - - create - - get - - list - - patch - - update - - watch - - delete ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: example_appset-old-ns - namespace: appset-old-ns -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: example_appset-old-ns -subjects: -- kind: ServiceAccount - name: example-argocd-server - namespace: appset-argocd -- kind: ServiceAccount - name: example-argocd-application-controller - namespace: appset-argocd ---- -apiVersion: v1 -kind: Namespace -metadata: - name: appset-old-ns - labels: - argocd.argoproj.io/managed-by-cluster-argocd: appset-argocd - argocd.argoproj.io/applicationset-managed-by-cluster-argocd: appset-argocd ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example-appset-argocd-applicationset - namespace: appset-old-ns ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: example-appset-argocd-applicationset - namespace: appset-old-ns \ No newline at end of file diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/09-assert.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/09-assert.yaml deleted file mode 100644 index 3c0c42582..000000000 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/09-assert.yaml +++ /dev/null @@ -1,54 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example_appset-old-ns - namespace: appset-old-ns -rules: -- apiGroups: - - argoproj.io - resources: - - applicationsets - verbs: - - create - - get - - list - - patch - - update - - watch - - delete ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: example_appset-old-ns - namespace: appset-old-ns -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: example_appset-old-ns -subjects: -- kind: ServiceAccount - name: example-argocd-server - namespace: appset-argocd -- kind: ServiceAccount - name: example-argocd-application-controller - namespace: appset-argocd ---- -apiVersion: v1 -kind: Namespace -metadata: - name: appset-old-ns - labels: - argocd.argoproj.io/applicationset-managed-by-cluster-argocd: appset-argocd ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example-appset-argocd-applicationset - namespace: appset-old-ns ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: example-appset-argocd-applicationset - namespace: appset-old-ns \ No newline at end of file diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/09-disable-apps-in-old-ns.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/09-disable-apps-in-old-ns.yaml deleted file mode 100644 index f39a6b0cc..000000000 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/09-disable-apps-in-old-ns.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# apps-in-any-ns permissions should be removed from target appset-old-ns ns -apiVersion: argoproj.io/v1beta1 -kind: ArgoCD -metadata: - name: example - namespace: appset-argocd -spec: - sourceNamespaces: - - appset-new-ns - applicationSet: - sourceNamespaces: - - appset-old-ns - scmProviders: - - github.com diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/09-errors.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/09-errors.yaml deleted file mode 100644 index 337043766..000000000 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/09-errors.yaml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example_appset-old-ns - namespace: appset-old-ns -rules: -- apiGroups: - - argoproj.io - resources: - - applications - verbs: - - create - - get - - list - - patch - - update - - watch - - delete ---- -apiVersion: v1 -kind: Namespace -metadata: - name: appset-old-ns - labels: - argocd.argoproj.io/managed-by-cluster-argocd: appset-argocd \ No newline at end of file diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/10-assert.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/10-assert.yaml deleted file mode 100644 index 3c0c42582..000000000 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/10-assert.yaml +++ /dev/null @@ -1,54 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example_appset-old-ns - namespace: appset-old-ns -rules: -- apiGroups: - - argoproj.io - resources: - - applicationsets - verbs: - - create - - get - - list - - patch - - update - - watch - - delete ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: example_appset-old-ns - namespace: appset-old-ns -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: example_appset-old-ns -subjects: -- kind: ServiceAccount - name: example-argocd-server - namespace: appset-argocd -- kind: ServiceAccount - name: example-argocd-application-controller - namespace: appset-argocd ---- -apiVersion: v1 -kind: Namespace -metadata: - name: appset-old-ns - labels: - argocd.argoproj.io/applicationset-managed-by-cluster-argocd: appset-argocd ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example-appset-argocd-applicationset - namespace: appset-old-ns ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: example-appset-argocd-applicationset - namespace: appset-old-ns \ No newline at end of file diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/10-errors.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/10-errors.yaml deleted file mode 100644 index d4c99055e..000000000 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/10-errors.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example_appset-new-ns - namespace: appset-new-ns ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: example_appset-new-ns - namespace: appset-new-ns ---- -apiVersion: v1 -kind: Namespace -metadata: - name: appset-new-ns - labels: - argocd.argoproj.io/managed-by-cluster-argocd: appset-argocd \ No newline at end of file diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/11-disable-appsets-in-old-ns.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/11-disable-appsets-in-old-ns.yaml deleted file mode 100644 index add755da9..000000000 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/11-disable-appsets-in-old-ns.yaml +++ /dev/null @@ -1,6 +0,0 @@ -# appset resources should be removed -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: -- script: | - kubectl patch -n appset-argocd argocd/example --type='json' -p='[{"op": "remove", "path": "/spec/applicationSet"}]' \ No newline at end of file diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/11-errors.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/11-errors.yaml deleted file mode 100644 index b7c7cce88..000000000 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/11-errors.yaml +++ /dev/null @@ -1,30 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example_appset-old-ns - namespace: appset-old-ns ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: example_appset-old-ns - namespace: appset-old-ns ---- -apiVersion: v1 -kind: Namespace -metadata: - name: appset-old-ns - labels: - argocd.argoproj.io/applicationset-managed-by-cluster-argocd: appset-argocd ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example-appset-argocd-applicationset - namespace: appset-old-ns ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: example-appset-argocd-applicationset - namespace: appset-old-ns \ No newline at end of file diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/12-assert.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/12-assert.yaml deleted file mode 100644 index 4c5fc138e..000000000 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/12-assert.yaml +++ /dev/null @@ -1,67 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example_appset-old-ns - namespace: appset-old-ns -rules: -- apiGroups: - - argoproj.io - resources: - - applicationsets - verbs: - - create - - get - - list - - patch - - update - - watch - - delete -- apiGroups: - - argoproj.io - resources: - - applications - verbs: - - create - - get - - list - - patch - - update - - watch - - delete ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: example_appset-old-ns - namespace: appset-old-ns -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: example_appset-old-ns -subjects: -- kind: ServiceAccount - name: example-argocd-server - namespace: appset-argocd -- kind: ServiceAccount - name: example-argocd-application-controller - namespace: appset-argocd ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example-appset-argocd-applicationset - namespace: appset-old-ns ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: example-appset-argocd-applicationset - namespace: appset-old-ns ---- -apiVersion: v1 -kind: Namespace -metadata: - name: appset-old-ns - labels: - argocd.argoproj.io/applicationset-managed-by-cluster-argocd: appset-argocd - argocd.argoproj.io/managed-by-cluster-argocd: appset-argocd \ No newline at end of file diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/12-enable-apps-and-appsets-in-new-ns.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/12-enable-apps-and-appsets-in-new-ns.yaml deleted file mode 100644 index a7808d55d..000000000 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/12-enable-apps-and-appsets-in-new-ns.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# resources created in target ns should have both apps & appsets permissions -apiVersion: argoproj.io/v1beta1 -kind: ArgoCD -metadata: - name: example - namespace: appset-argocd -spec: - sourceNamespaces: - - appset-old-ns - applicationSet: - sourceNamespaces: - - appset-old-ns - scmProviders: - - github.com diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/13-disable-everything.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/13-disable-everything.yaml deleted file mode 100644 index 0eadac27a..000000000 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/13-disable-everything.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# all resources from target namespaces should be cleaned up -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: -- script: | - kubectl patch -n appset-argocd argocd/example --type='json' -p='[{"op": "remove", "path": "/spec/applicationSet"}]' - kubectl patch -n appset-argocd argocd/example --type='json' -p='[{"op": "remove", "path": "/spec/sourceNamespaces"}]' - diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/14-assert.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/14-assert.yaml deleted file mode 100644 index 5bc6a11fe..000000000 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/14-assert.yaml +++ /dev/null @@ -1,54 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example_appset-old-ns - namespace: appset-old-ns -rules: -- apiGroups: - - argoproj.io - resources: - - applicationsets - verbs: - - create - - get - - list - - patch - - update - - watch - - delete ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: example_appset-old-ns - namespace: appset-old-ns -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: example_appset-old-ns -subjects: -- kind: ServiceAccount - name: example-argocd-server - namespace: appset-argocd -- kind: ServiceAccount - name: example-argocd-application-controller - namespace: appset-argocd ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: example-appset-argocd-applicationset - namespace: appset-old-ns ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: example-appset-argocd-applicationset - namespace: appset-old-ns ---- -apiVersion: v1 -kind: Namespace -metadata: - name: appset-old-ns - labels: - argocd.argoproj.io/applicationset-managed-by-cluster-argocd: appset-argocd \ No newline at end of file diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/14-enable-appset.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/14-enable-appset.yaml deleted file mode 100644 index 21b57cec5..000000000 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/14-enable-appset.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# appset resources should be added to target ns -apiVersion: argoproj.io/v1beta1 -kind: ArgoCD -metadata: - name: example - namespace: appset-argocd -spec: - applicationSet: - sourceNamespaces: - - appset-old-ns - scmProviders: - - github.com - diff --git a/tests/k8s/1-037_validate_applicationset_in_any_namespace/15-delete-argocd.yaml b/tests/k8s/1-037_validate_applicationset_in_any_namespace/15-delete-argocd.yaml deleted file mode 100644 index f1fe9956a..000000000 --- a/tests/k8s/1-037_validate_applicationset_in_any_namespace/15-delete-argocd.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# appset resources in target ns should be cleaned up upon argocd delete -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: -- script: | - kubectl delete -n appset-argocd argocd/example -