mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 03:47:04 +01:00
Updates for Max David's comments Adding merge comparison Reorg for clarity Updates for David
76 lines
2.4 KiB
Plaintext
76 lines
2.4 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * edge_computing/ztp-using-hub-cluster-templates.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="ztp-syncing-new-configmap-changes-to-existing-pgt-crs_{context}"]
|
|
= Syncing new ConfigMap changes to existing PolicyGenerator or PolicyGentemplate CRs
|
|
|
|
.Prerequisites
|
|
|
|
* You have installed the OpenShift CLI (`oc`).
|
|
|
|
* You have logged in to the hub cluster as a user with `cluster-admin` privileges.
|
|
|
|
* You have created a `PolicyGenerator` or `PolicyGentemplate` CR that pulls information from a `ConfigMap` CR using hub cluster templates.
|
|
|
|
.Procedure
|
|
|
|
. Update the contents of your `ConfigMap` CR, and apply the changes in the hub cluster.
|
|
|
|
. To sync the contents of the updated `ConfigMap` CR to the deployed policy, do either of the following:
|
|
|
|
.. Option 1: Delete the existing policy. ArgoCD uses the `PolicyGenerator` or `PolicyGentemplate` CR to immediately recreate the deleted policy. For example, run the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc delete policy <policy_name> -n <policy_namespace>
|
|
----
|
|
|
|
.. Option 2: Apply a special annotation `policy.open-cluster-management.io/trigger-update` to the policy with a different value every time when you update the `ConfigMap`. For example:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc annotate policy <policy_name> -n <policy_namespace> policy.open-cluster-management.io/trigger-update="1"
|
|
----
|
|
+
|
|
[NOTE]
|
|
====
|
|
You must apply the updated policy for the changes to take effect. For more information, see link:https://access.redhat.com/documentation/en-us/red_hat_advanced_cluster_management_for_kubernetes/2.6/html-single/governance/index#special-annotation-processing[Special annotation for reprocessing].
|
|
====
|
|
|
|
. Optional: If it exists, delete the `ClusterGroupUpdate` CR that contains the policy. For example:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc delete clustergroupupgrade <cgu_name> -n <cgu_namespace>
|
|
----
|
|
|
|
.. Create a new `ClusterGroupUpdate` CR that includes the policy to apply with the updated `ConfigMap` changes. For example, add the following YAML to the file `cgr-example.yaml`:
|
|
+
|
|
[source,yaml]
|
|
----
|
|
apiVersion: ran.openshift.io/v1alpha1
|
|
kind: ClusterGroupUpgrade
|
|
metadata:
|
|
name: <cgr_name>
|
|
namespace: <policy_namespace>
|
|
spec:
|
|
managedPolicies:
|
|
- <managed_policy>
|
|
enable: true
|
|
clusters:
|
|
- <managed_cluster_1>
|
|
- <managed_cluster_2>
|
|
remediationStrategy:
|
|
maxConcurrency: 2
|
|
timeout: 240
|
|
----
|
|
|
|
.. Apply the updated policy:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc apply -f cgr-example.yaml
|
|
----
|