argo-events icon indicating copy to clipboard operation
argo-events copied to clipboard

Enable sensor objects and sensor deployments to be in different clusters

Open shrinandj opened this issue 10 months ago • 0 comments

Is your feature request related to a problem? Please describe. Several Kubernetes controllers allow for running remotely as long as the valid Kubeconfig is made available to the controller. This is true for all CRDS + controllers created using kube-builder and also other well-known projects such as cluster-autoscaler.

Even in argo-events, it is possible to run the argo-event-controller to run remotely by having the KUBECONFIG environment variable pointing to the correct kubeconfig.

However, this is not the case with "sensor deployments". The sensor deployment is created/updated using the same client object that is used for watching the sensor objects themselves. Therefore, it always lands up in the same cluster where the sensor object is.

Code: https://github.com/argoproj/argo-events/blob/master/controllers/sensor/resource.go#L95

Describe the solution you'd like It should be possible to run the sensor deployment in a different cluster than where the sensor object itself is.

Not a 100% sure about this yet, but it seem this could be accomplished by:

  • Create an struct that implements the Create and Update methods of client-go's client.Client. Let's call this SensorDeploymentClient
  • Use an object of this struct instead of the current client.Client.
  • In the Create() and Update() methods of SensorDeploymentClient, check if SENSOR_DEPLOYMENT_KUBECONFIG env var is set. If not set, continue with the same functionality as today. If it is set, create the deployment in the cluster pointed to by SENSOR_DEPLOYMENT_KUBECONFIG (and make sure that the KUBECONFIG var for that deployment is set to point to the cluster where the sensor is)

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.


Message from the maintainers:

If you wish to see this enhancement implemented please add a 👍 reaction to this issue! We often sort issues this way to know what to prioritize.

shrinandj avatar Aug 09 '23 21:08 shrinandj