6.3. Using the cluster-compare plugin
You can use the cluster-compare plugin to compare a reference configuration with a configuration from a live cluster or must-gather data.
6.3.1. Using the cluster-compare plugin with a live cluster 링크 복사링크가 클립보드에 복사되었습니다!
You can use the cluster-compare plugin to compare a reference configuration with configuration custom resources (CRs) from a live cluster.
Validate live cluster configurations to ensure compliance with reference configurations during design, development, or testing scenarios.
Use the cluster-compare plugin with live clusters in non-production environments only. For production environments, use the plugin with must-gather data.
Prerequisites
-
You installed the OpenShift CLI (
oc). -
You have access to the cluster as a user with the
cluster-adminrole. -
You downloaded the
cluster-compareplugin and include it in yourPATHenvironment variable. - You have access to a reference configuration.
Procedure
Run the
cluster-compareplugin by using the following command:$ oc cluster-compare -r <path_to_reference_config>/metadata.yaml-rspecifies a path to themetadata.yamlfile of the reference configuration. You can specify a local directory or a URI.Example output
... ********************************** Cluster CR: operator.openshift.io/v1_Console_cluster1 Reference File: optional/console-disable/ConsoleOperatorDisable.yaml2 Diff Output: diff -u -N /tmp/MERGED-622469311/operator-openshift-io-v1_console_cluster /tmp/LIVE-2358803347/operator-openshift-io-v1_console_cluster /tmp/MERGED-622469311/operator-openshift-io-v1_console_cluster 2024-11-20 15:43:42.888633602 +0000 +++ /tmp/LIVE-2358803347/operator-openshift-io-v1_console_cluster 2024-11-20 15:43:42.888633602 +0000 @@ -4,5 +4,5 @@ name: cluster spec: logLevel: Normal - managementState: Removed3 + managementState: Managed operatorLogLevel: Normal ********************************** … Summary4 CRs with diffs: 5/495 CRs in reference missing from the cluster: 16 required-cluster-tuning: cluster-tuning: Missing CRs:7 - required/cluster-tuning/disabling-network-diagnostics/DisableSnoNetworkDiag.yaml No CRs are unmatched to reference CRs8 Metadata Hash: 512a9bf2e57fd5a5c44bbdea7abb3ffd7739d4a1f14ef9021f6793d5cdf868f09 No patched CRs10 - 1
- The CR under comparison. The plugin displays each CR with a difference from the corresponding template.
- 2
- The template matching with the CR for comparison.
- 3
- The output in Linux diff format shows the difference between the template and the cluster CR.
- 4
- After the plugin reports the line diffs for each CR, the summary of differences are reported.
- 5
- The number of CRs in the comparison with differences from the corresponding templates.
- 6
- The number of CRs represented in the reference configuration, but missing from the live cluster.
- 7
- The list of CRs represented in the reference configuration, but missing from the live cluster.
- 8
- The CRs that did not match to a corresponding template in the reference configuration.
- 9
- The metadata hash identifies the reference configuration.
- 10
- The list of patched CRs.
Get the output in the junit format by adding -o junit to the command. For example:
$ oc cluster-compare -r <path_to_reference_config>/metadata.yaml -o junit
The junit output includes the following result types:
- Passed results for each fully matched template.
- Failed results for differences found or missing required custom resources (CRs).
- Skipped results for differences patched using the user override mechanism.