Skip to content

Support affinity, tolerations, and nodeSelector in PodTemplate #293

@touch-dev-null

Description

@touch-dev-null

What would you like to be added?

Add scheduling fields (affinity, tolerations, nodeSelector) to the PodTemplate spec, as discussed in #175.

In #175, the decision was to start with PodTemplate.Metadata (labels/annotations) and expand later:

"Noting that later, we can add a new field Spec under PodTemplate, and allow the user to override items from the Pod Spec." — @ivanvc

I'd like to request adding at minimum:

  • affinity (for pod anti-affinity — spreading etcd members across nodes)
  • tolerations
  • nodeSelector

Why is this needed?

For production etcd clusters, pod anti-affinity is essential to ensure etcd members run on different nodes. Without it, a single node failure can take down multiple etcd members and break quorum.

Example desired configuration:

apiVersion: operator.etcd.io/v1alpha1
kind: EtcdCluster
metadata:
  name: etcd
  namespace: ingress-apisix
spec:
  size: 3
  version: "v3.5.23"
  podTemplate:
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchExpressions:
                  - key: app.kubernetes.io/name
                    operator: In
                    values:
                      - etcd
              topologyKey: kubernetes.io/hostname
      nodeSelector:
        node-role: infra
  storageSpec:
    storageClassName: hcloud-volumes
    volumeSizeRequest: 10Gi

resources would also be a valuable addition, but scheduling fields are the most critical for production reliability.

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