weaveworks / gitopssets-controller

Manages the GitOpsSet CRDs.
Apache License 2.0
9 stars 5 forks source link

Cluster Generator #17

Closed sarataha closed 1 year ago

sarataha commented 1 year ago

Closes: https://github.com/weaveworks/weave-gitops-enterprise/issues/2147

This PR implements cluster generator which fetches gitops clusters that match the specified labels, and generates parameters for each cluster. The generated parameters include the cluster name, namespace, labels, and annotations.

How to test it?

Create a gitopscluster with some labels:

kubectl apply -f examples/cluster-generator/gitops-cluster.yaml

Create a gitopsset including a cluster generator, with matching labels:

kubectl apply -k examples/cluster-generator

Ensure a gitopsset is created with 1 resource:

kubectl get gitopsset

NAME             AGE   READY   STATUS
cluster-sample   19s   True    1 resources created

Create another gitopscluster with the same labels:

kubectl apply -f examples/cluster-generator/gitops-cluster.yaml

Ensure the gitopsset is updated and has 2 resources:

kubectl get gitopsset

NAME             AGE   READY   STATUS
cluster-sample   27s   True    2 resources created

Add and remove more gitopsclusters, and ensure the gitopsset is updated each time.

bigkevmcd commented 1 year ago

I also think this should watch GitOpsCluster resources, and trigger a reconciliation of related GitOpsSets?