// Module included in the following assemblies:
//
// * edge_computing/policygenerator_for_ztp/ztp-advanced-policygenerator-config.adoc
// * edge_computing/policygentemplate_for_ztp/ztp-advanced-policy-config.adoc

:_mod-docs-content-type: PROCEDURE

[id="ztp-adding-new-content-to-gitops-ztp_{context}"]
= Adding custom content to the {ztp} pipeline

[role="_abstract"]
Perform the following procedure to add new content to the {ztp} pipeline.

.Procedure

. Create a subdirectory named `source-crs` in the directory that contains the `kustomization.yaml` file for the `{policy-gen-cr}` custom resource (CR).

. Add your user-provided CRs to the `source-crs` subdirectory, as shown in the following example:
+
--
ifeval::["{policy-gen-cr}" == "PolicyGenTemplate"]
include::snippets/pgt-ztp-adding-new-content-to-gitops-ztp-folder-structure.adoc[]
endif::[]
ifeval::["{policy-gen-cr}" == "PolicyGenerator"]
include::snippets/pg-ztp-adding-new-content-to-gitops-ztp-folder-structure.adoc[]
endif::[]
--

. Update the required `{policy-gen-cr}` CRs to include references to the content you added in the `source-crs/custom-crs` and `source-crs/elasticsearch` directories. For example:
+
--
ifeval::["{policy-gen-cr}" == "PolicyGenTemplate"]
include::snippets/pgt-ztp-adding-new-content-to-gitops-ztp.adoc[]
endif::[]
ifeval::["{policy-gen-cr}" == "PolicyGenerator"]
include::snippets/pg-ztp-adding-new-content-to-gitops-ztp.adoc[]
endif::[]
--

. Commit the `{policy-gen-cr}` change in Git, and then push to the Git repository that is monitored by the GitOps ZTP Argo CD policies application.

. Update the `ClusterGroupUpgrade` CR to include the changed `{policy-gen-cr}` and save it as `cgu-test.yaml`. The following example shows a generated `cgu-test.yaml` file.
+
[source,yaml]
----
apiVersion: ran.openshift.io/v1alpha1
kind: ClusterGroupUpgrade
metadata:
  name: custom-source-cr
  namespace: ztp-clusters
spec:
  managedPolicies:
    - group-dev-config-policy
  enable: true
  clusters:
  - cluster1
  remediationStrategy:
    maxConcurrency: 2
    timeout: 240
----

. Apply the updated `ClusterGroupUpgrade` CR by running the following command:
+
[source,terminal]
----
$ oc apply -f cgu-test.yaml
----

.Verification

* Check that the updates have succeeded by running the following command:
+
[source, terminal]
----
$ oc get cgu -A
----
+
The following example shows the output:
+
[source, terminal]
----
NAMESPACE     NAME               AGE   STATE        DETAILS
ztp-clusters  custom-source-cr   6s    InProgress   Remediating non-compliant policies
ztp-install   cluster1           19h   Completed    All clusters are compliant with all the managed policies
----
