Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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": {},
Expand Down
1 change: 1 addition & 0 deletions cmd/cluster-version-operator-tests/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
29 changes: 5 additions & 24 deletions pkg/agenticrun/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
1 change: 0 additions & 1 deletion pkg/readiness/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions pkg/readiness/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand Down
90 changes: 3 additions & 87 deletions pkg/readiness/checks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions pkg/readiness/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
72 changes: 0 additions & 72 deletions pkg/readiness/network.go

This file was deleted.

15 changes: 1 addition & 14 deletions test/cvo/readiness.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
})
Expand Down Expand Up @@ -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{})
Expand Down