Sveltos-agent must support being deployed in the managed cluster (current and default option) or the management cluster. Please refer to this for more info.
Classifier then needs a knob to be instructed where to start sveltos-agent.
When sveltos-agent needs to be deployed in the management cluster deploySveltosAgent needs to change. Better to have a separate function as:
- sveltos-agent Deployment namespace needs to be same as cluster namespace
- sveltos-agent Deployment name needs to contain cluster name and cluster-type in order to avoid collision
- sveltos-agent Deployment selector needs to contain cluster name and cluster-type
- sveltos-agent Deployment will only need Secret list/get permissions in the management cluster (in order to access the Secret containing the Kubeconfig to access cluster).
Another option would be to give sveltos-agent no permission in the management cluster and then directly get and pass the Kubeconfig when starting sveltos-agent.
I believe Deployment and (Cluster)Role for proxy-role are needed, though potentially all could be installed if namespaces/names are cluster aware.
classifier ClusterReconciler and SveltosClusterReconciler needs to delete all that was installed in the management cluster for a given cluster when cluster is deleted.