Skip to content

Commit 4340944

Browse files
stuggiclaude
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 319e01d commit 4340944

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

tests/functional/suit_test.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ var (
6464
)
6565

6666
const (
67-
timeout = 40 * time.Second
67+
timeout = 45 * time.Second
6868
// have maximum 100 retries before the timeout hits
6969
interval = timeout / 100
7070
)
@@ -90,6 +90,10 @@ var _ = BeforeSuite(func() {
9090
filepath.Join("..", "..", "config", "crd", "bases"),
9191
filepath.Join("metal3-crds"),
9292
},
93+
// Increase this to 60 or 120 seconds for the single-core run
94+
ControlPlaneStartTimeout: 120 * time.Second,
95+
// Give it plenty of time to wind down (e.g., 60-120 seconds)
96+
ControlPlaneStopTimeout: 120 * time.Second,
9397
WebhookInstallOptions: envtest.WebhookInstallOptions{
9498
Paths: []string{filepath.Join("..", "..", "config", "webhook")},
9599
// NOTE(gibi): if localhost is resolved to ::1 (ipv6) then starting
@@ -98,6 +102,14 @@ var _ = BeforeSuite(func() {
98102
LocalServingHost: "127.0.0.1",
99103
},
100104
ErrorIfCRDPathMissing: true,
105+
ControlPlane: envtest.ControlPlane{
106+
APIServer: &envtest.APIServer{
107+
Args: []string{
108+
"--service-cluster-ip-range=10.0.0.0/12", // 65k+ IPs
109+
"--disable-admission-plugins=ResourceQuota,ServiceAccount,NamespaceLifecycle",
110+
},
111+
},
112+
},
101113
}
102114

103115
// cfg is defined in this file globally.

0 commit comments

Comments
 (0)