From 2b05f1373908521b7ecd16a64b21c1d8f6ea0c7f Mon Sep 17 00:00:00 2001 From: Watson Yuuma Sato Date: Mon, 6 Jul 2026 14:58:27 +0200 Subject: [PATCH] Fix HyperShift Hosted Cluster detection using controlPlaneTopology The previous OVAL check for detecting HyperShift Hosted Clusters was unreliable because it looked for a hardcoded pod name that didn't match the actual pod naming pattern used by the Compliance Operator. Old approach: - Checked for file: /kubernetes-api-resources/.../pods/api-checks-pod - Looked for --platform=HyperShift flag in pod command - Failed because actual pod name is -api-checks-pod New approach: - Checks infrastructure.config.openshift.io/cluster object - Looks for .status.controlPlaneTopology == "External" - More reliable and independent of pod naming This fix ensures that rules with "platform: not ocp4-on-hypershift-hosted" are properly skipped on HyperShift Hosted Clusters, where control plane components run externally in the management cluster. Impact: - API server, etcd, and other control plane checks will now correctly skip on HyperShift Hosted Clusters - Fixes false failures like master_taint_noschedule on hosted clusters Co-Authored-By: Claude Sonnet 4.5 --- .../applicability/oval/installed_app_is_ocp4.xml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/shared/applicability/oval/installed_app_is_ocp4.xml b/shared/applicability/oval/installed_app_is_ocp4.xml index 19a6245b8427..e40e86906d39 100644 --- a/shared/applicability/oval/installed_app_is_ocp4.xml +++ b/shared/applicability/oval/installed_app_is_ocp4.xml @@ -29,10 +29,6 @@ /kubernetes-api-resources/hypershift/version - - /kubernetes-api-resources/api/v1/namespaces/openshift-compliance/pods/api-checks-pod - - @@ -91,13 +87,13 @@ - - .spec.containers[:].command[:] + + .status.controlPlaneTopology - - ^--platform=HyperShift$ + + ^External$ @@ -270,7 +266,8 @@ The application installed on the system is OpenShift 4 on HyperShift Hosted Cluster. - + +