Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCPBUGS-1316: Add missing variable reference to rules #12012

Merged
merged 2 commits into from
Jun 11, 2024

Conversation

Vincent056
Copy link
Contributor

Some of the kubeletconfig rules does not have not contains reference to variable being used in its remediation, this PR adds that reference to those rules. Related BUG: https://issues.redhat.com/browse/OCPBUGS-1316

Copy link

Start a new ephemeral environment with changes proposed in this pull request:

ocp4 (from CTF) Environment (using Fedora as testing environment)
Open in Gitpod

Fedora Testing Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

Copy link

github-actions bot commented May 21, 2024

This datastream diff is auto generated by the check Compare DS/Generate Diff

Click here to see the full diff
New content has different text for rule 'xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_hard_imagefs_available'.
--- xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_hard_imagefs_available
+++ xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_hard_imagefs_available
@@ -30,6 +30,7 @@
               
 This rule pertains to the imagefs.available setting of the evictionHard
 section.
+Remediation will set field imagefs.available to {{ .var_kubelet_evictionhard_imagefs_available }} based on the variable var_kubelet_evictionhard_imagefs_available.
 
 [reference]:
 CIP-003-8 R6

New content has different text for rule 'xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_hard_imagefs_inodesfree'.
--- xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_hard_imagefs_inodesfree
+++ xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_hard_imagefs_inodesfree
@@ -30,6 +30,7 @@
               
 This rule pertains to the imagefs.inodesFree setting of the evictionHard
 section.
+Remediation will set field imagefs.inodesFree to {{ .var_kubelet_evictionhard_imagefs_inodesfree }} based on the variable var_kubelet_evictionhard_imagefs_inodesfree.
 
 [reference]:
 CIP-003-8 R6

New content has different text for rule 'xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_hard_memory_available'.
--- xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_hard_memory_available
+++ xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_hard_memory_available
@@ -30,6 +30,7 @@
               
 This rule pertains to the memory.available setting of the evictionHard
 section.
+Remediation will set field memory.available to {{ .var_kubelet_evictionhard_memory_available }} based on the variable var_kubelet_evictionhard_memory_available.
 
 [reference]:
 CIP-003-8 R6

New content has different text for rule 'xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_hard_nodefs_available'.
--- xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_hard_nodefs_available
+++ xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_hard_nodefs_available
@@ -30,6 +30,7 @@
               
 This rule pertains to the nodefs.available setting of the evictionHard
 section.
+Remediation will set field nodefs.available to {{ .var_kubelet_evictionhard_nodefs_available }} based on the variable var_kubelet_evictionhard_nodefs_available.
 
 [reference]:
 CIP-003-8 R6

New content has different text for rule 'xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_hard_nodefs_inodesfree'.
--- xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_hard_nodefs_inodesfree
+++ xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_hard_nodefs_inodesfree
@@ -30,6 +30,7 @@
               
 This rule pertains to the nodefs.inodesFree setting of the evictionHard
 section.
+Remediation will set field nodefs.inodesFree to {{ .var_kubelet_evictionhard_nodefs_inodesfree }} based on the variable var_kubelet_evictionhard_nodefs_inodesfree.
 
 [reference]:
 CIP-003-8 R6

New content has different text for rule 'xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_soft_imagefs_available'.
--- xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_soft_imagefs_available
+++ xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_soft_imagefs_available
@@ -30,6 +30,7 @@
               
 This rule pertains to the imagefs.available setting of the evictionSoft
 section.
+Remediation will set field imagefs.available to {{ .var_kubelet_evictionsoft_imagefs_available }} based on the variable var_kubelet_evictionsoft_imagefs_available.
 
 [reference]:
 CIP-003-8 R6

New content has different text for rule 'xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_soft_imagefs_inodesfree'.
--- xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_soft_imagefs_inodesfree
+++ xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_soft_imagefs_inodesfree
@@ -30,6 +30,7 @@
               
 This rule pertains to the imagefs.inodesFree setting of the evictionSoft
 section.
