Skip to content

Commit c1c2d8b

Browse files
stuggiclaude
authored andcommitted
Sync envtest optimization across all operators
With recent changes to the CI env we hit issues running envtest hitting timeouts in test since 25s was not enough, but also during kube-api startup and register custom CRDs before checks start and teardown of the kube-api. Therefore adding ControlPlaneStartTimeout and ControlPlaneStopTimeout bumping the default 60s to 120s. Also hitting slow env and with our tests, we have seen that the default cluster ip range /24 is to small, increasing to /12 Also disable not required admission plugins for envtest: ResourceQuota: This stops the "quota evaluation timed out" error. The API server will no longer try to calculate how many resources exist before letting you create new ones. ServiceAccount: This prevents the API server from looking for a ServiceAccount issuer or secret for every pod/resource. Since envtest doesn't run the ServiceAccount controller, this plugin often just causes unnecessary errors or delays. NamespaceLifecycle: (Optional but recommended) This allows you to create resources in a namespace even if the namespace is in a "Terminating" state. This is very helpful when your cleanup is slow due to CPU throttling. Signed-off-by: Martin Schuppert <mschuppert@redhat.com> Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 4828c28 commit c1c2d8b

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

test/functional/suite_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ var _ = BeforeSuite(func() {
114114

115115
By("bootstrapping test environment")
116116
testEnv = &envtest.Environment{
117+
// Increase this to 60 or 120 seconds for the single-core run
118+
ControlPlaneStartTimeout: 120 * time.Second,
119+
// Give it plenty of time to wind down (e.g., 60-120 seconds)
120+
ControlPlaneStopTimeout: 120 * time.Second,
117121
CRDDirectoryPaths: []string{
118122
filepath.Join("..", "..", "config", "crd", "bases"),
119123
// NOTE(gibi): we need to list all the external CRDs our operator depends on
@@ -129,6 +133,14 @@ var _ = BeforeSuite(func() {
129133
// failing on the colons in ::1
130134
LocalServingHost: "127.0.0.1",
131135
},
136+
ControlPlane: envtest.ControlPlane{
137+
APIServer: &envtest.APIServer{
138+
Args: []string{
139+
"--service-cluster-ip-range=10.0.0.0/12", // 65k+ IPs
140+
"--disable-admission-plugins=ResourceQuota,ServiceAccount,NamespaceLifecycle",
141+
},
142+
},
143+
},
132144
}
133145

134146
// cfg is defined in this file globally.

0 commit comments

Comments
 (0)