Change:
storageversionmigrator TestStorageVersionMigrationWithCRD Added with 03-09. /cc /sig api-machinery
/assign as the feature owner. Thank you. /triage accepted
Can you please confirm what type of flake this is? Is it due to a bug, improper test, etc? I am assuming this won't block upcoming release cuts. Is that correct?
Looking at the logs, the actual failure is here that's from which is failing after the 30s context deadline.
(03-24)failed after was merged(03-19) (03-20)
/reopen
Reopened this issue. <detailsIn response to : /reopen </details
do you have any update or plan on this? The flake rate is about once a day on
addressed the first flake with context deadline. to address the new flakes:
Thanks for the update. No flake until now.
Just ran into a presubmit failure that looks similar, is this the same issue?
PTAL!
/reopen
Reopened this issue. <detailsIn response to : /reopen Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
/reopen Looks like it's still flaking -
Reopened this issue. <detailsIn response to : /reopen Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
The test is continue flaking today. Recent failures: Triage Error is quite similar to the one above Seems like this test is still failed with the same issue until now. cc cc
/reopen cc This failed again
Reopened this issue. <detailsIn response to : /reopen Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details

Discussion:
shutdownServer := svmTest.createConversionWebhook(ctx, t, certCtx) // add v2 for serving only <del> svmTest.updateCRD(ctx, t, crd.Name, v2CRDVersion) </del> <ins> svmTest.updateCRD(ctx, t, crd.Name, v2CRDVersion, []string{"v1", "v2"}, "v1") </ins> // create another CR cr2 := svmTest.createCR(ctx, t, "cr2", "v2")

} // add v2 as storage version <del> svmTest.updateCRD(ctx, t, crd.Name, v2StorageCRDVersion) </del> <ins> svmTest.updateCRD(ctx, t, crd.Name, v2StorageCRDVersion, []string{"v1", "v2"}, "v2") </ins> // create CR with v1 cr3 := svmTest.createCR(ctx, t, "cr3", "v1")

} // update CRD to v1 not serving and storage followed by webhook shutdown <del> svmTest.updateCRD(ctx, t, crd.Name, v1NotServingCRDVersion) </del> <ins> svmTest.updateCRD(ctx, t, crd.Name, v1NotServingCRDVersion, []string{"v2"}, "v2") </ins> shutdownServer() // assert RV and Generations of CRs

"net/http" "os" "path/filepath" <ins> "reflect" </ins> "regexp" <ins> "sort" </ins> "strconv" "strings" "testing"

"k8s.io/apimachinery/pkg/util/wait" auditinternal "k8s.io/apiserver/pkg/apis/audit" auditv1 "k8s.io/apiserver/pkg/apis/audit/v1" <ins> endpointsdiscovery "k8s.io/apiserver/pkg/endpoints/discovery" </ins> "k8s.io/apiserver/pkg/storage/storagebackend" "k8s.io/client-go/discovery" cacheddiscovery "k8s.io/client-go/discovery/cached/memory"

client                      clientset.Interface clientConfig                *rest.Config dynamicClient               *dynamic.DynamicClient <ins> discoveryClient             *discovery.DiscoveryClient </ins> storageConfig               *storagebackend.Config server                      *kubeapiservertesting.TestServer apiextensionsclient         *apiextensionsclientset.Clientset