+Remediation will set field imagefs.inodesFree to {{ .var_kubelet_evictionsoft_imagefs_inodesfree }} based on the variable var_kubelet_evictionsoft_imagefs_inodesfree.
 
 [reference]:
 CIP-003-8 R6

New content has different text for rule 'xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_soft_memory_available'.
--- xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_soft_memory_available
+++ xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_soft_memory_available
@@ -30,6 +30,7 @@
               
 This rule pertains to the memory.available setting of the evictionSoft
 section.
+Remediation will set field memory.available to {{ .var_kubelet_evictionsoft_memory_available }} based on the variable var_kubelet_evictionsoft_memory_available.
 
 [reference]:
 CIP-003-8 R6

New content has different text for rule 'xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_soft_nodefs_available'.
--- xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_soft_nodefs_available
+++ xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_soft_nodefs_available
@@ -30,6 +30,7 @@
               
 This rule pertains to the nodefs.available setting of the evictionSoft
 section.
+Remediation will set field nodefs.available to {{ .var_kubelet_evictionsoft_nodefs_available }} based on the variable var_kubelet_evictionsoft_nodefs_available.
 
 [reference]:
 CIP-003-8 R6

New content has different text for rule 'xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_soft_nodefs_inodesfree'.
--- xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_soft_nodefs_inodesfree
+++ xccdf_org.ssgproject.content_rule_kubelet_eviction_thresholds_set_soft_nodefs_inodesfree
@@ -30,6 +30,7 @@
               
 This rule pertains to the nodefs.inodesFree setting of the evictionSoft
 section.
+Remediation will set field nodefs.inodesFree to {{ .var_kubelet_evictionsoft_nodefs_inodesfree }} based on the variable var_kubelet_evictionsoft_nodefs_inodesfree.
 
 [reference]:
 CIP-003-8 R6

@marcusburghardt marcusburghardt added the OpenShift OpenShift product related. label May 21, 2024
Some of the kubeletconfig rules does not have not contains reference to variable being used in its remediation, this PR adds that reference to those rules. Related BUG: https://issues.redhat.com/browse/OCPBUGS-1316
Copy link

github-actions bot commented May 23, 2024

🤖 A k8s content image for this PR is available at:
ghcr.io/complianceascode/k8scontent:12012
This image was built from commit: 4c5266f

Click here to see how to deploy it

If you alread have Compliance Operator deployed:
utils/build_ds_container.py -i ghcr.io/complianceascode/k8scontent:12012

Otherwise deploy the content and operator together by checking out ComplianceAsCode/compliance-operator and:
CONTENT_IMAGE=ghcr.io/complianceascode/k8scontent:12012 make deploy-local

@xiaojiey
Copy link
Collaborator

/hold for test

@openshift-ci openshift-ci bot added the do-not-merge/hold Used by openshift-ci-robot bot. label May 27, 2024
@BhargaviGudi
Copy link
Collaborator

Verification passed with 4.16.0-0.nightly-2024-05-23-173505 + https://github.com/ComplianceAsCode/compliance-operator code + PR #12012 code

$ oc get rule -n openshift-compliance -o custom-columns=NAME:metadata.name,VARIABLE:metadata.annotations.compliance\\.openshift\\.io/rule-variable --no-headers  | grep upstream | grep eviction
upstream-ocp4-kubelet-eviction-thresholds-set-hard-imagefs-available                         var-kubelet-evictionhard-imagefs-available
upstream-ocp4-kubelet-eviction-thresholds-set-hard-imagefs-inodesfree                        var-kubelet-evictionhard-imagefs-inodesfree
upstream-ocp4-kubelet-eviction-thresholds-set-hard-memory-available                          var-kubelet-evictionhard-memory-available
upstream-ocp4-kubelet-eviction-thresholds-set-hard-nodefs-available                          var-kubelet-evictionhard-nodefs-available
upstream-ocp4-kubelet-eviction-thresholds-set-hard-nodefs-inodesfree                         var-kubelet-evictionhard-nodefs-inodesfree
upstream-ocp4-kubelet-eviction-thresholds-set-soft-imagefs-available                         var-kubelet-evictionsoft-imagefs-available
upstream-ocp4-kubelet-eviction-thresholds-set-soft-imagefs-inodesfree                        var-kubelet-evictionsoft-imagefs-inodesfree
upstream-ocp4-kubelet-eviction-thresholds-set-soft-memory-available                          var-kubelet-evictionsoft-memory-available
upstream-ocp4-kubelet-eviction-thresholds-set-soft-nodefs-available                          var-kubelet-evictionsoft-nodefs-available
upstream-ocp4-kubelet-eviction-thresholds-set-soft-nodefs-inodesfree                         var-kubelet-evictionsoft-nodefs-inodesfree
CR: upstream-ocp4-cis-node-master-kubelet-eviction-thresholds-set-hard-imagefs-available
  This rule pertains to the imagefs.available setting of the evictionHard section. Remediations for the imagefs.available field will be set to 15% based on variable var_kubelet_evictionhard_imagefs_available.
