Fix noschedule rules for HyperShift Hosted Control Plane - #15089
Merged
taimurhafeez merged 1 commit intoSep 4, 2026
Merged
Conversation
Contributor
|
This datastream diff is auto generated by the check Click here to see the full diffPlatform has been changed for rule 'xccdf_org.ssgproject.content_rule_control_plane_nodes_in_three_zones'
--- xccdf_org.ssgproject.content_rule_control_plane_nodes_in_three_zones
+++ xccdf_org.ssgproject.content_rule_control_plane_nodes_in_three_zones
@@ -1 +1 @@
-
+oval:ssg-installed_app_is_ocp4_on_hypershift_hosted:def:1
New content has different text for rule 'xccdf_org.ssgproject.content_rule_master_taint_noschedule'.
--- xccdf_org.ssgproject.content_rule_master_taint_noschedule
+++ xccdf_org.ssgproject.content_rule_master_taint_noschedule
@@ -16,9 +16,9 @@
Therefore, you need to use a tool that can query the OCP API, retrieve the following:
/api/v1/nodes
API endpoint, filter with with the jq utility using the following filter
- .items[] | select(.metadata.labels."node-role.kubernetes.io/master" == "" or .metadata.labels."node-role.kubernetes.io/control-plane" == "" ) | .spec.taints[] | select(.key == "node-role.kubernetes.io/master" and .effect == "NoSchedule")
+ [ .items[] | select(.spec.taints[]?.key == "node-role.kubernetes.io/master" and .spec.taints[]?.effect == "NoSchedule") | .metadata.name ]
and persist it to the local
- /api/v1/nodes#17a90876774be6b77ba144848cd6abef7db26fc4cfb1b71314faa3dcda45911c
+ /api/v1/nodes#5f689f16dda05c8639e331492dbe7a5cafed3a0d415f672b2ca6bb220d322870
file.
[reference]:
OCIL for rule 'xccdf_org.ssgproject.content_rule_master_taint_noschedule' differs.
--- ocil:ssg-master_taint_noschedule_ocil:questionnaire:1
+++ ocil:ssg-master_taint_noschedule_ocil:questionnaire:1
@@ -1,9 +1,9 @@
Run the following command to see if control planes are schedulable
-$oc get --raw /api/v1/nodes | jq '.items[] | select(.metadata.labels."node-role.kubernetes.io/master" == "" or .metadata.labels."node-role.kubernetes.io/control-plane" == "" ) | .spec.taints[] | select(.key == "node-role.kubernetes.io/master" and .effect == "NoSchedule" )'
-for each master node, there should be an output of a key with the NoSchedule effect.
+$oc get --raw /api/v1/nodes | jq '[ .items[] | select(.spec.taints[]?.key == "node-role.kubernetes.io/master" and .spec.taints[]?.effect == "NoSchedule") | .metadata.name ]'
+for each non-schedulable master node, there should be the name in the output.
-By editing the cluster scheduler you can centrally configure the masters as schedulable or not
-by setting .spec.mastersSchedulable to true.
+By editing the cluster scheduler you can centrally configure the masters as not schedulable
+by setting .spec.mastersSchedulable to false.
Use $oc edit schedulers.config.openshift.io cluster to configure the scheduling.
Is it the case that Control Plane is schedulable?
Platform has been changed for rule 'xccdf_org.ssgproject.content_rule_master_taint_noschedule'
--- xccdf_org.ssgproject.content_rule_master_taint_noschedule
+++ xccdf_org.ssgproject.content_rule_master_taint_noschedule
@@ -1 +1 @@
-
+oval:ssg-installed_app_is_ocp4_on_hypershift_hosted:def:1 |
taimurhafeez
reviewed
Sep 3, 2026
taimurhafeez
approved these changes
Sep 3, 2026
Contributor
|
Tested on hypershift cluster 4.22. before fix, pod crash Scan results after fix As #15085 is not landed yet, thus, not showing NOT-APPLICABLE result for these rules. |
yuumasato
force-pushed
the
fix-noschedule-rules-for-hcp
branch
from
September 4, 2026 08:54
2ce4dda to
4cb8469
Compare
yuumasato
force-pushed
the
fix-noschedule-rules-for-hcp
branch
from
September 4, 2026 08:55
4cb8469 to
eae0aca
Compare
taimurhafeez
approved these changes
Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
This re-opens the work from #13699 (closed for inactivity) by cherry-picking
@sluetze's commit. It makes two control-plane rules behave correctly on
HyperShift Hosted Control Plane (HCP) clusters:
master_taint_noschedule: the previousjqfilteriterated.spec.taints[]unconditionally, so on hosted clusters — where worker nodeshave no taints — the api-checks resource filtering errored out
(
couldn't filter '{"kind":"NodeList",...}') and aborted the whole scan. Thefilter is rewritten to use
.spec.taints[]?and collect the names of taintedmaster nodes into a list, which evaluates safely on both HCP and regular
clusters. The rule is also gated with
platform: not ocp4-on-hypershift-hosted.control_plane_nodes_in_three_zones: gated withplatform: not ocp4-on-hypershift-hosted, since a hosted cluster's controlplane runs in the management cluster and this check does not apply.
Rationale:
On HCP clusters these control-plane rules either crashed the scan
(
master_taint_noschedule) or produced meaningless results. This makes themHCP-safe and marks them not-applicable on hosted clusters.
Related:
master_taint_noschedulecrash fix works independently of it, and theplatform: not ocp4-on-hypershift-hostedgates added here are inert no-opsuntil that PR lands. CMP-4521: Fix HyperShift Hosted Cluster detection using controlPlaneTopology #15085 fixes the
ocp4-on-hypershift-hostedCPE, whichwas structurally unreachable and never fired — as @sluetze documented in
fix noschedule rules for hcp #13699, none of the
platform: not ocp4-on-hypershift-hostedrules returnedNOT-APPLICABLE on HCP before that fix. Once CMP-4521: Fix HyperShift Hosted Cluster detection using controlPlaneTopology #15085 merges, the gates here begin
marking these rules NOT-APPLICABLE on hosted clusters. Either PR can merge
first.
CMP-4491 (jq
Cannot iterate over nullfrom strict array traversal, fixed by adding?optional operators),which was addressed for the
audit_error_alert_existsrule by another PR. Themaster_taint_noschedulechange here applies the same optional-traversal fixpattern to node taints.
Original PR: #13699
Original author: @sluetze