kubernetes-sigs / aws-load-balancer-controller

A Kubernetes controller for Elastic Load Balancers
https://kubernetes-sigs.github.io/aws-load-balancer-controller/
Apache License 2.0
3.88k stars 1.44k forks source link

Emit Metric for all ingresses/services that create ALB/NLBs #2908

Open drewgonzales360 opened 1 year ago

drewgonzales360 commented 1 year ago

Is your feature request related to a problem? As an operator of the controller, I'd like to know how many ingresses and services the controller is "in control of." For example if there are 4 services annotated for NLB, I want an easy way to view that.

Describe the solution you'd like Can we add a metric that the controller emits to count ingresses that it currently tracks? Can we also tag that metric with the name and namespace that the ingress/service is in?

Describe alternatives you've considered I have scripts that look through the cluster resources. I look for annotations on ingresses and services that would create an NLB. This works, but it's kinda hacky and I have to do it for every cluster.

Another thing I can do is write a service that watches for ingresses and services with the annotation and emits the metric. I would have to update it every time annotations in the aws-lb-controller change though. Then I'd deploy that to every cluster and look at metrics.

The real reason I want to do this is because I want to keep track of how widely used this is within a fleet of clusters. It's easy enough to count ingresses/services for one cluster, but doing it for over 💯 is tough. If I know that 0 NLB/ALBs are being created by the controller, I can safely uninstall the controller from a cluster where it's not being used.

I'm also happy to throw up a PR 🙏

kishorj commented 1 year ago

@drewgonzales360, this will be a good to have feature, feel free to raise a PR.

/kind feature

Sajiyah-Salat commented 1 year ago

Hello @drewgonzales360 are you working on this pr. Let me know if you are not.

drewgonzales360 commented 1 year ago

Hi sorry I have it in https://github.com/kubernetes-sigs/aws-load-balancer-controller/pull/2973 but I'm not done with it yet

omerap12 commented 3 months ago

Hey, if this still necessary I would like to work on this. @kishorj