@@ -643,10 +643,12 @@ var _ = g.Describe("Authorization via admission-controller [RBAC] [Zalando]", fu
643
643
framework .ExpectNoError (err , "failed to create pod: %s in namespace: %s" , nonSystemResource .Name , nonSystemResource .Namespace )
644
644
})
645
645
646
- g .It ("should deny delete access in collaborator namespace" , func () {
647
- err := client .CoreV1 ().Pods (collaboratorResource .Namespace ).Delete (context .Background (), collaboratorResource .Name , metav1.DeleteOptions {DryRun : []string {"All" }})
648
- gomega .Expect (err ).To (gomega .MatchError (gomega .ContainSubstring ("delete operations are forbidden" )))
649
- })
646
+ // Not needed actually
647
+ // // TODO: need to create resource before deleting it
648
+ // g.It("should deny delete access in collaborator namespace", func() {
649
+ // err := client.CoreV1().Pods(collaboratorResource.Namespace).Delete(context.Background(), collaboratorResource.Name, metav1.DeleteOptions{DryRun: []string{"All"}})
650
+ // gomega.Expect(err).To(gomega.MatchError(gomega.ContainSubstring("delete operations are forbidden")))
651
+ // })
650
652
651
653
// Should allow visibility ns deletion?
652
654
// g.It("should allow delete access in collaborator namespace", func() {
@@ -664,10 +666,12 @@ var _ = g.Describe("Authorization via admission-controller [RBAC] [Zalando]", fu
664
666
gomega .Expect (err ).To (gomega .MatchError (gomega .ContainSubstring ("write operations are forbidden" )))
665
667
})
666
668
667
- g .It ("should deny delete access in system namespace" , func () {
668
- err := client .CoreV1 ().Pods (systemResource .Namespace ).Delete (context .Background (), systemResource .Name , metav1.DeleteOptions {DryRun : []string {"All" }})
669
- gomega .Expect (err ).To (gomega .MatchError (gomega .ContainSubstring ("delete operations are forbidden" )))
670
- })
669
+ // Not needed actually
670
+ // // TODO: need to create resource before deleting it
671
+ // g.It("should deny delete access in system namespace", func() {
672
+ // err := client.CoreV1().Pods(systemResource.Namespace).Delete(context.Background(), systemResource.Name, metav1.DeleteOptions{DryRun: []string{"All"}})
673
+ // gomega.Expect(err).To(gomega.MatchError(gomega.ContainSubstring("delete operations are forbidden")))
674
+ // })
671
675
})
672
676
673
677
// TODO: this is for manual/ememergency access (to be consistent let's rename it to "privleged" because this si now called "privielegd access" by the IAM team)
@@ -787,12 +791,12 @@ var _ = g.Describe("Authorization via admission-controller [RBAC] [Zalando]", fu
787
791
788
792
g .It ("should deny deletion of kube-system namespace" , func () {
789
793
err := client .CoreV1 ().Namespaces ().Delete (context .Background (), "kube-system" , metav1.DeleteOptions {DryRun : []string {"All" }})
790
- gomega .Expect (err ).To (gomega .MatchError (gomega .ContainSubstring ("write operations are forbidden " )))
794
+ gomega .Expect (err ).To (gomega .MatchError (gomega .ContainSubstring ("this namespace may not be deleted " )))
791
795
})
792
796
793
797
g .It ("should deny deletion of visibility namespace" , func () {
794
798
err := client .CoreV1 ().Namespaces ().Delete (context .Background (), "visibility" , metav1.DeleteOptions {DryRun : []string {"All" }})
795
- framework . ExpectNoError (err , "failed to delete cluster role: %s" , nonSystemResource . Name )
799
+ gomega . Expect (err ). To ( gomega . MatchError ( gomega . ContainSubstring ( "write operations are forbidden" )) )
796
800
})
797
801
})
798
802
@@ -820,12 +824,12 @@ var _ = g.Describe("Authorization via admission-controller [RBAC] [Zalando]", fu
820
824
821
825
g .It ("should deny deletion of kube-system namespace" , func () {
822
826
err := client .CoreV1 ().Namespaces ().Delete (context .Background (), "kube-system" , metav1.DeleteOptions {DryRun : []string {"All" }})
823
- gomega .Expect (err ).To (gomega .MatchError (gomega .ContainSubstring ("write operations are forbidden " )))
827
+ gomega .Expect (err ).To (gomega .MatchError (gomega .ContainSubstring ("this namespace may not be deleted " )))
824
828
})
825
829
826
830
g .It ("should deny deletion of visibility namespace" , func () {
827
831
err := client .CoreV1 ().Namespaces ().Delete (context .Background (), "visibility" , metav1.DeleteOptions {DryRun : []string {"All" }})
828
- framework . ExpectNoError (err , "failed to delete cluster role: %s" , nonSystemResource . Name )
832
+ gomega . Expect (err ). To ( gomega . MatchError ( gomega . ContainSubstring ( "write operations are forbidden" )) )
829
833
})
830
834
})
831
835
0 commit comments