Skip to content

How can the CRDs offer more flexibility/control for the pod template spec? #4691

@simonpasquier

Description

@simonpasquier

We get regular requests from users to add more fields to the Prometheus, Alertmanager and Thanos Ruler CRDs. The situation is particularly acute for fields that exist in the statefulset's pod template spec.

As of today, the following pod template's fields are exposed by the CRDs:

The following fields are controlled by the operator and their values are hardcoded:

The following fields are not exposed by the CRD and not controlled by the operator:

  • activeDeadlineSeconds
  • ephemeralContainers
  • hostIPC
  • hostPID
  • hostname
  • nodeName
  • overhead
  • preemptionPolicy
  • priority (priorityClassName instead)
  • readinessGates
  • restartPolicy
  • runtimeClassName
  • setHostnameAsFQDN
  • shareProcessNamespace
  • subdomain

As we can see, we've got requests for customizing a few fields but not the majority of them.

We've discussed possible options to circumvent the problem:

  • Add new fields to the Prometheus, Alertmanager and Thanos Ruler CRDs on a case-by-case basis (e.g. the demand is backed by a legitimate scenario and no workaround exists).
    • Pros
      • First-class support by the project.
      • Easy to use and document.
    • Cons
      • Users have to convince the maintainers that the addition is worthwhile.
      • Additional burden on the maintainers who aren't necessary familiar with the details of how the field is going to be used.
  • Offer a mechanism where users could patch the template generated by the operator. This would be similar to the initContainers and containers fields but for the pod template.
    • Pros
      • Total flexibility.
      • One-time operation.
    • Cons
      • Easier for users to get things wrong. It requires deeper knowledge of the operator and it may trigger more support requests.
      • The size of the CRDs increases by a lot.
      • No guarantee that it won't break you in the future (this would be marked as experimental).
      • Redundancy with the initContainers and containers fields.
  • Use the server-side apply pattern
    • Pros
      • Aligned with the latest Kubernetes practices.
    • Cons
      • If/when the statefulset is recreated, the user changes are lost and need to be reconciled again.

cc @prometheus-operator/prometheus-operator-reviewers

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