Description
Currently only one custom or external metrics server in the cluster is supported (because there can be only one APIService
resouce specified), as already discussed in #3 in #68. This way users are not able use multiple projects that are consuming this framework, eg. KEDA, k8s-prometheus-adapter or Datadog etc.
I was thinking about options how to solve this and I'd like to propose, that we will introduce aggregator
and child
components.
aggregator
- that's basically the adapter that we have today (ie. it is responsible for communication with k8s api server,APIService
registration etc). + additional functionality: it registerschild
components as they are added in the cluster, transferring the requests for particular metrics to the child components and will maintain a cache of metrics that are provided by individualchilds
(which could always fall back to callingListMetrics()
on eachchild
).
Could either use:- a new controller + CRD to register new
child
components and forward the REST call - use grpc for communication between
aggregator
&child
, this way thechild
components could register themselves in theaggregator
(by initializing the connection) and we won't need a controller and CRD for this part
- a new controller + CRD to register new
child
- very lightweight component, that's transferring the metrics to theaggregator
, user will just have to implement the interfaces
With this approach, in the cluster there will be one aggregator
component which will transfer requests to the individual child
. Individual projects, that are consuming this framework, will have to just implement the child
. If grpc is used, the whole communication could be pretty simple and we can even include this change into the existing codebase and allow some mixed scenario, where aggregator
could provide some metrics as well, but I'd like to avoid this scenario.
What do you think about this proposal? Do you think that this is something that could be acceptable by this project? I can elaborate more (and formalize the proposal), if I see an interest in this.
And yeah, I can contribute this 😄