|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * security/compliance_operator/compliance-operator-crd.adoc |
| 4 | + |
| 5 | +:_content-type: CONCEPT |
| 6 | +[id="advance-compliance-scan-object_{context}"] |
| 7 | += Advanced ComplianceScan Object |
| 8 | +The Compliance Operator includes options for advanced users for debugging or integrating with existing tooling. While it is recommended that you not create a `ComplianceScan` object directly, you can instead manage it using a `ComplianceSuite` object. |
| 9 | + |
| 10 | +.Example Advanced `ComplianceScan` object |
| 11 | +[source,yaml] |
| 12 | +---- |
| 13 | +apiVersion: compliance.openshift.io/v1alpha1 |
| 14 | +kind: ComplianceScan |
| 15 | +metadata: |
| 16 | + name: <name of the scan> |
| 17 | +spec: |
| 18 | + scanType: Node <1> |
| 19 | + profile: xccdf_org.ssgproject.content_profile_moderate <2> |
| 20 | + content: ssg-ocp4-ds.xml |
| 21 | + contentImage: quay.io/complianceascode/ocp4:latest <3> |
| 22 | + rule: "xccdf_org.ssgproject.content_rule_no_netrc_files" <4> |
| 23 | + nodeSelector: <5> |
| 24 | + node-role.kubernetes.io/worker: "" |
| 25 | +status: |
| 26 | + phase: DONE <6> |
| 27 | + result: NON-COMPLIANT <7> |
| 28 | +---- |
| 29 | + |
| 30 | +<1> Specify either `Node` or `Platform`. Node profiles scan the cluster nodes and platform profiles scan the Kubernetes platform. |
| 31 | +<2> Specify the XCCDF identifier of the profile that you want to run. |
| 32 | +<3> Specify the container image that encapsulates the profile files. |
| 33 | +<4> It is optional. Specify the scan to run a single rule. This rule has to be identified with the XCCDF ID, and has to belong to the specified profile. |
| 34 | ++ |
| 35 | +[NOTE] |
| 36 | +==== |
| 37 | +If you skip the `rule` parameter, then scan runs for all the available rules of the specified profile. |
| 38 | +==== |
| 39 | +<5> If you are on the {product-title} and wants to generate a remediation, then nodeSelector label has to match the `MachineConfigPool` label. |
| 40 | ++ |
| 41 | +[NOTE] |
| 42 | +==== |
| 43 | +If you do not specify `nodeSelector` parameter or match the `MachineConfig` label, scan will still run, but it will not create remediation. |
| 44 | +==== |
| 45 | +<6> Indicates the current phase of the scan. |
| 46 | +<7> Indicates the verdict of the scan. |
| 47 | + |
| 48 | +[IMPORTANT] |
| 49 | +==== |
| 50 | +If you delete a `ComplianceSuite` object, then all the associated scans get deleted. |
| 51 | +==== |
| 52 | + |
| 53 | +When the scan is complete, it generates the result as Custom Resources of the `ComplianceCheckResult` object. However, the raw results are available in ARF format. These results are stored in a Persistent Volume (PV), which has a Persistent Volume Claim (PVC) associated with the name of the scan. |
| 54 | +You can programmatically fetch the `ComplianceScans` events. To generate events for the suite, run the following command: |
| 55 | + |
| 56 | +[source,terminal] |
| 57 | +---- |
| 58 | +oc get events --field-selector involvedObject.kind=ComplianceScan,involvedObject.name=<name of the suite> |
| 59 | +---- |
0 commit comments