Skip to content

Commit 46a184b

Browse files
committed
remove collaborator related test cases from global resources
Signed-off-by: Katyanna Moura <[email protected]>
1 parent ac3198b commit 46a184b

File tree

2 files changed

+3
-28
lines changed

2 files changed

+3
-28
lines changed

cluster/cluster.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ Resources:
285285
AWS: !Sub "arn:aws:iam::${AWS::AccountId}:root"
286286
Version: 2012-10-17
287287
Path: /
288-
RoleName: "{{.Cluster.LocalID}/-e2e-eks-iam-test-read-only-role"
288+
RoleName: "{{.Cluster.LocalID}}-e2e-eks-iam-test-read-only-role"
289289
Type: 'AWS::IAM::Role'
290290
E2EEKSIAMTestAccessEntryReadOnly:
291291
Type: "AWS::EKS::AccessEntry"

test/e2e/authorization.go

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -744,11 +744,6 @@ var _ = g.Describe("Authorization via admission-controller [RBAC] [Zalando]", fu
744744
framework.ExpectNoError(err, "failed to delete cluster role: %s", nonSystemResource.Name)
745745
})
746746

747-
g.It("should allow write access for collaborator resources", func() {
748-
err := client.RbacV1().ClusterRoles().Delete(context.Background(), "visibility", metav1.DeleteOptions{DryRun: []string{"All"}})
749-
framework.ExpectNoError(err, "failed to delete cluster role: %s", "visibility")
750-
})
751-
752747
g.It("should allow write access for system resources", func() {
753748
err := client.RbacV1().ClusterRoles().Delete(context.Background(), systemResource.Name, metav1.DeleteOptions{DryRun: []string{"All"}})
754749
framework.ExpectNoError(err, "failed to delete cluster role: %s", systemResource.Name)
@@ -770,29 +765,19 @@ var _ = g.Describe("Authorization via admission-controller [RBAC] [Zalando]", fu
770765
framework.ExpectNoError(err, "failed to delete cluster role: %s", nonSystemResource.Name)
771766
})
772767

773-
g.It("should allow write access for collaborator resources", func() {
774-
err := client.RbacV1().ClusterRoles().Delete(context.Background(), "visibility", metav1.DeleteOptions{DryRun: []string{"All"}})
775-
framework.ExpectNoError(err, "failed to delete cluster role: %s", "visibility")
776-
})
777-
778768
g.It("should deny write access for system resources", func() {
779769
err := client.RbacV1().ClusterRoles().Delete(context.Background(), systemResource.Name, metav1.DeleteOptions{DryRun: []string{"All"}})
780770
gomega.Expect(err).To(gomega.MatchError(gomega.ContainSubstring("write operations are forbidden")))
781771
})
782772

783773
// test specific namespaces
784-
g.It("should allow deletion of non-system namespace", func() {
785-
err := client.CoreV1().Namespaces().Delete(context.Background(), nonSystemResource.Name, metav1.DeleteOptions{DryRun: []string{"All"}})
786-
framework.ExpectNoError(err, "failed to delete namespace: %s", nonSystemResource.Name)
787-
})
788-
789774
g.It("should deny deletion of visibility namespace", func() {
790775
err := client.CoreV1().Namespaces().Delete(context.Background(), "visibility", metav1.DeleteOptions{DryRun: []string{"All"}})
791776
gomega.Expect(err).To(gomega.MatchError(gomega.ContainSubstring("write operations are forbidden")))
792777
})
793778

794779
g.It("should deny deletion of kube-system namespace", func() {
795-
err := client.CoreV1().Namespaces().Delete(context.Background(), systemResource.Name, metav1.DeleteOptions{DryRun: []string{"All"}})
780+
err := client.CoreV1().Namespaces().Delete(context.Background(), "kube-system", metav1.DeleteOptions{DryRun: []string{"All"}})
796781
gomega.Expect(err).To(gomega.MatchError(gomega.ContainSubstring("this namespace may not be deleted")))
797782
})
798783
})
@@ -812,11 +797,6 @@ var _ = g.Describe("Authorization via admission-controller [RBAC] [Zalando]", fu
812797
framework.ExpectNoError(err, "failed to delete cluster role: %s", nonSystemResource.Name)
813798
})
814799

815-
g.It("should deny write access for collaborator resources", func() {
816-
err := client.RbacV1().ClusterRoles().Delete(context.Background(), "visibility", metav1.DeleteOptions{DryRun: []string{"All"}})
817-
gomega.Expect(err).To(gomega.MatchError(gomega.ContainSubstring("write operations are forbidden")))
818-
})
819-
820800
g.It("should deny write access for system resources", func() {
821801
err := client.RbacV1().ClusterRoles().Delete(context.Background(), systemResource.Name, metav1.DeleteOptions{DryRun: []string{"All"}})
822802
gomega.Expect(err).To(gomega.MatchError(gomega.ContainSubstring("write operations are forbidden")))
@@ -829,7 +809,7 @@ var _ = g.Describe("Authorization via admission-controller [RBAC] [Zalando]", fu
829809
})
830810

831811
g.It("should deny deletion of kube-system namespace", func() {
832-
err := client.CoreV1().Namespaces().Delete(context.Background(), systemResource.Name, metav1.DeleteOptions{DryRun: []string{"All"}})
812+
err := client.CoreV1().Namespaces().Delete(context.Background(), "kube-system", metav1.DeleteOptions{DryRun: []string{"All"}})
833813
gomega.Expect(err).To(gomega.MatchError(gomega.ContainSubstring("this namespace may not be deleted")))
834814
})
835815
})
@@ -850,11 +830,6 @@ var _ = g.Describe("Authorization via admission-controller [RBAC] [Zalando]", fu
850830
framework.ExpectNoError(err, "failed to delete cluster role: %s", nonSystemResource.Name)
851831
})
852832

853-
g.It("should deny write access for collaborator resources", func() {
854-
err := client.RbacV1().ClusterRoles().Delete(context.Background(), "visibility", metav1.DeleteOptions{DryRun: []string{"All"}})
855-
gomega.Expect(err).To(gomega.MatchError(gomega.ContainSubstring("write operations are forbidden")))
856-
})
857-
858833
g.It("should deny write access for system resources", func() {
859834
err := client.RbacV1().ClusterRoles().Delete(context.Background(), systemResource.Name, metav1.DeleteOptions{DryRun: []string{"All"}})
860835
gomega.Expect(err).To(gomega.MatchError(gomega.ContainSubstring("write operations are forbidden")))

0 commit comments

Comments
 (0)