-
Notifications
You must be signed in to change notification settings - Fork 41.1k
Open
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.Categorizes an issue or PR as relevant to SIG API Machinery.sig/appsCategorizes an issue or PR as relevant to SIG Apps.Categorizes an issue or PR as relevant to SIG Apps.triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
Description
What happened?
Pod node affinity with empty NodeSelectorTerm
, result in pod Pending
.
apiVersion: v1
kind: Pod
metadata:
name: with-node-affinity
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- {}
containers:
- name: with-node-affinity
image: nginx:1.7.9
k apply -f pod.yaml
k get po
NAME READY STATUS RESTARTS AGE
with-node-affinity 0/1 Pending 0 5m3s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 2m52s default-scheduler 0/3 nodes are available: 3 node(s) didn't match Pod's node affinity/selector. preemption: 0/3 nodes are available: 3 Preemption is not helpful for scheduling..
What did you expect to happen?
Empty NodeSelectorTerm
represents no selector, should select all nodes available.
Or empty NodeSelectorTerm
should not be allowed in pod.nodeAffinity.
How can we reproduce it (as minimally and precisely as possible)?
See above yaml.
Kubernetes version
$ kubectl version
Client Version: v1.30.0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.30.0
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.Categorizes an issue or PR as relevant to SIG API Machinery.sig/appsCategorizes an issue or PR as relevant to SIG Apps.Categorizes an issue or PR as relevant to SIG Apps.triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
Type
Projects
Status
Needs Triage