Configuring the hub cluster with ArgoCD
You can configure the hub cluster with a set of ArgoCD applications that generate the required installation and policy custom resources (CRs) for each site with GitOps Zero Touch Provisioning (ZTP).
|
|
Red Hat Advanced Cluster Management (RHACM) uses |
-
You have a OpenShift Container Platform hub cluster with Red Hat Advanced Cluster Management (RHACM) and Red Hat OpenShift GitOps installed.
-
You have extracted the reference deployment from the GitOps ZTP plugin container as described in the "Preparing the GitOps ZTP site configuration repository" section. Extracting the reference deployment creates the
out/argocd/deploymentdirectory referenced in the following procedure.
-
Prepare the ArgoCD pipeline configuration:
-
Create a Git repository with the directory structure similar to the example directory. For more information, see "Preparing the GitOps ZTP site configuration repository".
-
Configure access to the repository using the ArgoCD UI. Under Settings configure the following:
-
Repositories - Add the connection information. The URL must end in
.git, for example,https://repo.example.com/repo.gitand credentials. -
Certificates - Add the public certificate for the repository, if needed.
-
-
Modify the two ArgoCD applications,
out/argocd/deployment/clusters-app.yamlandout/argocd/deployment/policies-app.yaml, based on your Git repository:-
Update the URL to point to the Git repository. The URL ends with
.git, for example,https://repo.example.com/repo.git. -
The
targetRevisionindicates which Git repository branch to monitor. -
pathspecifies the path to theClusterInstanceandPolicyGeneratororPolicyGentemplateCRs, respectively.
-
-
-
To install the GitOps ZTP plugin, patch the ArgoCD instance in the hub cluster with the relevant multicluster engine (MCE) subscription image. Customize the patch file that you previously extracted into the
out/argocd/deployment/directory for your environment.-
Select the
multicluster-operators-subscriptionimage that matches your RHACM version.-
For RHACM 2.8 and 2.9, use the
registry.redhat.io/rhacm2/multicluster-operators-subscription-rhel8:v<rhacm_version>image. -
For RHACM 2.10 and later, use the
registry.redhat.io/rhacm2/multicluster-operators-subscription-rhel9:v<rhacm_version>image.
The version of the
multicluster-operators-subscriptionimage must match the RHACM version. Beginning with the MCE 2.10 release, RHEL 9 is the base image formulticluster-operators-subscriptionimages.Click
[Expand for Operator list]in the "Platform Aligned Operators" table in OpenShift Operator Life Cycles to view the complete supported Operators matrix for OpenShift Container Platform. -
-
Modify the
out/argocd/deployment/argocd-openshift-gitops-patch.jsonfile with themulticluster-operators-subscriptionimage that matches your RHACM version:{ "args": [ "-c", "mkdir -p /.config/kustomize/plugin/policy.open-cluster-management.io/v1/policygenerator && cp /policy-generator/PolicyGenerator-not-fips-compliant /.config/kustomize/plugin/policy.open-cluster-management.io/v1/policygenerator/PolicyGenerator" ], "command": [ "/bin/bash" ], "image": "registry.redhat.io/rhacm2/multicluster-operators-subscription-rhel9:v2.10", "name": "policy-generator-install", "imagePullPolicy": "Always", "volumeMounts": [ { "mountPath": "/.config", "name": "kustomize" } ] }-
Optional: For RHEL 9 images, in the
argsfield, change the executable path from/policy-generator/PolicyGenerator-not-fips-compliantto match the required universal executable for your ArgoCD version. -
Match the
multicluster-operators-subscriptionimage to your RHACM version. In disconnected environments, replace the URL with the disconnected registry equivalent for your environment.
-
-
Patch the ArgoCD instance. Run the following command:
$ oc patch argocd openshift-gitops \ -n openshift-gitops --type=merge \ --patch-file out/argocd/deployment/argocd-openshift-gitops-patch.json
-
-
In RHACM 2.7 and later, the multicluster engine enables the
cluster-proxy-addonfeature by default. Apply the following patch to disable thecluster-proxy-addonfeature and remove the relevant hub cluster and managed pods that are responsible for this add-on. Run the following command:$ oc patch multiclusterengines.multicluster.openshift.io multiclusterengine --type=merge --patch-file out/argocd/deployment/disable-cluster-proxy-addon.json -
Apply the pipeline configuration to your hub cluster by running the following command:
$ oc apply -k out/argocd/deployment -
Optional: If you have existing ArgoCD applications, verify that the
PrunePropagationPolicy=backgroundpolicy is set in theApplicationresource by running the following command:$ oc -n openshift-gitops get applications.argoproj.io \ clusters -o jsonpath='{.spec.syncPolicy.syncOptions}' |jqExample output for an existing policy:
[ "CreateNamespace=true", "PrunePropagationPolicy=background", "RespectIgnoreDifferences=true" ]-
If the
spec.syncPolicy.syncOptionfield does not contain aPrunePropagationPolicyparameter orPrunePropagationPolicyis set to theforegroundvalue, set the policy tobackgroundin theApplicationresource. See the following example:kind: Application spec: syncPolicy: syncOptions: - PrunePropagationPolicy=background
Setting the
backgrounddeletion policy ensures that theManagedClusterCR and all its associated resources are deleted. -
|
|
Using For more information about |