Skip to content

feat: support pod spec field "enableServiceLinks" (PR included) #7383

@zoglam

Description

@zoglam

Component(s)

Prometheus, AlertManager, ThanosRuler

What is missing? Please describe.

Add the ability to set a enableServiceLinks parameter of pod spec
https://kubernetes.io/docs/tutorials/services/connect-applications-service
https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#pod-v1-core

EnableServiceLinks indicates whether information about services should be injected into pod's environment variables, matching the syntax of Docker links. Optional: Defaults to true.

I saw the issue "How can the CRDs offer more flexibility/control for the pod template spec?#4691" and understood that a flexible way to extend CRD won't be ready soon.

In Kubernetes namespaces with ~1000+ services, there are problems starting the Prometheus binary(also for neighbors) because injected environment variables become too long due to enableServiceLinks=true, exceeding the ARG_MAX limit in Linux.

For example: bash: /bin/<name>: Argument list too long

I propose a small patch to allow overriding the enableServiceLinks value in the pod spec, such as setting it to false.

Describe alternatives you've considered.

We can work around it using mutating hooks, but this creates many dependencies to work with prometheus-operator

Pull request

#7384

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions