github.com/argoproj/argo-cd/v2@v2.10.9/applicationset/examples/clusterDecisionResource/README.md (about) 1 # How the Cluster Decision Resource generator works for clusterDecisionResource 2 1. The Cluster Decision Resource generator reads a configurable status format: 3 ```yaml 4 status: 5 clusters: 6 - name: cluster-01 7 - name: cluster-02 8 ``` 9 This is a common status format. Another format that could be read looks like this: 10 ```yaml 11 status: 12 decisions: 13 - clusterName: cluster-01 14 namespace: cluster-01 15 - clusterName: cluster-02 16 namespace: cluster-02 17 ``` 18 2. Any resource that has a list of key / value pairs, where the value matches ArgoCD cluster names can be used. 19 3. The key / value pairs found in each element of the list will be available to the template. As well, `name` and `server` will still be available to the template. 20 4. The Service Account used by the ApplicationSet controller must have access to `Get` the resource you want to retrieve the duck type definition from 21 5. A configMap is used to identify the resource to read status of generated ArgoCD clusters from. You can use multiple resources by creating a ConfigMap for each one in the ArgoCD namespace. 22 ```yaml 23 apiVersion: v1 24 kind: ConfigMap 25 metadata: 26 name: my-configmap 27 data: 28 apiVersion: group.io/v1 29 kind: mykinds 30 statusListKey: clusters 31 matchKey: name 32 ``` 33 * `apiVersion` - This is the apiVersion of your resource 34 * `kind` - This is the plural kind of your resource 35 * `statusListKey` - Default is 'clusters', this is the key found in your resource's status that is a list of ArgoCD clusters. 36 * `matchKey` - Is the key name found in the cluster list, `name` and `clusterName` are the keys in the examples above. 37 38 # Applying the example 39 1. Connect to a cluster with the ApplicationSet controller running 40 2. Edit the Role for the ApplicationSet service account, and grant it permission to `list` the `placementdecisions` resources, from apiGroups `cluster.open-cluster-management.io/v1alpha1` 41 ```yaml 42 - apiGroups: 43 - "cluster.open-cluster-management.io/v1alpha1" 44 resources: 45 - placementdecisions 46 verbs: 47 - list 48 ``` 49 3. Apply the following controller and associated ManagedCluster CRD's: 50 https://github.com/open-cluster-management/placement 51 4. Now apply the PlacementDecision and an ApplicationSet: 52 ```bash 53 kubectl apply -f ./placementdecision.yaml 54 kubectl apply -f ./configMap.yaml 55 kubectl apply -f ./ducktype-example.yaml 56 ``` 57 5. For now this won't do anything until you create a controller that populates the `Status.Decisions` array.