CCR: upstream-ocp4-cis-node-master-kubelet-eviction-thresholds-set-hard-memory-available
  This rule pertains to the memory.available setting of the evictionHard section. Remediations for the memory.available field will be set to 100Mi based on variable var_kubelet_evictionhard_memory_available.
CCR: upstream-ocp4-cis-node-master-kubelet-eviction-thresholds-set-hard-nodefs-available
  This rule pertains to the nodefs.available setting of the evictionHard section. Remediations for the nodefs.available field will be set to 10% based on variable var_kubelet_evictionhard_nodefs_available.
CCR: upstream-ocp4-cis-node-master-kubelet-eviction-thresholds-set-hard-nodefs-inodesfree
  This rule pertains to the nodefs.inodesFree setting of the evictionHard section. Remediations for the nodefs.inodesFree field will be set to 5% based on variable var_kubelet_evictionhard_nodefs_inodesfree.
CCR: upstream-ocp4-cis-node-worker-kubelet-eviction-thresholds-set-hard-imagefs-available
  This rule pertains to the imagefs.available setting of the evictionHard section. Remediations for the imagefs.available field will be set to 15% based on variable var_kubelet_evictionhard_imagefs_available.
CCR: upstream-ocp4-cis-node-worker-kubelet-eviction-thresholds-set-hard-memory-available
  This rule pertains to the memory.available setting of the evictionHard section. Remediations for the memory.available field will be set to 100Mi based on variable var_kubelet_evictionhard_memory_available.
CCR: upstream-ocp4-cis-node-worker-kubelet-eviction-thresholds-set-hard-nodefs-available
  This rule pertains to the nodefs.available setting of the evictionHard section. Remediations for the nodefs.available field will be set to 10% based on variable var_kubelet_evictionhard_nodefs_available.
CCR: upstream-ocp4-cis-node-worker-kubelet-eviction-thresholds-set-hard-nodefs-inodesfree
  This rule pertains to the nodefs.inodesFree setting of the evictionHard section. Remediations for the nodefs.inodesFree field will be set to 5% based on variable var_kubelet_evictionhard_nodefs_inodesfree.

@BhargaviGudi
Copy link
Collaborator

/unhold

@openshift-ci openshift-ci bot removed the do-not-merge/hold Used by openshift-ci-robot bot. label May 27, 2024
@yuumasato yuumasato self-assigned this Jun 6, 2024
Co-authored-by: Watson Yuuma Sato <wsato@redhat.com>
Copy link

codeclimate bot commented Jun 10, 2024

Code Climate has analyzed commit 4c5266f and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 59.4% (0.0% change).

View more on Code Climate.

@yuumasato yuumasato added this to the 0.1.74 milestone Jun 11, 2024
@yuumasato yuumasato merged commit c8eb752 into ComplianceAsCode:master Jun 11, 2024
109 of 113 checks passed
@Mab879 Mab879 added the Update Rule Issues or pull requests related to Rules updates. label Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OpenShift OpenShift product related. Update Rule Issues or pull requests related to Rules updates.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants