Description of problem: operator Gt, Lt are expected to support for pod affinity. docs says: operators for pod affinity and anti-affinity are In, NotIn, Exists, DoesNotExist, Gt, Lt https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#inter-pod-affinity-and-anti-affinity-beta-feature Version-Release number of selected component (if applicable): openshift v3.6.114 kubernetes v1.6.1+5115d708d7 How reproducible: Always Steps to Reproduce: 1. $ oc create -f pod-pod-affinity-gt-3.yaml $ cat pod-pod-affinity-gt-3.yaml apiVersion: v1 kind: Pod metadata: name: pod-affinity-gt-3 spec: affinity: podAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: team operator: Gt values: - "3" topologyKey: kubernetes.io/hostname containers: - name: pod-affinity image: docker.io/ocpqe/hello-pod Actual results: $ oc create -f pod-pod-affinity-gt-3.yaml The Pod "pod-affinity-gt-3" is invalid: spec.affinity.podAffinity.requiredDuringSchedulingIgnoredDuringExecution[0].matchExpressions.matchExpressions[0].operator: Invalid value: "Gt": not a valid selector operator Expected results: no error. Additional info: if replace "Gt" with "Lt", same issue. operators "In, NotIn, Exists, DoesNotExist" work as expected.
I had a discussion about it in todays's kube-sig-scheduler meeting and after discussion with David Oppenheimer@google, the conclusion was that the doc is incorrect about pod affinity/anti-affinity and they only honor regular label selector (In, NotIn, Exists, NotExists) but not Gt and Lt. Also, for node affinity/anti-affinity, it is true that they honor all label operators (In, NotIn, Exists, NotExists, Gt, Lt). So I will send a PR to fix the doc but the functonality is working as expected. I am closing this bug working as expected. Please reopen if you disagree.
https://github.com/kubernetes/kubernetes.github.io/issues/4137