open-cluster-management-io / addon-framework

addon apis
Apache License 2.0
23 stars 40 forks source link

Allow triggering addon reconciliation #96

Closed ctron closed 2 years ago

ctron commented 2 years ago

I am trying to create an addon for OCM, the goal is to deploy workload based on an external configuration.

I managed to follow the path of the "hello world" addon, deploying the "hello-world" configmap into the managed/target cluster.

However, I would like to have more dynamic workload deployed to the managed cluster. To my understanding, whatever the method Manifest of the addon returns, will be deployed on the managed cluster.

I only can't find a way, how to re-trigger this reconcile loop. So that a change in our system triggers the Manfiest function to be evaluated again, so that the new state will will rendered.

qiujian16 commented 2 years ago

currently it triggers only when addon or cluster is changed. So updating addon resource or managedcluster will retrigger the loop. In you case, do you have another resource that you would want the framework to watch and trigger?

ctron commented 2 years ago

currently it triggers only when addon or cluster is changed. So updating addon resource or managedcluster will retrigger the loop.

Right, and that is my current workaround. I trigger a change on the resource in order to trigger the reconcile loop.

In you case, do you have another resource that you would want the framework to watch and trigger?

It is an external event, so not a k8s resource.

qiujian16 commented 2 years ago

will it be helpful if the library exposes a reconcile trigger? it needs to at lease use addonName, and clusterName as input.

ctron commented 2 years ago

Yes, that would be great. IIRC the operator framework had a way to provide custom triggers. Something in that direction would make sense.