open-cluster-management-io / addon-framework

addon apis
Apache License 2.0
23 stars 40 forks source link

Support for multiple resources of the same GVR in the ManagedClusterAddOn resource #263

Closed JoaoBraveCoding closed 2 days ago

JoaoBraveCoding commented 5 months ago

Request/Feature

Add support for multiple resources of the same GVR in .spec.configs section of the ManagedClusterAddOn resource. The goal is that AddOns can then iterate over ManagedClusterAddOn.Status.ConfigReferences and have access to multiple resources with the same GVR.

Use Case

Our AddOn (rhobs/multicluster-observability-addon) can configure ClusterLogForwarding on a fleet of clusters to forward logs to a Loki central instance. For this, we need to provide the addon with a configmap containing the authentication method that should be used, a configmap with the Loki URL that should be used for that specific spoke cluster and finally if we are using mTLS a configmap with the CA Bundle of the Loki instance.

In total that's 3 configmaps that we have to add to the .spec.configs section of the resource ManagedClusterAddOn when we create it in the namespace of a spoke cluster.

qiujian16 commented 5 months ago

/assign @qiujian16

@zhujian7 @haoqing0110 we have to discuss about it on whether it is feasible. The major concern, is if the user select specify multiple configurations with the same gvk, do we merge them or use the one with the highest order or it is purely addon's decision.

JoaoBraveCoding commented 5 months ago

The major concern, is if the user select specify multiple configurations with the same gvk, do we merge them or use the one with the highest order or it is purely addon's decision.

Maybe it's because I'm not familiar with all the inner workings of the addon-framework but what about taking all the resources with the same GVK and hashing them all to compute the specHash? The "only" concerning part I see is the "default" behaviour that you can set on ClusterManagedAddon... 🤔 A way out I see is if we add to ConfigMeta a bool value (e.g singleton) which would enable the default behaviour. So when singleton is true the addon framework will merge the default config with the ManagedClusterAddon config, otherwise it will require users to provide that config

qiujian16 commented 2 days ago

this has been done /close

openshift-ci[bot] commented 2 days ago

@qiujian16: Closing this issue.

In response to [this](https://github.com/open-cluster-management-io/addon-framework/issues/263#issuecomment-2367121017): >this has been done >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.