@@ -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,13 +91,10 @@ 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 metrics protected by network policies" , func () {
95
+ GenerateV4WithNetworkPoliciesWithoutWebhooks (kbc )
96
+ Run (kbc , false , false , false , true , true )
97
+ })
98
98
It ("should generate a runnable project with webhooks and metrics protected by network policies" , func () {
99
99
GenerateV4WithNetworkPolicies (kbc )
100
100
Run (kbc , true , false , false , true , true )
@@ -501,6 +501,13 @@ func getMetricsOutput(kbc *utils.TestContext) string {
501
501
)
502
502
Expect (err ).NotTo (HaveOccurred (), "Controller-manager service should exist" )
503
503
504
+ By ("checking controller-manager logs to verify metrics server is up" )
505
+ controllerPodName := getControllerName (kbc )
506
+ logs , err := kbc .Kubectl .Logs (controllerPodName )
507
+ Expect (err ).NotTo (HaveOccurred (), "failed to get controller-manager logs" )
508
+ Expect (logs ).To (ContainSubstring ("Serving metrics server" ),
509
+ "controller logs should show that metrics server is up" )
510
+
504
511
By ("ensuring the service endpoint is ready" )
505
512
checkServiceEndpoint := func (g Gomega ) {
506
513
var output string
@@ -626,8 +633,10 @@ func cmdOptsToCreateCurlPod(kbc *utils.TestContext, token string) []string {
626
633
627
634
func removeCurlPod (kbc * utils.TestContext ) {
628
635
By ("cleaning up the curl pod" )
629
- _ , err := kbc .Kubectl .Delete (true , "pods/curl" )
630
- Expect (err ).NotTo (HaveOccurred ())
636
+ if _ , err := kbc .Kubectl .Wait (true , "pods/curl" , "--for=delete" , "--timeout=2m" ); err != nil {
637
+ By ("force deleting the curl pod with 0s grace period" )
638
+ _ , _ = kbc .Kubectl .Wait (true , "delete" , "pod" , "curl" , "--grace-period=0" , "--force" )
639
+ }
631
640
}
632
641
633
642
// serviceAccountToken provides a helper function that can provide you with a service account
0 commit comments