Advanced managed cluster configuration with SiteConfig resources

You can use SiteConfig custom resources (CRs) to deploy custom functionality and configurations in your managed clusters at installation time.

Customizing extra installation manifests in the ZTP GitOps pipeline

You can define a set of extra manifests for inclusion in the installation phase of the zero touch provisioning (ZTP) GitOps pipeline. These manifests are linked to the SiteConfig custom resources (CRs) and are applied to the cluster during installation. Including MachineConfig CRs at install time makes the installation process more efficient.

Prerequisites

  • Create a Git repository where you manage your custom site configuration data. The repository must be accessible from the hub cluster and be defined as a source repository for the Argo CD application.

Procedure

  1. Create a set of extra manifest CRs that the ZTP pipeline uses to customize the cluster installs.

  2. In your custom /siteconfig directory, create an /extra-manifest folder for your extra manifests. The following example illustrates a sample /siteconfig with /extra-manifest folder:

    1. siteconfig
    2. ├── site1-sno-du.yaml
    3. ├── site2-standard-du.yaml
    4. └── extra-manifest
    5. └── 01-example-machine-config.yaml
  3. Add your custom extra manifest CRs to the siteconfig/extra-manifest directory.

  4. In your SiteConfig CR, enter the directory name in the extraManifestPath field, for example:

    1. clusters:
    2. - clusterName: "example-sno"
    3. networkType: "OVNKubernetes"
    4. extraManifestPath: extra-manifest
  5. Save the SiteConfig CRs and /extra-manifest CRs and push them to the site configuration repo.

The ZTP pipeline appends the CRs in the /extra-manifest directory to the default set of extra manifests during cluster provisioning.

Filtering custom resources using SiteConfig filters

By using filters, you can easily customize SiteConfig custom resources (CRs) to include or exclude other CRs for use in the installation phase of the zero touch provisioning (ZTP) GitOps pipeline.

You can specify an inclusionDefault value of include or exclude for the SiteConfig CR, along with a list of the specific extraManifest RAN CRs that you want to include or exclude. Setting inclusionDefault to include makes the ZTP pipeline apply all the files in /source-crs/extra-manifest during installation. Setting inclusionDefault to exclude does the opposite.

You can exclude individual CRs from the /source-crs/extra-manifest folder that are otherwise included by default. The following example configures a custom single-node OpenShift SiteConfig CR to exclude the /source-crs/extra-manifest/03-sctp-machine-config-worker.yaml CR at installation time.

Some additional optional filtering scenarios are also described.

Prerequisites

  • You configured the hub cluster for generating the required installation and policy CRs.

  • You created a Git repository where you manage your custom site configuration data. The repository must be accessible from the hub cluster and be defined as a source repository for the Argo CD application.

Procedure

  1. To prevent the ZTP pipeline from applying the 03-sctp-machine-config-worker.yaml CR file, apply the following YAML in the SiteConfig CR:

    1. apiVersion: ran.openshift.io/v1
    2. kind: SiteConfig
    3. metadata:
    4. name: "site1-sno-du"
    5. namespace: "site1-sno-du"
    6. spec:
    7. baseDomain: "example.com"
    8. pullSecretRef:
    9. name: "assisted-deployment-pull-secret"
    10. clusterImageSetNameRef: "openshift-4.12"
    11. sshPublicKey: "<ssh_public_key>"
    12. clusters:
    13. - clusterName: "site1-sno-du"
    14. extraManifests:
    15. filter:
    16. exclude:
    17. - 03-sctp-machine-config-worker.yaml

    The ZTP pipeline skips the 03-sctp-machine-config-worker.yaml CR during installation. All other CRs in /source-crs/extra-manifest are applied.

  2. Save the SiteConfig CR and push the changes to the site configuration repository.

    The ZTP pipeline monitors and adjusts what CRs it applies based on the SiteConfig filter instructions.

  3. Optional: To prevent the ZTP pipeline from applying all the /source-crs/extra-manifest CRs during cluster installation, apply the following YAML in the SiteConfig CR:

    1. - clusterName: "site1-sno-du"
    2. extraManifests:
    3. filter:
    4. inclusionDefault: exclude
  4. Optional: To exclude all the /source-crs/extra-manifest RAN CRs and instead include a custom CR file during installation, edit the custom SiteConfig CR to set the custom manifests folder and the include file, for example:

    1. clusters:
    2. - clusterName: "site1-sno-du"
    3. extraManifestPath: "<custom_manifest_folder>" (1)
    4. extraManifests:
    5. filter:
    6. inclusionDefault: exclude (2)
    7. include:
    8. - custom-sctp-machine-config-worker.yaml
    1Replace <custom_manifest_folder> with the name of the folder that contains the custom installation CRs, for example, user-custom-manifest/.
    2Set inclusionDefault to exclude to prevent the ZTP pipeline from applying the files in /source-crs/extra-manifest during installation.

    The following example illustrates the custom folder structure:

    1. siteconfig
    2. ├── site1-sno-du.yaml
    3. └── user-custom-manifest
    4. └── custom-sctp-machine-config-worker.yaml