// Module included in the following assemblies:
//
// * edge_computing/ztp-configuring-managed-clusters-policygenerator.adoc

:_mod-docs-content-type: CONCEPT
[id="ztp-comparing-pgt-and-rhacm-pg-patching-strategies_{context}"]
= Comparing {rh-rhacm} PolicyGenerator and PolicyGenTemplate resource patching

`PolicyGenerator` custom resources (CRs) and `PolicyGenTemplate` CRs can be used in {ztp} to generate {rh-rhacm} policies for managed clusters.

There are advantages to using `PolicyGenerator` CRs over `PolicyGenTemplate` CRs when it comes to patching {product-title} resources with {ztp}.
Using the {rh-rhacm} `PolicyGenerator` API provides a generic way of patching resources which is not possible with `PolicyGenTemplate` resources.

The `PolicyGenerator` API is a part of the link:https://open-cluster-management.io/[Open Cluster Management] standard, while the `PolicyGenTemplate` API is not.
A comparison of `PolicyGenerator` and `PolicyGenTemplate` resource patching and placement strategies are described in the following table.

include::snippets/pgt-deprecation-notice.adoc[]

.Comparison of {rh-rhacm} PolicyGenerator and PolicyGenTemplate patching
[cols="1,2", width="90%", options="header"]
|====
|PolicyGenerator patching
|PolicyGenTemplate patching

|Uses Kustomize strategic merges for merging resources.
For more information see link:https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/[Declarative Management of Kubernetes Objects Using Kustomize].
|Works by replacing variables with their values as defined by the patch.
This is less flexible than Kustomize merge strategies.

|Supports `ManagedClusterSet` and `Binding` resources.
|Does not support `ManagedClusterSet` and `Binding` resources.

|Relies only on patching, no embedded variable substitution is required.
|Overwrites variable values defined in the patch.

|Does not support merging lists in merge patches.
Replacing a list in a merge patch is supported.
|Merging and replacing lists is supported in a limited fashion - you can only merge one object in the list.

|Does not currently support the link:https://spec.openapis.org/oas/latest.html[OpenAPI specification] for resource patching.
This means that additional directives are required in the patch to merge content that does not follow a schema, for example, `PtpConfig` resources.
|Works by replacing fields and values with values as defined by the patch.

|Requires additional directives, for example, `$patch: replace` in the patch to merge content that does not follow a schema.
|Substitutes fields and values defined in the source CR with values defined in the patch, for example `$name`.

|Can patch the `Name` and `Namespace` fields defined in the reference source CR, but only if the CR file has a single object.
|Can patch the `Name` and `Namespace` fields defined in the reference source CR.
|====
