diff --git a/.openshift-tests-extension/openshift_payload_cluster-version-operator.json b/.openshift-tests-extension/openshift_payload_cluster-version-operator.json index a4359b1fee..3102e0543c 100644 --- a/.openshift-tests-extension/openshift_payload_cluster-version-operator.json +++ b/.openshift-tests-extension/openshift_payload_cluster-version-operator.json @@ -151,16 +151,6 @@ "lifecycle": "blocking", "environmentSelector": {} }, - { - "name": "[Jira:\"Cluster Version Operator\"] cluster-version-operator readiness checks should report network type matching actual Network config", - "labels": {}, - "resources": { - "isolation": {} - }, - "source": "openshift:payload:cluster-version-operator", - "lifecycle": "blocking", - "environmentSelector": {} - }, { "name": "[Jira:\"Cluster Version Operator\"] cluster-version-operator readiness checks should report PDB count matching actual PodDisruptionBudgets", "labels": {}, diff --git a/cmd/cluster-version-operator-tests/main.go b/cmd/cluster-version-operator-tests/main.go index d4afdf3b6d..b7575f483a 100644 --- a/cmd/cluster-version-operator-tests/main.go +++ b/cmd/cluster-version-operator-tests/main.go @@ -39,6 +39,7 @@ func main() { }) ext.IgnoreObsoleteTests( `[Jira:"Cluster Version Operator"] cluster-version-operator should install light speed CRDs correctly`, + `[Jira:"Cluster Version Operator"] cluster-version-operator readiness checks should report network type matching actual Network config`, ) specs, err := g.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite() diff --git a/pkg/agenticrun/controller_test.go b/pkg/agenticrun/controller_test.go index 6b7669b300..ede58d07aa 100644 --- a/pkg/agenticrun/controller_test.go +++ b/pkg/agenticrun/controller_test.go @@ -1145,9 +1145,6 @@ func newFakeDynamicClient(objects ...runtime.Object) *dynamicfake.FakeDynamicCli readiness.GVRInstallPlan: "InstallPlanList", readiness.GVRPackageManifest: "PackageManifestList", readiness.GVRAPIRequestCount: "APIRequestCountList", - readiness.GVRNetwork: "NetworkList", - readiness.GVRProxy: "ProxyList", - readiness.GVRAPIServer: "APIServerList", } for gvr, listKind := range gvrs { gvk := schema.GroupVersionKind{Group: gvr.Group, Version: gvr.Version, Kind: listKind} @@ -1253,22 +1250,6 @@ func TestGetAgenticRuns_WithReadinessData(t *testing.T) { "conditions": []interface{}{map[string]interface{}{"type": "Deprecated", "status": "True"}}, }, }}, - // Network, Proxy, APIServer - &unstructured.Unstructured{Object: map[string]interface{}{ - "apiVersion": "config.openshift.io/v1", "kind": "Network", - "metadata": map[string]interface{}{"name": "cluster"}, - "status": map[string]interface{}{"networkType": "OVNKubernetes"}, - }}, - &unstructured.Unstructured{Object: map[string]interface{}{ - "apiVersion": "config.openshift.io/v1", "kind": "Proxy", - "metadata": map[string]interface{}{"name": "cluster"}, - "spec": map[string]interface{}{}, - }}, - &unstructured.Unstructured{Object: map[string]interface{}{ - "apiVersion": "config.openshift.io/v1", "kind": "APIServer", - "metadata": map[string]interface{}{"name": "cluster"}, - "spec": map[string]interface{}{}, - }}, // OLM Subscription + CSV &unstructured.Unstructured{Object: map[string]interface{}{ "apiVersion": "operators.coreos.com/v1alpha1", "kind": "Subscription", @@ -1337,11 +1318,11 @@ func TestGetAgenticRuns_WithReadinessData(t *testing.T) { if !ok { t.Fatal("readiness output missing 'meta'") } - if meta["total_checks"] != float64(8) { - t.Errorf("readiness total_checks = %v, want 8", meta["total_checks"]) + if meta["total_checks"] != float64(7) { + t.Errorf("readiness total_checks = %v, want 7", meta["total_checks"]) } - if meta["checks_ok"] != float64(8) { - t.Errorf("readiness checks_ok = %v, want 8 (all checks should succeed)", meta["checks_ok"]) + if meta["checks_ok"] != float64(7) { + t.Errorf("readiness checks_ok = %v, want 7 (all checks should succeed)", meta["checks_ok"]) } checks, ok := raw["checks"].(map[string]any) @@ -1352,7 +1333,7 @@ func TestGetAgenticRuns_WithReadinessData(t *testing.T) { // Verify every check produced results with ok status for _, name := range []string{ "cluster_conditions", "operator_health", "api_deprecations", - "node_capacity", "pdb_drain", "etcd_health", "network", + "node_capacity", "pdb_drain", "etcd_health", "olm_operator_lifecycle", } { check, ok := checks[name].(map[string]any) diff --git a/pkg/readiness/check.go b/pkg/readiness/check.go index 6ba51f0b72..4bb8fb96df 100644 --- a/pkg/readiness/check.go +++ b/pkg/readiness/check.go @@ -72,7 +72,6 @@ var AllChecks = func() []Check { &NodeCapacityCheck{}, // new: node readiness and headroom &PDBDrainCheck{}, // new: PDB drain blockers &EtcdHealthCheck{}, // new: deep etcd health (beyond CO condition) - &NetworkCheck{}, // new: SDN migration, TLS, proxy &OLMOperatorLifecycleCheck{}, // new: OLM operator lifecycle (OCPSTRAT-2618) // Known issues (Jira/KB) are NOT checked here — the agent uses its // redhat-support skill to query contextually based on readiness findings. diff --git a/pkg/readiness/check_test.go b/pkg/readiness/check_test.go index 6f53acd7ef..2f1d664d34 100644 --- a/pkg/readiness/check_test.go +++ b/pkg/readiness/check_test.go @@ -242,8 +242,8 @@ func TestRunAllRecoversPanic(t *testing.T) { func TestAllChecksReturnsExpectedCount(t *testing.T) { checks := AllChecks() - if len(checks) != 8 { - t.Errorf("AllChecks() returned %d checks, want 8", len(checks)) + if len(checks) != 7 { + t.Errorf("AllChecks() returned %d checks, want 7", len(checks)) } names := make(map[string]bool) @@ -253,7 +253,7 @@ func TestAllChecksReturnsExpectedCount(t *testing.T) { expected := []string{ "cluster_conditions", "operator_health", "api_deprecations", - "node_capacity", "pdb_drain", "etcd_health", "network", + "node_capacity", "pdb_drain", "etcd_health", "olm_operator_lifecycle", } for _, name := range expected { diff --git a/pkg/readiness/checks_test.go b/pkg/readiness/checks_test.go index be795e030d..7403f9e83a 100644 --- a/pkg/readiness/checks_test.go +++ b/pkg/readiness/checks_test.go @@ -25,9 +25,6 @@ func newFakeDynamicClient(objects ...runtime.Object) *dynamicfake.FakeDynamicCli GVRInstallPlan: "InstallPlanList", GVRPackageManifest: "PackageManifestList", GVRAPIRequestCount: "APIRequestCountList", - GVRNetwork: "NetworkList", - GVRProxy: "ProxyList", - GVRAPIServer: "APIServerList", } for gvr, listKind := range gvrs { gvk := schema.GroupVersionKind{Group: gvr.Group, Version: gvr.Version, Kind: listKind} @@ -620,60 +617,6 @@ func TestAPIDeprecationsCheck_NoBlockers(t *testing.T) { } } -func TestNetworkCheck(t *testing.T) { - objects := []runtime.Object{ - &unstructured.Unstructured{Object: map[string]interface{}{ - "apiVersion": "config.openshift.io/v1", "kind": "Network", - "metadata": map[string]interface{}{"name": "cluster"}, - "status": map[string]interface{}{ - "networkType": "OpenShiftSDN", - }, - }}, - &unstructured.Unstructured{Object: map[string]interface{}{ - "apiVersion": "config.openshift.io/v1", "kind": "Proxy", - "metadata": map[string]interface{}{"name": "cluster"}, - "spec": map[string]interface{}{ - "httpProxy": "http://proxy.example.com:8080", - }, - }}, - &unstructured.Unstructured{Object: map[string]interface{}{ - "apiVersion": "config.openshift.io/v1", "kind": "APIServer", - "metadata": map[string]interface{}{"name": "cluster"}, - "spec": map[string]interface{}{ - "tlsSecurityProfile": map[string]interface{}{ - "type": "Old", - }, - }, - }}, - } - - client := newFakeDynamicClient(objects...) - check := &NetworkCheck{} - - result, err := check.Run(context.Background(), client, "4.21.5", "4.21.8") - if err != nil { - t.Fatal(err) - } - - if result["network_type"] != "OpenShiftSDN" { - t.Errorf("network_type = %v, want OpenShiftSDN", result["network_type"]) - } - if result["sdn_warning"] == nil { - t.Error("should have sdn_warning for OpenShiftSDN") - } - if result["tls_profile"] != "Old" { - t.Errorf("tls_profile = %v, want Old", result["tls_profile"]) - } - - summary, ok := result["summary"].(map[string]any) - if !ok { - t.Fatal("summary not a map") - } - if summary["is_sdn"] != true { - t.Errorf("is_sdn = %v, want true", summary["is_sdn"]) - } -} - // fakeClusterObjects returns a representative set of cluster objects that exercises // every readiness check with non-trivial data. func fakeClusterObjects() []runtime.Object { @@ -814,23 +757,6 @@ func fakeClusterObjects() []runtime.Object { }, }}, - // --- Network, Proxy, APIServer (network) --- - &unstructured.Unstructured{Object: map[string]interface{}{ - "apiVersion": "config.openshift.io/v1", "kind": "Network", - "metadata": map[string]interface{}{"name": "cluster"}, - "status": map[string]interface{}{"networkType": "OVNKubernetes"}, - }}, - &unstructured.Unstructured{Object: map[string]interface{}{ - "apiVersion": "config.openshift.io/v1", "kind": "Proxy", - "metadata": map[string]interface{}{"name": "cluster"}, - "spec": map[string]interface{}{"httpProxy": "http://proxy.corp:8080"}, - }}, - &unstructured.Unstructured{Object: map[string]interface{}{ - "apiVersion": "config.openshift.io/v1", "kind": "APIServer", - "metadata": map[string]interface{}{"name": "cluster"}, - "spec": map[string]interface{}{}, - }}, - // --- OLM: Subscription + CSV (olm_operator_lifecycle) --- &unstructured.Unstructured{Object: map[string]interface{}{ "apiVersion": "operators.coreos.com/v1alpha1", "kind": "Subscription", @@ -868,13 +794,13 @@ func TestRunAllWithFakeCluster(t *testing.T) { if output.TargetVersion != "4.21.8" { t.Errorf("TargetVersion = %q, want 4.21.8", output.TargetVersion) } - if output.Meta.TotalChecks != 8 { - t.Errorf("TotalChecks = %d, want 8", output.Meta.TotalChecks) + if output.Meta.TotalChecks != 7 { + t.Errorf("TotalChecks = %d, want 7", output.Meta.TotalChecks) } for _, name := range []string{ "cluster_conditions", "operator_health", "api_deprecations", - "node_capacity", "pdb_drain", "etcd_health", "network", + "node_capacity", "pdb_drain", "etcd_health", "olm_operator_lifecycle", } { r, ok := output.Checks[name] @@ -945,16 +871,6 @@ func TestRunAllWithFakeCluster(t *testing.T) { t.Errorf("api_deprecations blockers = %v, want 1", adSummary["blockers"]) } - // network: OVN, proxy configured - nw := output.Checks["network"] - if nw.Data["network_type"] != "OVNKubernetes" { - t.Errorf("network type = %v, want OVNKubernetes", nw.Data["network_type"]) - } - proxy := nw.Data["proxy"].(map[string]any) - if proxy["http_proxy"] != "http://proxy.corp:8080" { - t.Errorf("network proxy = %v, want http://proxy.corp:8080", proxy["http_proxy"]) - } - // olm_operator_lifecycle: 1 subscription olm := output.Checks["olm_operator_lifecycle"] olmSummary := olm.Data["summary"].(map[string]any) diff --git a/pkg/readiness/client.go b/pkg/readiness/client.go index 01d9450f6e..059034dec4 100644 --- a/pkg/readiness/client.go +++ b/pkg/readiness/client.go @@ -28,9 +28,6 @@ var ( GVRPackageManifest = schema.GroupVersionResource{Group: "packages.operators.coreos.com", Version: "v1", Resource: "packagemanifests"} GVRAPIRequestCount = schema.GroupVersionResource{Group: "apiserver.openshift.io", Version: "v1", Resource: "apirequestcounts"} GVRInfrastructure = schema.GroupVersionResource{Group: "config.openshift.io", Version: "v1", Resource: "infrastructures"} - GVRNetwork = schema.GroupVersionResource{Group: "config.openshift.io", Version: "v1", Resource: "networks"} - GVRAPIServer = schema.GroupVersionResource{Group: "config.openshift.io", Version: "v1", Resource: "apiservers"} - GVRProxy = schema.GroupVersionResource{Group: "config.openshift.io", Version: "v1", Resource: "proxies"} GVRNodeMetrics = schema.GroupVersionResource{Group: "metrics.k8s.io", Version: "v1beta1", Resource: "nodes"} GVRValidatingWebhook = schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1", Resource: "validatingwebhookconfigurations"} GVRMutatingWebhook = schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1", Resource: "mutatingwebhookconfigurations"} diff --git a/pkg/readiness/network.go b/pkg/readiness/network.go deleted file mode 100644 index 0342b06f03..0000000000 --- a/pkg/readiness/network.go +++ /dev/null @@ -1,72 +0,0 @@ -package readiness - -import ( - "context" - "fmt" - - "k8s.io/client-go/dynamic" -) - -// NetworkCheck verifies network plugin type, TLS profile, and proxy configuration. -type NetworkCheck struct{} - -func (c *NetworkCheck) Name() string { return "network" } - -func (c *NetworkCheck) Run(ctx context.Context, dc dynamic.Interface, current, target string) (map[string]any, error) { - result := map[string]any{} - var sectionErrors []map[string]any - - // Check Network configuration - network, err := GetResource(ctx, dc, GVRNetwork, "cluster") - if err != nil { - return nil, fmt.Errorf("failed to get Network config: %w", err) - } - - networkType := NestedString(network.Object, "status", "networkType") - result["network_type"] = networkType - - // SDN deprecation warning - if networkType == "OpenShiftSDN" { - cmp, err := CompareVersions(target, "4.17.0") - if target != "" && err == nil && cmp >= 0 { - result["sdn_warning"] = "OpenShiftSDN blocks upgrades to 4.17+; migrate to OVN-Kubernetes first." - } else { - result["sdn_warning"] = "OpenShiftSDN detected. Migration to OVN-Kubernetes is required for future upgrades to 4.17+." - } - } - - // Check proxy - proxy, err := GetResource(ctx, dc, GVRProxy, "cluster") - if err != nil { - SectionError(§ionErrors, "proxy", err) - } else { - result["proxy"] = map[string]any{ - "http_proxy": NestedString(proxy.Object, "spec", "httpProxy"), - "https_proxy": NestedString(proxy.Object, "spec", "httpsProxy"), - "no_proxy": NestedString(proxy.Object, "spec", "noProxy"), - } - } - - // Check TLS profile from APIServer - apiServer, err := GetResource(ctx, dc, GVRAPIServer, "cluster") - if err != nil { - SectionError(§ionErrors, "apiserver_tls", err) - } else { - tlsProfile := NestedString(apiServer.Object, "spec", "tlsSecurityProfile", "type") - if tlsProfile == "" { - tlsProfile = "Intermediate" - } - result["tls_profile"] = tlsProfile - } - - result["summary"] = map[string]any{ - "network_type": networkType, - "is_sdn": networkType == "OpenShiftSDN", - } - - if len(sectionErrors) > 0 { - result["errors"] = sectionErrors - } - - return result, nil -} diff --git a/test/cvo/readiness.go b/test/cvo/readiness.go index 8bcac9e146..455305a79a 100644 --- a/test/cvo/readiness.go +++ b/test/cvo/readiness.go @@ -67,7 +67,7 @@ var _ = g.Describe(`[Jira:"Cluster Version Operator"] cluster-version-operator r g.It("should run all checks without errors", func() { output := readiness.RunAll(ctx, dynamicClient, currentVersion, targetVersion) - o.Expect(output.Meta.TotalChecks).To(o.Equal(8)) + o.Expect(output.Meta.TotalChecks).To(o.Equal(7)) o.Expect(output.Meta.ChecksErrored).To(o.Equal(0), "no check should error on a healthy cluster") }) @@ -174,19 +174,6 @@ var _ = g.Describe(`[Jira:"Cluster Version Operator"] cluster-version-operator r "healthy member count should match actual ready etcd pods") }) - g.It("should report network type matching actual Network config", func() { - // Ground truth: get Network config via typed client - network, err := configClient.Networks().Get(ctx, "cluster", metav1.GetOptions{}) - o.Expect(err).NotTo(o.HaveOccurred()) - - // Our check - output := readiness.RunAll(ctx, dynamicClient, currentVersion, targetVersion) - result := output.Checks["network"] - o.Expect(result.Status).To(o.Equal("ok")) - o.Expect(result.Data["network_type"]).To(o.Equal(network.Status.NetworkType), - "network type should match actual Network config") - }) - g.It("should report PDB count matching actual PodDisruptionBudgets", func() { // Ground truth: list PDBs across all namespaces pdbList, err := kubeClient.PolicyV1().PodDisruptionBudgets("").List(ctx, metav1.ListOptions{})