Skip to content
This repository was archived by the owner on Sep 1, 2026. It is now read-only.
This repository was archived by the owner on Sep 1, 2026. It is now read-only.

Support additional PodSpec fields via optional overlay #217

Open

Description

@yurmix

The current DruidNodeSpec interface does not expose the full range of Kubernetes v1.PodSpec fields, which number over 40. Exposing all of them explicitly is impractical and would lead to an overly complex CRD.

However, there are valid use cases for customizing unmanaged PodSpec fields—such as setting dnsPolicy, dnsConfig, priorityClassName, hostAliases, and others—that are currently unsupported.

This proposal introduces a mechanism to support these use cases without overcomplicating the existing API:
1. Add an optional field AdditionalPodSpec *v1.PodSpec to both DruidSpec and DruidNodeSpec.
2. During reconciliation, non-nil fields from additionalPodSpec are merged into the generated PodSpec. Only fields not already managed by the operator are eligible for merge.
2.1. If a field in additionalPodSpec conflicts with a field already managed by the operator (via DruidNodeSpec), the operator will return an error to avoid silent misconfiguration.
3. DruidSpec.additionalPodSpec defines global defaults across all node types, and DruidNodeSpec.additionalPodSpec overrides those values for specific node roles.
3.1. The merge logic is shallow: individual fields from DruidNodeSpec.additionalPodSpec override corresponding fields from DruidSpec.additionalPodSpec.

This pattern maintains separation of concerns while offering flexibility for advanced users who need finer control over pod-level configuration.

Activity

  1. AdheipSingh commented on Mar 30, 2025

    @AdheipSingh
    Contributor

    +1. Feel free to raise a PR.

  2. yurmix commented on Apr 1, 2025

    @yurmix
    ContributorAuthor

    @AdheipSingh additional thought:

    Regarding the CR modification,
    I’m considering following the pattern used by built-in workload controllers (e.g. StatefulSet, Deployment) by introducing a .template field of type PodTemplateSpec.

    This would allow users to specify the full PodSpec in a familiar format:

    spec:
      template:
        metadata:        # <-- Not currently supported
          labels:
            app: my-app
        spec:            # <-- This is the actual PodSpec (containers, volumes, etc.)
          containers:
          - name: ...
            image: ...
    type DruidNodeSpec struct {
      // ...
      Template v1.PodTemplateSpec `json:"template,omitempty"`
      // ...
    }

    Initially, we can document that template.metadata is not supported and enforce that by validating and rejecting CRs that include it. This gives us flexibility to introduce support for it later, once we can determine how to safely merge it with the operator’s own label/annotation logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions