From 568a8a268d6f87d21582dda92ad5b1c2789da008 Mon Sep 17 00:00:00 2001 From: RishabhSaini Date: Wed, 2 Apr 2025 10:50:04 -0400 Subject: [PATCH 1/2] Add PIS CR to the Exception list for Status Test --- test/extended/operators/check_crd_status.go | 1 + 1 file changed, 1 insertion(+) diff --git a/test/extended/operators/check_crd_status.go b/test/extended/operators/check_crd_status.go index 4fcb8612dc6f..f6206e191cb2 100644 --- a/test/extended/operators/check_crd_status.go +++ b/test/extended/operators/check_crd_status.go @@ -98,6 +98,7 @@ func checkStatusInSchema(crdItemList []apiextensionsv1.CustomResourceDefinition) "imagecontentpolicies.config.openshift.io", "imagecontentsourcepolicies.operator.openshift.io", "machineconfigs.machineconfiguration.openshift.io", + "pinnedimagesets.machineconfiguration.openshift.io", "netnamespaces.network.openshift.io", "rangeallocations.security.internal.openshift.io", "rolebindingrestrictions.authorization.openshift.io", From f4a2ff8ee933277cca919c057c6ea1bd9ed2e422 Mon Sep 17 00:00:00 2001 From: RishabhSaini Date: Wed, 2 Apr 2025 14:48:40 -0400 Subject: [PATCH 2/2] check_crd_status: Remove Test schema-status-check --- test/extended/operators/check_crd_status.go | 94 ------------------- .../operators/check_crd_status_test.go | 17 ---- .../generated/zz_generated.annotations.go | 2 - 3 files changed, 113 deletions(-) diff --git a/test/extended/operators/check_crd_status.go b/test/extended/operators/check_crd_status.go index f6206e191cb2..f7ee9007d206 100644 --- a/test/extended/operators/check_crd_status.go +++ b/test/extended/operators/check_crd_status.go @@ -73,73 +73,6 @@ func checkSubresourceStatus(crdItemList []apiextensionsv1.CustomResourceDefiniti return failures } -// checkStatusInSchema returns a list of names of CRDs that don't have a "status" in the CRD schema. -// For now, it ignores the ones that are currently failing. -func checkStatusInSchema(crdItemList []apiextensionsv1.CustomResourceDefinition) []string { - - // These CRDs, at the time this test was written, do not have a "status" in the CRD schema - // and subresource.status. - // These can be skipped for now but we don't want the number to increase. - // These CRDs should be tidied up over time. - // - exceptionsList := sets.NewString( - "builds.config.openshift.io", - "clusternetworks.network.openshift.io", - "consoleclidownloads.console.openshift.io", - "consoleexternalloglinks.console.openshift.io", - "consolelinks.console.openshift.io", - "consolenotifications.console.openshift.io", - "consoleplugins.console.openshift.io", - "consolequickstarts.console.openshift.io", - "consolesamples.console.openshift.io", - "consoleyamlsamples.console.openshift.io", - "egressnetworkpolicies.network.openshift.io", - "hostsubnets.network.openshift.io", - "imagecontentpolicies.config.openshift.io", - "imagecontentsourcepolicies.operator.openshift.io", - "machineconfigs.machineconfiguration.openshift.io", - "pinnedimagesets.machineconfiguration.openshift.io", - "netnamespaces.network.openshift.io", - "rangeallocations.security.internal.openshift.io", - "rolebindingrestrictions.authorization.openshift.io", - "securitycontextconstraints.security.openshift.io", - "managedfleetnotifications.ocmagent.managed.openshift.io", // OSD-26067 - ) - - failures := []string{} - for _, crdItem := range crdItemList { - - // This test is interested only in CRDs that end with "openshift.io". - if !strings.HasSuffix(crdItem.ObjectMeta.Name, "openshift.io") { - continue - } - - crdName := crdItem.ObjectMeta.Name - - // Skip CRDs in the exceptions list for now. - if exceptionsList.Has(crdName) { - continue - } - - // Iterate through all versions of the CustomResourceDefinition Spec looking for one with - // a schema status element, - foundStatusInSchema := false - var i int - for i = 0; i < len(crdItem.Spec.Versions); i++ { - if _, ok := crdItem.Spec.Versions[i].Schema.OpenAPIV3Schema.Properties["status"]; ok { - foundStatusInSchema = true - break - } - } - - if !foundStatusInSchema { - failures = append(failures, fmt.Sprintf("CRD %s has no 'status' element in its schema", crdName)) - } - } - - return failures -} - var _ = g.Describe("[sig-arch][Early]", func() { defer g.GinkgoRecover() @@ -167,33 +100,6 @@ var _ = g.Describe("[sig-arch][Early]", func() { }) }) -var _ = g.Describe("[sig-arch][Early]", func() { - - defer g.GinkgoRecover() - - var ( - crdItemList []apiextensionsv1.CustomResourceDefinition - ) - - oc := exutil.NewCLI("schema-status-check") - - g.BeforeEach(func() { - var err error - crdClient := apiextensionsclientset.NewForConfigOrDie(oc.AdminConfig()) - crdItemList, err = getCRDItemList(*crdClient) - o.Expect(err).NotTo(o.HaveOccurred()) - }) - - g.Describe("CRDs for openshift.io", func() { - g.It("should have a status in the CRD schema", func() { - failures := checkStatusInSchema(crdItemList) - if len(failures) > 0 { - e2e.Fail(strings.Join(failures, "\n")) - } - }) - }) -}) - func getCRDItemList(crdClient apiextensionsclientset.Clientset) ([]apiextensionsv1.CustomResourceDefinition, error) { crdList, err := crdClient.ApiextensionsV1().CustomResourceDefinitions().List(context.Background(), metav1.ListOptions{}) diff --git a/test/extended/operators/check_crd_status_test.go b/test/extended/operators/check_crd_status_test.go index de8b4ef720e0..97f282138b85 100644 --- a/test/extended/operators/check_crd_status_test.go +++ b/test/extended/operators/check_crd_status_test.go @@ -27,23 +27,6 @@ func Test_checkSubresourceStatus(t *testing.T) { }) } -func Test_checkStatusInSchema(t *testing.T) { - - crdClient := setupLocalAPIClientset() - t.Run("Test_checkStatusInSchema test", func(t *testing.T) { - crdList, err := getCRDItemList(*crdClient) - if err != nil { - t.Errorf("Fail: %s", err) - } - failures := checkStatusInSchema(crdList) - if len(failures) > 0 { - t.Error("There should be no failures") - for _, i := range failures { - fmt.Println(i) - } - } - }) -} func setupLocalAPIClientset() *apiextensionsclientset.Clientset { // Get the kubeconfig by creating an Openshift cluster with cluster-bot, downloading it, // and using the filename for KUBECONFIG. diff --git a/test/extended/util/annotate/generated/zz_generated.annotations.go b/test/extended/util/annotate/generated/zz_generated.annotations.go index a3596dfe2aa2..3f96d7b8c355 100644 --- a/test/extended/util/annotate/generated/zz_generated.annotations.go +++ b/test/extended/util/annotate/generated/zz_generated.annotations.go @@ -245,8 +245,6 @@ var Annotations = map[string]string{ "[sig-arch][Early] APIs for openshift.io must have stable versions": " [Suite:openshift/conformance/parallel]", - "[sig-arch][Early] CRDs for openshift.io should have a status in the CRD schema": " [Suite:openshift/conformance/parallel]", - "[sig-arch][Early] CRDs for openshift.io should have subresource.status": " [Suite:openshift/conformance/parallel]", "[sig-arch][Early] Managed cluster should [apigroup:config.openshift.io] start all core operators": " [Skipped:Disconnected] [Suite:openshift/conformance/parallel]",