Skip to content

Commit eae0aca

Browse files
sluetzeyuumasato
authored andcommitted
Fix crash in rule for HHCP
1 parent 51755c3 commit eae0aca

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

  • applications/openshift
    • high-availability/control_plane_nodes_in_three_zones
    • master/master_taint_noschedule

applications/openshift/high-availability/control_plane_nodes_in_three_zones/rule.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ identifiers:
2626

2727
severity: medium
2828

29+
platform: not ocp4-on-hypershift-hosted
30+
2931
ocil_clause: 'Kubernetes control plane not distributed across three failure zones'
3032

3133
ocil: |-

applications/openshift/master/master_taint_noschedule/rule.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ documentation_complete: true
22

33
title: Verify that Control Plane Nodes are not schedulable for workloads
44

5+
{{% set jqfilter = '[ .items[] | select(.spec.taints[]?.key == "node-role.kubernetes.io/master" and .spec.taints[]?.effect == "NoSchedule") | .metadata.name ]' %}}
6+
57
description: -|
68
<p>
79
User workloads should not be colocated with control plane workloads. To ensure that the scheduler won't
@@ -25,22 +27,22 @@ rationale: -|
2527
In some setups it might be necessary to make the control plane schedulable for workloads i.e.
2628
Single Node Openshift (SNO) or Compact Cluster (Three Node Cluster) setups.
2729

28-
{{% set jqfilter = '.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")' %}}
29-
3030
identifiers:
3131
cce@ocp4: CCE-88731-5
3232

3333
severity: medium
3434

35+
platform: not ocp4-on-hypershift-hosted
36+
3537
ocil_clause: 'Control Plane is schedulable'
3638

3739
ocil: |-
3840
Run the following command to see if control planes are schedulable
39-
<pre>$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" )'</pre>
40-
for each master node, there should be an output of a key with the NoSchedule effect.
41+
<pre>$oc get --raw /api/v1/nodes | jq '[ .items[] | select(.spec.taints[]?.key == "node-role.kubernetes.io/master" and .spec.taints[]?.effect == "NoSchedule") | .metadata.name ]'</pre>
42+
for each non-schedulable master node, there should be the name in the output.
4143
42-
By editing the cluster scheduler you can centrally configure the masters as schedulable or not
43-
by setting .spec.mastersSchedulable to true.
44+
By editing the cluster scheduler you can centrally configure the masters as not schedulable
45+
by setting .spec.mastersSchedulable to false.
4446
Use <pre>$oc edit schedulers.config.openshift.io cluster</pre> to configure the scheduling.
4547
4648
warnings:
@@ -53,9 +55,9 @@ template:
5355
ocp_data: "true"
5456
filepath: |-
5557
{{{ openshift_filtered_path('/api/v1/nodes', jqfilter) }}}
56-
yamlpath: ".effect"
58+
yamlpath: "[:]"
5759
check_existence: "at_least_one_exists"
5860
entity_check: "at least one"
5961
values:
60-
- value: "NoSchedule"
62+
- value: "(.*?)"
6163
operation: "pattern match"

0 commit comments

Comments
 (0)