@@ -63,6 +63,9 @@ var _ = Describe("kubebuilder", func() {
63
63
By ("clean up API objects created during the test" )
64
64
_ = kbc .Make ("undeploy" )
65
65
66
+ By ("clean up API objects created during the test" )
67
+ _ = kbc .Make ("uninstall" )
68
+
66
69
By ("removing controller image and working dir" )
67
70
kbc .Destroy ()
68
71
})
@@ -88,25 +91,19 @@ var _ = Describe("kubebuilder", func() {
88
91
GenerateV4WithoutMetrics (kbc )
89
92
Run (kbc , true , false , false , false , false )
90
93
})
91
- // FIXME: This test is currently disabled because it requires to be fixed:
92
- // https://github.com/kubernetes-sigs/kubebuilder/issues/4853
93
- // It is not working for k8s 1.33
94
- // It("should generate a runnable project with metrics protected by network policies", func() {
95
- // GenerateV4WithNetworkPoliciesWithoutWebhooks(kbc)
96
- // Run(kbc, false, false, false, true, true)
97
- // })
94
+ It ("should generate a runnable project with the manager running " +
95
+ "as restricted and without webhooks" , func () {
96
+ GenerateV4WithoutWebhooks (kbc )
97
+ Run (kbc , false , false , false , true , false )
98
+ })
99
+ //It("should generate a runnable project with metrics protected by network policies", func() {
100
+ // GenerateV4WithNetworkPoliciesWithoutWebhooks(kbc)
101
+ // Run(kbc, false, false, false, true, true)
102
+ //})
98
103
It ("should generate a runnable project with webhooks and metrics protected by network policies" , func () {
99
104
GenerateV4WithNetworkPolicies (kbc )
100
105
Run (kbc , true , false , false , true , true )
101
106
})
102
- // FIXME: This test is currently disabled because it requires to be fixed:
103
- // https://github.com/kubernetes-sigs/kubebuilder/issues/4853
104
- // It is not working for k8s 1.33
105
- // It("should generate a runnable project with the manager running "+
106
- // "as restricted and without webhooks", func() {
107
- // GenerateV4WithoutWebhooks(kbc)
108
- // Run(kbc, false, false, false, true, false)
109
- // })
110
107
})
111
108
})
112
109
@@ -615,8 +612,26 @@ func cmdOptsToCreateCurlPod(kbc *utils.TestContext, token string) []string {
615
612
616
613
func removeCurlPod (kbc * utils.TestContext ) {
617
614
By ("cleaning up the curl pod" )
618
- _ , err := kbc .Kubectl .Delete (true , "pods/curl" )
619
- Expect (err ).NotTo (HaveOccurred ())
615
+
616
+ _ , err := kbc .Kubectl .Delete (true , "pod" , "curl" )
617
+ Expect (err ).NotTo (HaveOccurred (), "Failed to delete curl pod" )
618
+
619
+ var deleted bool
620
+ Eventually (func () bool {
621
+ _ , err := kbc .Kubectl .Get (true , "pod" , "curl" )
622
+ deleted = err != nil
623
+ return deleted
624
+ }, time .Minute , time .Second ).Should (BeTrue (), "curl pod should be deleted within 1 minute" )
625
+
626
+ if ! deleted {
627
+ By ("forcing deletion of the curl pod" )
628
+ _ , err := kbc .Kubectl .Command ("delete" , "pod" , "curl" , "--grace-period=0" , "--force" )
629
+ Expect (err ).NotTo (HaveOccurred (), "Force delete of curl pod failed" )
630
+ Eventually (func (g Gomega ) {
631
+ _ , err := kbc .Kubectl .Get (true , "pod" , "curl" )
632
+ g .Expect (err ).To (HaveOccurred ())
633
+ }, time .Minute , time .Second ).Should (Succeed (), "curl pod should be deleted after force" )
634
+ }
620
635
}
621
636
622
637
// serviceAccountToken provides a helper function that can provide you with a service account
0 commit comments