From 26ed5cd17b86dda6a9a84e3169a83706e45c2fb4 Mon Sep 17 00:00:00 2001 From: Petr Muller Date: Thu, 13 Nov 2025 00:24:42 +0100 Subject: [PATCH] UPSTREAM: : Extend CRD deletion timeouts Similar to Justin's earlier proposal about Pod-related timeouts, this proposes prolonging timeouts applied to CRD deletion. Most calls to deletion helpers are done for testcase cleanup, and we often see failures in various testcases correlating with periods of high control plane load. This is not an entirely uncommon flake: https://search.dptools.openshift.org/?search=deleting+CustomResourceDefinition%3A+context+deadline+exceeded&maxAge=48h&context=1&type=bug%2Bissue%2Bjunit&name=&excludeName=&maxMatches=5&maxBytes=20971520&groupBy=job --- .../test/integration/fixtures/resources.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/staging/src/k8s.io/apiextensions-apiserver/test/integration/fixtures/resources.go b/staging/src/k8s.io/apiextensions-apiserver/test/integration/fixtures/resources.go index ff5adae4a1c33..9e45996fc8634 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/test/integration/fixtures/resources.go +++ b/staging/src/k8s.io/apiextensions-apiserver/test/integration/fixtures/resources.go @@ -511,13 +511,17 @@ func isWatchCachePrimed(crd *apiextensionsv1.CustomResourceDefinition, dynamicCl return true, nil } +const ( + crdDeletionTimeout = time.Minute +) + // DeleteV1CustomResourceDefinition deletes a CRD and waits until it disappears from discovery. func DeleteV1CustomResourceDefinition(crd *apiextensionsv1.CustomResourceDefinition, apiExtensionsClient clientset.Interface) error { if err := apiExtensionsClient.ApiextensionsV1().CustomResourceDefinitions().Delete(context.TODO(), crd.Name, metav1.DeleteOptions{}); err != nil { return err } for _, version := range servedV1Versions(crd) { - err := wait.PollUntilContextTimeout(context.Background(), 500*time.Millisecond, 30*time.Second, true, func(ctx context.Context) (bool, error) { + err := wait.PollUntilContextTimeout(context.Background(), 500*time.Millisecond, crdDeletionTimeout, true, func(ctx context.Context) (bool, error) { exists, err := existsInDiscoveryV1(crd, apiExtensionsClient, version) return !exists, err }) @@ -539,7 +543,7 @@ func DeleteV1CustomResourceDefinitions(deleteListOpts metav1.ListOptions, apiExt } for _, crd := range list.Items { for _, version := range servedV1Versions(&crd) { - err := wait.PollUntilContextTimeout(context.Background(), 500*time.Millisecond, 30*time.Second, true, func(ctx context.Context) (bool, error) { + err := wait.PollUntilContextTimeout(context.Background(), 500*time.Millisecond, crdDeletionTimeout, true, func(ctx context.Context) (bool, error) { exists, err := existsInDiscoveryV1(&crd, apiExtensionsClient, version) return !exists, err })