Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1814559

Summary: [OCP 4.5] While deploying ComplianceRemediation cr, it reports "invalid spec.machineConfigContents.spec.kernelType: Required value"' error
Product: OpenShift Container Platform Reporter: Prashant Dhamdhere <pdhamdhe>
Component: Compliance OperatorAssignee: Jakub Hrozek <jhrozek>
Status: CLOSED ERRATA QA Contact: Prashant Dhamdhere <pdhamdhe>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.5CC: josorior, mrogers, nkinder, xtian
Target Milestone: ---   
Target Release: 4.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: v0.1.10 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-27 15:57:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Prashant Dhamdhere 2020-03-18 09:10:58 UTC
Description of problem:
The ComplianceRemediation reports "invalid spec.machineConfigContents.spec.kernelType: Required value" error while deploying cr 

$ oc create -f compliance-operator/deploy/crds/compliance.openshift.io_v1alpha1_complianceremediation_cr.yaml  
The ComplianceRemediation "example-remediation-worker-no-direct-root-login" is invalid: spec.machineConfigContents.spec.kernelType: Required value 

Version-Release number of selected component (if applicable):
4.5.0-0.nightly-2020-03-17-225152 

How reproducible:
Always 

Steps to Reproduce:
1. $ git clone https://github.com/openshift/compliance-operator.git 
2. $ oc create -f compliance-operator/deploy/ns.yaml  
3. $ oc project openshift-compliance 
4. $ for f in $(ls -1 compliance-operator/deploy/crds/*crd.yaml); do oc create -f $f; done 
5. $ oc create -f compliance-operator/deploy/ 
6. $ oc create -f compliance-operator/deploy/crds/compliance.openshift.io_v1alpha1_complianceremediation_cr.yaml

Actual results:
The ComplianceRemediation reports "invalid spec.machineConfigContents.spec.kernelType: Required value" error while deploying cr  

Expected results:
The ComplianceRemediation cr should deploy without an error message 

Additional info:

Comment 4 Jakub Hrozek 2020-06-18 17:11:37 UTC
Sorry, more context: This was fixed upstream by removing the example CR. The ComplianceRemediation CR was not intended to be used directly, but only generated by the operator instead.

Comment 7 Prashant Dhamdhere 2020-07-27 11:46:25 UTC
Verified on latest compliance-operator.v0.1.11

$ grep "name:\|version:" compliance-operator/deploy/olm-catalog/compliance-operator/0.1.11/compliance-operator.v0.1.11.clusterserviceversion.yaml |awk 'NR==1; END{print}'
  name: compliance-operator.v0.1.11
  version: 0.1.11

The complianceremediation CR should only be generated by the operator and does not suppose to be used by users.
So it does not exist in the latest compliance-operator version.

$ (ls -1 compliance-operator/deploy/crds/*cr.yaml)
compliance-operator/deploy/crds/compliance.openshift.io_v1alpha1_compliancescan_cr.yaml
compliance-operator/deploy/crds/compliance.openshift.io_v1alpha1_compliancesuite_cr.yaml
compliance-operator/deploy/crds/compliance.openshift.io_v1alpha1_profilebundle_cr.yaml
compliance-operator/deploy/crds/compliance.openshift.io_v1alpha1_scansettingbinding_cr.yaml
compliance-operator/deploy/crds/compliance.openshift.io_v1alpha1_scansetting_cr.yaml
compliance-operator/deploy/crds/compliance.openshift.io_v1alpha1_tailoredprofile_cr.yaml

In the latest version, the complianceremediation generates by compliance-operator instead of users.

$ oc version
Client Version: 4.4.0-rc.9
Server Version: 4.6.0-0.nightly-2020-07-25-091217
Kubernetes Version: v4.6.0-202007250017.p0-dirty

$ oc get complianceremediations workers-scan-audit-rules-dac-modification-chmod -o yaml |head
apiVersion: compliance.openshift.io/v1alpha1
kind: ComplianceRemediation
metadata:
  creationTimestamp: "2020-07-27T06:54:35Z"
  generation: 1
  labels:
    compliance.openshift.io/suite: example-compliancesuite
    complianceoperator.openshift.io/scan: workers-scan
    machineconfiguration.openshift.io/role: worker
  managedFields:

Comment 9 errata-xmlrpc 2020-10-27 15:57:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Container Platform 4.6 GA Images), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4196