metac
metac copied to clipboard
Ability to not watch attachments or child resources
@AmitKumarDas, first off - I just want to thank you for taking over ownership of this project! The work you have done is very much appreciated.
I was wondering if you can think of a way for metac to create a resource but not actually watch for changes. There is a Child resource that we are creating(via CompositeController
) that is being continually updated, which is causing a large number of requests on the metacontroller service, which is then causing delays on our controller. The child resource is HPA(horizontal Pod Autoscaler) and the current CPU utilization of the pods is being set on the status by the HPA controller every minute.
We'd like to ignore any updates to the HPA(or any child or attachment), but I don't see an option to do that in the GenericController
or the CompositeController
. I saw this issue which I think would help, but there has not been any discussion on it - https://github.com/GoogleCloudPlatform/metacontroller/issues/172
Any thoughts appreciated?
@cliffpracht thanks for explaining the issue. IMO Generic Controller should solve this very problem. It only observes for watch resource. Attachments can be any arbitrary resource. When I say arbitrary I mean the attachments can be used as read only, or can be created or updated. Again all this happens during the reconcile that was triggered due to the watch resource.
If the scenario demands us to watch an attachment specified in above Generic Controller spec then we need to define a new Generic Controller spec where this attachment kind is specified as a watch. Obviously we can have various combinations of metacontroller (s) if needed.
If you are willing you can create a new example PR against this repo that solves this scenario (perhaps with some dummy CRs) and I shall be able to review / suggest on top of the solution/PR.
Very cool! Thanks @AmitKumarDas
Hence why it is called the watch
resource vs an attachments
resource 👍
I'll give it a shot about creating an example PR. I must say I really like the option that the generic controller can be used as a library as well.. nifty!
@cliffpracht all the features were from our production needs. I am sure others will benefit from this as well.
In addition, other metacontrollers i.e. composite & decorator
can be used as library as well if we put similar code changes.