Bug 1462543 - operator Gt, Lt are expected to support for pod affinity
Summary: operator Gt, Lt are expected to support for pod affinity
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Node
Version: 3.6.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Avesh Agarwal
QA Contact: DeShuai Ma
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-06-18 17:12 UTC by Weihua Meng
Modified: 2017-06-19 21:30 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-06-19 21:30:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Weihua Meng 2017-06-18 17:12:51 UTC
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.

Comment 1 Avesh Agarwal 2017-06-19 20:53:05 UTC
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.