-
Notifications
You must be signed in to change notification settings - Fork 14
Unclear behaviour of selector field in ExtendedDaemonSet/ExtendedDaemonSetReplicaSet #100
Description
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:
- Does comment of this field needs updating? It states a label query over pods, being query over nodes instead?
- 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:
- Add node query to selector field in EDS
- Pods are being scheduled on nodes using specified query
Expected behavior
- Selector is used for querying pods
- Nodes are queried using spec.template.spec.nodeSelector
- 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