client:                      clientSet, clientConfig:                server.ClientConfig, dynamicClient:               dynamicClient, <ins> discoveryClient:             rvDiscoveryClient, </ins> policyFile:                  policyFile, logFile:                     logFile, filePathForEncryptionConfig: filePathForEncryptionConfig,

} } <del> // func (svm *svmTest) createSVMResource(ctx context.Context, t *testing.T, name string) ( // 	*svmv1alpha1.StorageVersionMigration, // 	error, // ) { // 	t.Helper() // 	svmResource := &svmv1alpha1.StorageVersionMigration{ // 		ObjectMeta: metav1.ObjectMeta{ // 			Name: name, // 		}, // 		Spec: svmv1alpha1.StorageVersionMigrationSpec{ // 			Resource: svmv1alpha1.GroupVersionResource{ // 				Group:    "", // 				Version:  "v1", // 				Resource: "secrets", // 			}, // 		}, // 	} // // 	return svm.client.StoragemigrationV1alpha1(). // 		StorageVersionMigrations(). // 		Create(ctx, svmResource, metav1.CreateOptions{}) // } </del> func (svm *svmTest) createSVMResource(ctx context.Context, t *testing.T, name string, gvr svmv1alpha1.GroupVersionResource) ( *svmv1alpha1.StorageVersionMigration, error,

t *testing.T, crdName string, updatesCRDVersions []apiextensionsv1.CustomResourceDefinitionVersion, <del> ) *apiextensionsv1.CustomResourceDefinition { </del> <ins> expectedServingVersions []string, expectedStorageVersion string, ) { </ins> t.Helper() var err error <del> _, err = crdintegration.UpdateV1CustomResourceDefinitionWithRetry(svm.apiextensionsclient, crdName, func(c *apiextensionsv1.CustomResourceDefinition) { </del> <ins> crd, err := crdintegration.UpdateV1CustomResourceDefinitionWithRetry(svm.apiextensionsclient, crdName, func(c *apiextensionsv1.CustomResourceDefinition) { </ins> c.Spec.Versions = updatesCRDVersions }) if err != nil { t.Fatalf("Failed to update CRD: %v", err) } <del> crd, err := svm.apiextensionsclient.ApiextensionsV1().CustomResourceDefinitions().Get(ctx, crdName, metav1.GetOptions{}) if err != nil { t.Fatalf("Failed to get CRD: %v", err) } </del> <ins> svm.waitForCRDUpdate(ctx, t, crd.Spec.Names.Kind, expectedServingVersions, expectedStorageVersion) } </ins> <del> // TODO: wrap all actions after updateCRD with wait loops so we do not need this sleep //  it is currently necessary because we update the CRD but do not otherwise guarantee that the updated config is active time.Sleep(10 * time.Second) </del> <ins> func (svm *svmTest) waitForCRDUpdate( ctx context.Context, t *testing.T, crdKind string, expectedServingVersions []string, expectedStorageVersion string, ) { t.Helper() </ins> <del> return crd </del> <ins> err := wait.PollUntilContextTimeout( ctx, 500*time.Millisecond, wait.ForeverTestTimeout, true, func(ctx context.Context) (bool, error) { apiGroups, _, err := svm.discoveryClient.ServerGroupsAndResources() if err != nil { return false, fmt.Errorf("failed to get server groups and resources: %w", err) } for _, api := range apiGroups { if api.Name == crdGroup { var servingVersions []string for _, apiVersion := range api.Versions { servingVersions = append(servingVersions, apiVersion.Version) } sort.Strings(servingVersions) // Check if the serving versions are as expected if reflect.DeepEqual(expectedServingVersions, servingVersions) { expectedHash := endpointsdiscovery.StorageVersionHash(crdGroup, expectedStorageVersion, crdKind) resourceList, err := svm.discoveryClient.ServerResourcesForGroupVersion(crdGroup + "/" + api.PreferredVersion.Version) if err != nil { return false, fmt.Errorf("failed to get server resources for group version: %w", err) } // Check if the storage version is as expected for _, resource := range resourceList.APIResources { if resource.Kind == crdKind { if resource.StorageVersionHash == expectedHash { return true, nil } } } } } } return false, nil }, ) if err != nil { t.Fatalf("Failed to update a CRD: Name: %s, Err: %v", crdName, err) } </ins> } func (svm *svmTest) createCR(ctx context.Context, t *testing.T, crName, version string) *unstructured.Unstructured {