From efda02e946e6a058b634688788fc79a5fdeeb644 Mon Sep 17 00:00:00 2001 From: Mike Ng Date: Tue, 6 May 2025 10:42:34 -0400 Subject: [PATCH] docs: update argocd apps pull solution using the clusteradm CLI for easier setup (#982) Signed-off-by: Mike Ng --- solutions/deploy-argocd-apps-pull/README.md | 23 +++-- .../example/guestbook-app-set.yaml | 2 +- .../example/hub/appproject.yaml | 14 ---- .../example/hub/clusterset-binding.yaml | 8 -- .../example/hub/guestbook-app-placement.yaml | 6 -- .../hub/ocm-placement-consumer-role.yaml | 13 --- .../ocm-placement-consumer-rolebinding.yaml | 13 --- .../hub/ocm-placement-generator-cm.yaml | 10 --- .../managed/apply-managed-clusterrole.yaml | 8 -- .../apply-managed-clusterrolebinding.yaml | 12 --- .../example/managed/appproject.yaml | 14 ---- .../example/nested-apps-app-set.yaml | 2 +- .../getting-started.md | 83 +++++++------------ .../troubleshooting.md | 4 +- 14 files changed, 47 insertions(+), 165 deletions(-) delete mode 100644 solutions/deploy-argocd-apps-pull/example/hub/appproject.yaml delete mode 100644 solutions/deploy-argocd-apps-pull/example/hub/clusterset-binding.yaml delete mode 100644 solutions/deploy-argocd-apps-pull/example/hub/guestbook-app-placement.yaml delete mode 100644 solutions/deploy-argocd-apps-pull/example/hub/ocm-placement-consumer-role.yaml delete mode 100644 solutions/deploy-argocd-apps-pull/example/hub/ocm-placement-consumer-rolebinding.yaml delete mode 100644 solutions/deploy-argocd-apps-pull/example/hub/ocm-placement-generator-cm.yaml delete mode 100644 solutions/deploy-argocd-apps-pull/example/managed/apply-managed-clusterrole.yaml delete mode 100644 solutions/deploy-argocd-apps-pull/example/managed/apply-managed-clusterrolebinding.yaml delete mode 100644 solutions/deploy-argocd-apps-pull/example/managed/appproject.yaml diff --git a/solutions/deploy-argocd-apps-pull/README.md b/solutions/deploy-argocd-apps-pull/README.md index 8764af179..6e8535d06 100644 --- a/solutions/deploy-argocd-apps-pull/README.md +++ b/solutions/deploy-argocd-apps-pull/README.md @@ -1,16 +1,18 @@ -# ArgoCD Application Pull Controller -The [ArgoCD](https://argo-cd.readthedocs.io/en/stable/) application controller uses the hub-spoke pattern or pull model mechanism for decentralized resource delivery to remote clusters. -By using [Open Cluster Management (OCM)](https://open-cluster-management.io/) APIs and components, -the ArgoCD Applications will be pulled from the multi-cluster control plane hub cluster down to -the registered OCM managed clusters. To try it out, check out the [Getting Started Guide](getting-started.md). +# OCM Argo CD Add-on +The [Open Cluster Management (OCM)](https://open-cluster-management.io/) +[Argo CD](https://argo-cd.readthedocs.io/en/stable/) add-on uses the hub-spoke pattern +or pull model mechanism for decentralized resource delivery to remote clusters. +By using OCM APIs and components, +the Argo CD Applications will be pulled from the multi-cluster control plane hub cluster down to the registered OCM managed clusters. +To try it out, check out the [Getting Started Guide](getting-started.md). ## Overview -The current ArgoCD resource delivery is primarily pushing resources from a centralized cluster to the remote/managed clusters. +The current Argo CD resource delivery is primarily pushing resources from a centralized cluster to the remote/managed clusters. ![push model](./assets/push.png) -By using this controller, users can have a pull model resource delivery mechanism. +By using this OCM Argo CD add-on, users can have a pull model resource delivery mechanism. ![pull model](./assets/pull.png) @@ -19,9 +21,14 @@ The pull model may offers some advantages over the existing push model: - Security: cluster credentials doesn't have to be stored in a centralized environment may enhance security. - It may reduce the impact of a single point of centralized failure. -This ArgoCD pull model controller on the Hub cluster will create [ManifestWork](https://open-cluster-management.io/concepts/manifestwork/) objects wrapping Application objects as payload. +This OCM Argo CD add-on on the Hub cluster will create +[ManifestWork](https://open-cluster-management.io/concepts/manifestwork/) +objects wrapping Application objects as payload. The OCM agent on the Managed cluster will see the ManifestWork on the Hub cluster and pull the Application down. +The Managed cluster with the OCM Argo CD add-on enabled will automatically have an Argo CD instance installed. +The Argo CD application controller from the instance will be able to reconcile the Application CR on the managed cluster. + ## Quick Start See the [Getting Started](./getting-started.md) for a quick start guide. diff --git a/solutions/deploy-argocd-apps-pull/example/guestbook-app-set.yaml b/solutions/deploy-argocd-apps-pull/example/guestbook-app-set.yaml index bbc525399..fdc8f9abe 100644 --- a/solutions/deploy-argocd-apps-pull/example/guestbook-app-set.yaml +++ b/solutions/deploy-argocd-apps-pull/example/guestbook-app-set.yaml @@ -9,7 +9,7 @@ spec: configMapRef: ocm-placement-generator labelSelector: matchLabels: - cluster.open-cluster-management.io/placement: guestbook-app-placement + cluster.open-cluster-management.io/placement: app-placement requeueAfterSeconds: 30 template: metadata: diff --git a/solutions/deploy-argocd-apps-pull/example/hub/appproject.yaml b/solutions/deploy-argocd-apps-pull/example/hub/appproject.yaml deleted file mode 100644 index 69aef4fd4..000000000 --- a/solutions/deploy-argocd-apps-pull/example/hub/appproject.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: AppProject -metadata: - name: default - namespace: argocd -spec: - clusterResourceWhitelist: - - group: '*' - kind: '*' - destinations: - - namespace: '*' - server: '*' - sourceRepos: - - '*' diff --git a/solutions/deploy-argocd-apps-pull/example/hub/clusterset-binding.yaml b/solutions/deploy-argocd-apps-pull/example/hub/clusterset-binding.yaml deleted file mode 100644 index ecb279405..000000000 --- a/solutions/deploy-argocd-apps-pull/example/hub/clusterset-binding.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: cluster.open-cluster-management.io/v1beta2 -kind: ManagedClusterSetBinding -metadata: - name: global - namespace: argocd -spec: - clusterSet: global - diff --git a/solutions/deploy-argocd-apps-pull/example/hub/guestbook-app-placement.yaml b/solutions/deploy-argocd-apps-pull/example/hub/guestbook-app-placement.yaml deleted file mode 100644 index be233a277..000000000 --- a/solutions/deploy-argocd-apps-pull/example/hub/guestbook-app-placement.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: cluster.open-cluster-management.io/v1beta1 -kind: Placement -metadata: - name: guestbook-app-placement - namespace: argocd -spec: {} diff --git a/solutions/deploy-argocd-apps-pull/example/hub/ocm-placement-consumer-role.yaml b/solutions/deploy-argocd-apps-pull/example/hub/ocm-placement-consumer-role.yaml deleted file mode 100644 index a5d3763a7..000000000 --- a/solutions/deploy-argocd-apps-pull/example/hub/ocm-placement-consumer-role.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: ocm-placement-consumer - namespace: argocd -rules: -# Allow controller to manage placements/placementdecisions -- apiGroups: ["cluster.open-cluster-management.io"] - resources: ["placements"] - verbs: ["get", "list"] -- apiGroups: ["cluster.open-cluster-management.io"] - resources: ["placementdecisions"] - verbs: ["get", "list"] diff --git a/solutions/deploy-argocd-apps-pull/example/hub/ocm-placement-consumer-rolebinding.yaml b/solutions/deploy-argocd-apps-pull/example/hub/ocm-placement-consumer-rolebinding.yaml deleted file mode 100644 index 25bc2f2b4..000000000 --- a/solutions/deploy-argocd-apps-pull/example/hub/ocm-placement-consumer-rolebinding.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: ocm-placement-consumer:argocd - namespace: argocd -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: ocm-placement-consumer -subjects: -- kind: ServiceAccount - namespace: argocd - name: argocd-applicationset-controller diff --git a/solutions/deploy-argocd-apps-pull/example/hub/ocm-placement-generator-cm.yaml b/solutions/deploy-argocd-apps-pull/example/hub/ocm-placement-generator-cm.yaml deleted file mode 100644 index 59df142f9..000000000 --- a/solutions/deploy-argocd-apps-pull/example/hub/ocm-placement-generator-cm.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: ocm-placement-generator - namespace: argocd -data: - apiVersion: cluster.open-cluster-management.io/v1beta1 - kind: placementdecisions - statusListKey: decisions - matchKey: clusterName diff --git a/solutions/deploy-argocd-apps-pull/example/managed/apply-managed-clusterrole.yaml b/solutions/deploy-argocd-apps-pull/example/managed/apply-managed-clusterrole.yaml deleted file mode 100644 index 20342fc85..000000000 --- a/solutions/deploy-argocd-apps-pull/example/managed/apply-managed-clusterrole.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: argocd-klusterlet-consumer -rules: -- apiGroups: ["argoproj.io"] - resources: ["applications", "appprojects"] - verbs: ["create", "get", "list", "watch", "update", "patch", "delete"] diff --git a/solutions/deploy-argocd-apps-pull/example/managed/apply-managed-clusterrolebinding.yaml b/solutions/deploy-argocd-apps-pull/example/managed/apply-managed-clusterrolebinding.yaml deleted file mode 100644 index deaca963a..000000000 --- a/solutions/deploy-argocd-apps-pull/example/managed/apply-managed-clusterrolebinding.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: klusterlet-argocd-binding -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: argocd-klusterlet-consumer -subjects: -- kind: ServiceAccount - name: klusterlet-work-sa - namespace: open-cluster-management-agent diff --git a/solutions/deploy-argocd-apps-pull/example/managed/appproject.yaml b/solutions/deploy-argocd-apps-pull/example/managed/appproject.yaml deleted file mode 100644 index 69aef4fd4..000000000 --- a/solutions/deploy-argocd-apps-pull/example/managed/appproject.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: AppProject -metadata: - name: default - namespace: argocd -spec: - clusterResourceWhitelist: - - group: '*' - kind: '*' - destinations: - - namespace: '*' - server: '*' - sourceRepos: - - '*' diff --git a/solutions/deploy-argocd-apps-pull/example/nested-apps-app-set.yaml b/solutions/deploy-argocd-apps-pull/example/nested-apps-app-set.yaml index 90e2463ad..47ebc30e9 100644 --- a/solutions/deploy-argocd-apps-pull/example/nested-apps-app-set.yaml +++ b/solutions/deploy-argocd-apps-pull/example/nested-apps-app-set.yaml @@ -9,7 +9,7 @@ spec: configMapRef: ocm-placement-generator labelSelector: matchLabels: - cluster.open-cluster-management.io/placement: guestbook-app-placement + cluster.open-cluster-management.io/placement: app-placement requeueAfterSeconds: 30 template: metadata: diff --git a/solutions/deploy-argocd-apps-pull/getting-started.md b/solutions/deploy-argocd-apps-pull/getting-started.md index e1314ef1c..652d6d554 100644 --- a/solutions/deploy-argocd-apps-pull/getting-started.md +++ b/solutions/deploy-argocd-apps-pull/getting-started.md @@ -17,70 +17,43 @@ curl -L https://raw.githubusercontent.com/open-cluster-management-io/OCM/main/solutions/setup-dev-environment/local-up.sh | bash ``` - See [Open Cluster Management Quick Start](https://open-cluster-management.io/getting-started/quick-start/) for more details. + See [Open Cluster Management (OCM) Quick Start](https://open-cluster-management.io/getting-started/quick-start/) for more details. -2. Install ArgoCD on the hub cluster and both managed clusters. - ``` - for i in "hub" "cluster1" "cluster2" - do - kubectl config use-context kind-$i - kubectl create namespace argocd - kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml - done - ``` - See [ArgoCD website](https://argo-cd.readthedocs.io/en/stable/getting_started/) for more details. - -1. Install the Pull controller on the hub cluster: +1. Install Argo CD on the Hub cluster. ``` kubectl config use-context kind-hub - kubectl apply -f https://raw.githubusercontent.com/open-cluster-management-io/argocd-pull-integration/main/deploy/install.yaml + kubectl create namespace argocd + kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml ``` + See [Argo CD website](https://argo-cd.readthedocs.io/en/stable/getting_started/) for more details. -2. If your controller starts successfully, you should see: - ``` - $ kubectl config use-context kind-hub - $ kubectl -n open-cluster-management get deploy | grep pull - argocd-pull-integration-controller-manager 1/1 1 1 106s - ``` - -3. On the Hub cluster, create ArgoCD cluster secrets that represent the managed clusters. This step can be automated with [OCM auto import controller](https://github.com/open-cluster-management-io/multicloud-integrations/). - +1. Install the OCM Argo CD add-on on the Hub cluster: ``` kubectl config use-context kind-hub - for i in "cluster1" "cluster2" - do - cat <