@@ -57,12 +57,15 @@ var _ = Describe("kubebuilder", func() {
57
57
})
58
58
59
59
AfterEach (func () {
60
- By ("By removing restricted namespace label" )
60
+ By ("removing restricted namespace label" )
61
61
_ = kbc .RemoveNamespaceLabelToEnforceRestricted ()
62
62
63
- By ("clean up API objects created during the test " )
63
+ By ("undeploy the project " )
64
64
_ = kbc .Make ("undeploy" )
65
65
66
+ By ("uninstalling the project" )
67
+ _ = kbc .Make ("uninstall" )
68
+
66
69
By ("removing controller image and working dir" )
67
70
kbc .Destroy ()
68
71
})
@@ -91,22 +94,19 @@ var _ = Describe("kubebuilder", func() {
91
94
// FIXME: This test is currently disabled because it requires to be fixed:
92
95
// https://github.com/kubernetes-sigs/kubebuilder/issues/4853
93
96
// 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
- // })
98
- It ("should generate a runnable project with webhooks and metrics protected by network policies" , func () {
99
- GenerateV4WithNetworkPolicies (kbc )
100
- Run (kbc , true , false , false , true , true )
101
- })
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
97
// It("should generate a runnable project with the manager running "+
106
98
// "as restricted and without webhooks", func() {
107
99
// GenerateV4WithoutWebhooks(kbc)
108
100
// Run(kbc, false, false, false, true, false)
109
101
// })
102
+ It ("should generate a runnable project with metrics protected by network policies" , func () {
103
+ GenerateV4WithNetworkPoliciesWithoutWebhooks (kbc )
104
+ Run (kbc , false , false , false , true , true )
105
+ })
106
+ It ("should generate a runnable project with webhooks and metrics protected by network policies" , func () {
107
+ GenerateV4WithNetworkPolicies (kbc )
108
+ Run (kbc , true , false , false , true , true )
109
+ })
110
110
})
111
111
})
112
112
@@ -531,6 +531,16 @@ func getMetricsOutput(kbc *utils.TestContext) string {
531
531
}
532
532
Eventually (verifyCurlUp , 240 * time .Second , time .Second ).Should (Succeed ())
533
533
534
+ By ("validating that the correct ServiceAccount is being used" )
535
+ saName := kbc .Kubectl .ServiceAccount
536
+ currentSAOutput , err := kbc .Kubectl .Get (
537
+ true ,
538
+ "serviceaccount" , saName ,
539
+ "-o" , "jsonpath={.metadata.name}" ,
540
+ )
541
+ Expect (err ).NotTo (HaveOccurred (), "Failed to fetch the service account" )
542
+ Expect (currentSAOutput ).To (Equal (saName ), "The ServiceAccount in use does not match the expected one" )
543
+
534
544
By ("validating that the metrics endpoint is serving as expected" )
535
545
getCurlLogs := func (g Gomega ) {
536
546
metricsOutput , err = kbc .Kubectl .Logs ("curl" )
@@ -569,16 +579,6 @@ func metricsShouldBeUnavailable(kbc *utils.TestContext) {
569
579
}
570
580
Eventually (verifyCurlUp , 240 * time .Second , time .Second ).Should (Succeed ())
571
581
572
- By ("validating that the correct ServiceAccount is being used" )
573
- saName := kbc .Kubectl .ServiceAccount
574
- currentSAOutput , err := kbc .Kubectl .Get (
575
- true ,
576
- "serviceaccount" , saName ,
577
- "-o" , "jsonpath={.metadata.name}" ,
578
- )
579
- Expect (err ).NotTo (HaveOccurred (), "Failed to fetch the service account" )
580
- Expect (currentSAOutput ).To (Equal (saName ), "The ServiceAccount in use does not match the expected one" )
581
-
582
582
By ("validating that the metrics endpoint is not working as expected" )
583
583
getCurlLogs := func (g Gomega ) {
584
584
metricsOutput , err := kbc .Kubectl .Logs ("curl" )
@@ -626,7 +626,7 @@ func cmdOptsToCreateCurlPod(kbc *utils.TestContext, token string) []string {
626
626
627
627
func removeCurlPod (kbc * utils.TestContext ) {
628
628
By ("cleaning up the curl pod" )
629
- _ , err := kbc .Kubectl .Delete (true , "pods/curl" )
629
+ _ , err := kbc .Kubectl .Delete (true , "pods/curl" , "--grace-period=0" , "--force" )
630
630
Expect (err ).NotTo (HaveOccurred ())
631
631
}
632
632
0 commit comments