Bug 1462543 - operator Gt, Lt are expected to support for pod affinity
operator Gt, Lt are expected to support for pod affinity
Product: OpenShift Container Platform
Classification: Red Hat
Component: Pod (Show other bugs)
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Avesh Agarwal
DeShuai Ma
Depends On:
  Show dependency treegraph
Reported: 2017-06-18 13:12 EDT by Weihua Meng
Modified: 2017-06-19 17:30 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2017-06-19 17:30:52 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Weihua Meng 2017-06-18 13:12:51 EDT
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

Version-Release number of selected component (if applicable):
openshift v3.6.114
kubernetes v1.6.1+5115d708d7

How reproducible:

Steps to Reproduce:
1. $ oc create -f pod-pod-affinity-gt-3.yaml
$ cat pod-pod-affinity-gt-3.yaml
apiVersion: v1
kind: Pod
  name: pod-affinity-gt-3
      - labelSelector:
          - key: team
            operator: Gt
            - "3"
        topologyKey: kubernetes.io/hostname
  - 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.
Comment 1 Avesh Agarwal 2017-06-19 16:53:05 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.