// Module included in the following assemblies:
//
// * scalability_and_performance/ztp_far_edge/ztp-configuring-managed-clusters-policies.adoc

:_mod-docs-content-type: PROCEDURE
[id="ztp-customizing-a-managed-site-using-pgt_{context}"]
= Customizing a managed cluster with {policy-gen-cr} CRs

Use the following procedure to customize the policies that get applied to the managed cluster that you provision using the {ztp-first} pipeline.

.Prerequisites

* You have installed the OpenShift CLI (`oc`).

* You have logged in to the hub cluster as a user with `cluster-admin` privileges.

* 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

. Create a `{policy-gen-cr}` CR for site-specific configuration CRs.

.. Choose the appropriate example for your CR from the `{argocd-folder}` folder, for example, `{policy-prefix}example-sno-site.yaml` or `{policy-prefix}example-multinode-site.yaml`.

.. Change the `{binding-field}` field in the example file to match the site-specific label included in the `ClusterInstance` CR. In the example `ClusterInstance` file, the site-specific label is `sites: example-sno`.
+
[NOTE]
====
Ensure that the labels defined in your `{policy-gen-cr}` `{binding-field}` field correspond to the labels that are defined in the related managed clusters `ClusterInstance` CR.
====

.. Change the content in the example file to match the desired configuration.

. Optional: Create a `{policy-gen-cr}` CR for any common configuration CRs that apply to the entire fleet of clusters.

.. Select the appropriate example for your CR from the `{argocd-folder}` folder, for example, `{policy-prefix}common-ranGen.yaml`.

.. Change the content in the example file to match the required configuration.

. Optional: Create a `{policy-gen-cr}` CR for any group configuration CRs that apply to the certain groups of clusters in the fleet.
+
Ensure that the content of the overlaid spec files matches your required end state. As a reference, the `out/source-crs` directory contains the full list of source-crs available to be included and overlaid by your {policy-gen-cr} templates.
+
[NOTE]
====
Depending on the specific requirements of your clusters, you might need more than a single group policy per cluster type, especially considering that the example group policies each have a single `PerformancePolicy.yaml` file that can only be shared across a set of clusters if those clusters consist of identical hardware configurations.
====

.. Select the appropriate example for your CR from the `{argocd-folder}` folder, for example, `{policy-prefix}group-du-sno-ranGen.yaml`.

.. Change the content in the example file to match the required configuration.

. Optional. Create a validator inform policy `{policy-gen-cr}` CR to signal when the {ztp} installation and configuration of the deployed cluster is complete. For more information, see "Creating a validator inform policy".

. Define all the policy namespaces in a YAML file similar to the example `{argocd-folder}/ns.yaml` file.
+
[IMPORTANT]
====
Do not include the `Namespace` CR in the same file with the `{policy-gen-cr}` CR.
====

. Add the `{policy-gen-cr}` CRs and `Namespace` CR to the `kustomization.yaml` file in the generators section, similar to the example shown in `{argocd-folder}kustomization.yaml`.

. Commit the `{policy-gen-cr}` CRs, `Namespace` CR, and associated `kustomization.yaml` file in your Git repository and push the changes.
+
The ArgoCD pipeline detects the changes and begins the managed cluster deployment. You can push the changes to the `ClusterInstance` CR and the `{policy-gen-cr}` CR simultaneously.
