solo-io / gloo

The Feature-rich, Kubernetes-native, Next-Generation API Gateway Built on Envoy
https://docs.solo.io/
Apache License 2.0
4.03k stars 433 forks source link

No way to expose metrics endpoint's port from Helm variables #9711

Open luismiguelsaez-steercrm opened 1 week ago

luismiguelsaez-steercrm commented 1 week ago

Gloo Edge Product

Open Source

Gloo Edge Version

v1.17.0-rc8

Is your feature request related to a problem? Please describe.

We want to scrape Prometheus metrics, but there's no way to add the port mapping to the gateway-proxy pods. Here is the current podTemplate from the Helm values

    podTemplate:
      customLivenessProbe: {}
      customReadinessProbe: {}
      disableNetBind: true
      enablePodSecurityContext: true
      fsGroup: 10101
      gracefulShutdown:
        enabled: false
        sleepTimeSeconds: 25
      httpPort: 8080
      httpsPort: 8443

Without a proper port specification in the pod, the Prometheus PodMonitor or ServiceMonitor doesn't work, as it is required.

Describe the solution you'd like

The solution would be to add the stats port to the podTemplate, like this:

    podTemplate:
      customLivenessProbe: {}
      customReadinessProbe: {}
      disableNetBind: true
      enablePodSecurityContext: true
      fsGroup: 10101
      gracefulShutdown:
        enabled: false
        sleepTimeSeconds: 25
      httpPort: 8080
      httpsPort: 8443
      statsPort: 19000

and add it to the Pod specification in the corresponding Helm template, so it is rendered as:

    ports:
    - containerPort: 8080
      name: http
      protocol: TCP
    - containerPort: 8443
      name: https
      protocol: TCP
    - containerPort: 19000
      name: stats

That way, the port can be referenced from a PodMonitor or a Service, which later can be used from a ServiceMonitor.

Describe alternatives you've considered

No response

Additional Context

No response

DuncanDoyle commented 3 days ago

@krisztianfekete Can you take a look at this and triage?

krisztianfekete commented 2 days ago

Thanks for opening the issue! Yes, the port definitions are missing and those are required for PodMonitors and ServiceMonitors. It's a simple Helm template change, would you be up for contributing this to the project? For the time being, you can scrape the pods via annotations as those are present. If you are using e.g. kube-promethues-stack, you can use additionalScrapeConfigs to provide this as a workaround.

luismiguelsaez-steercrm commented 2 days ago

Thanks for looking into it! I will prepare the PR to include that change into the templates.