Skip to content

Unclear behaviour of selector field in ExtendedDaemonSet/ExtendedDaemonSetReplicaSet #100

@syndicut

Description

@syndicut

Describe the bug
ExtendedDaemonSet has selector field: https://github.com/DataDog/extendeddaemonset/blob/main/api/v1alpha1/extendeddaemonset_types.go#L22 , which states:

	// A label query over pods that are managed by the daemon set.
	// Must match in order to be controlled.
	// If empty, defaulted to labels on Pod template.
	// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors

This field is only used to initialize new ers:
https://github.com/DataDog/extendeddaemonset/blob/main/controllers/extendeddaemonset/controller.go#L528
In ers it is used to match with node (not pod) labels:
https://github.com/DataDog/extendeddaemonset/blob/main/controllers/extendeddaemonsetreplicaset/controller.go#L351
Not sure what the difference with specifying nodeSelector in spec.template.spec
It is also get printed in listing as "NODE SELECTOR":
https://github.com/DataDog/extendeddaemonset/blob/main/api/v1alpha1/extendeddaemonsetreplicaset_types.go#L118
Questions:

  1. Does comment of this field needs updating? It states a label query over pods, being query over nodes instead?
  2. What is the correct way to limit EDS pods to nodes with certain labels? (analog to spec.template.spec.nodeSelector in regular daemonset)

To Reproduce
Steps to reproduce the behavior:

  1. Add node query to selector field in EDS
  2. Pods are being scheduled on nodes using specified query

Expected behavior

  1. Selector is used for querying pods
  2. Nodes are queried using spec.template.spec.nodeSelector
  3. spec.template.spec.nodeSelector get printed as "NODE SELECTOR" in ers listing

Environment (please complete the following information):

  • Kubernetes version: 1.20.2
  • Kubernetes distribution: vanilla bare metal

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