6.5. Performing advanced reference configuration customization


For scenarios where you want to allow temporary deviations from the reference design, you can apply more advanced customizations.

주의

These customizations override the default matching process that the cluster-compare plugin uses during a comparison. Use caution when applying these advanced customizations as it can lead to unintended consequences, such as excluding consequential information from a cluster comparison.

Some advanced tasks to dynamically customize your reference configuration include the following:

  • Manual matching: Configure a user configuration file to manually match a custom resource from the cluster to a template in the reference configuration.
  • Patching the reference: Patch a reference to configure a reference configuration by using a patch option with the cluster-compare command.

6.5.1. Configuring manual matching between CRs and templates

In some cases, the cluster-compare plugin’s default matching might not work as expected. You can manually define how a custom resource (CR) maps to a template by using a user configuration file.

By default, the plugin maps a CR to a template based on the apiversion, kind, name, and namespace fields. However, multiple templates might match a single CR. For example, this can occur in the following scenarios:

  • Multiple templates exist with the same apiversion, kind, name, and namespace fields.
  • Templates match any CR with a specific apiversion and kind, regardless of its namespace or name.

When a CR matches multiple templates, the plugin uses a tie-breaking mechanism that selects the template with the fewest differences. To explicitly control which template the plugin chooses, you can create a user configuration YAML file that defines manual matching rules. You can pass this configuration file to the cluster-compare command to enforce the required template selection.

Procedure

  1. Create a user configuration file to define the manual matching criteria:

    Example user-config.yaml file

    correlationSettings: 
    1
    
       manualCorrelation: 
    2
    
          correlationPairs: 
    3
    
            ptp.openshift.io/v1_PtpConfig_openshift-ptp_grandmaster: optional/ptp-config/PtpOperatorConfig.yaml 
    4
    
            ptp.openshift.io/v1_PtpOperatorConfig_openshift-ptp_default: optional/ptp-config/PtpOperatorConfig.yaml

    1
    The correlationSettings section contains the manual correlation settings.
    2
    The manualCorrelation section specifies that manual correlation is enabled.
    3
    The correlationPairs section lists the CR and template pairs to manually match.
    4
    Specifies the CR and template pair to match. The CR specification uses the following format: <apiversion>_<kind>_<namespace>_<name>. For cluster-scoped CRs that do not have a namespace, use the following format: <apiversion>_<kind>_<name>. The path to the template must be relative to the metadata.yaml file.
  2. Reference the user configuration file in a cluster-compare command by running the following command:

    $ oc cluster-compare -r <path_to_reference_config>/metadata.yaml -c <path_to_user_config>/user-config.yaml 
    1
    1
    Specify the user-config.yaml file by using the -c option.
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동