Skip to content

Can nodeselector schedule based on in / not in option selection enable affinity / anti - affinity #11707

Closed
@davidwalter0

Description

Can nodeselector schedule based on in / not in options?
It seems like this might enable affinity / anti - affinity?

Currently it looks like labelSelector allows set based rules and more than one predicate
from : docs/user-guide/labels.md

LIST and WATCH operations may specify label selectors to filter the sets of objects returned using a query parameter. Both requirements are permitted:

  • equality-based requirements: ?labelSelector=key1%3Dvalue1,key2%3Dvalue2
  • set-based requirements: ?labelSelector=key+in+%28value1%2Cvalue2%29%2Ckey2+notin+%28value3%29

If nodeselector had the same functionality it would enable anti-affinity/affinity placement.

If the scheduler attempted to schedule 2 instances of the application wouldn't be scheduled to the same node, because of fault tolerance or resource constraints.

apiVersion: v1
kind: Pod
metadata:
name: big-app
labels:
env: test
spec:
containers:

  • name: big-app
    image: big-app
    imagePullPolicy: IfNotPresent
    nodeSelector:
    disktype: ssd
    pods: not in [ cpu-app, big-app ]?

Metadata

Assignees

No one assigned

    Labels

    priority/backlogHigher priority than priority/awaiting-more-evidence.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions