Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support setting affinity items #200

Closed
consideRatio opened this issue Jul 2, 2018 · 1 comment
Closed

Support setting affinity items #200

consideRatio opened this issue Jul 2, 2018 · 1 comment

Comments

@consideRatio
Copy link
Member

consideRatio commented Jul 2, 2018

We should support setting nodeAffinity, podAffinity, podAntiAffinity, and preferred/required for each.

  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution: # nodeSelector
        nodeSelectorTerms: #
        # logical AND of the items below
        - matchExpressions:
          # local OR of the items below
          - key: kubernetes.io/e2e-az-name
            operator: In
            values:
            - e2e-az1
            - e2e-az2
      preferredDuringSchedulingIgnoredDuringExecution:
      # fullfilled weights summed over and compared in between nodes
      - weight: 1
        preference:
          matchExpressions:
          # local OR of the items below
          - key: another-node-label-key
            operator: In
            values:
            - another-node-label-value

    podAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
      # logical AND of the items below
      - labelSelector:
          matchExpressions:
          # logical OR of the items below
          - key: security
            operator: In
            values:
            - S1
        topologyKey: failure-domain.beta.kubernetes.io/zone
      preferredDuringSchedulingIgnoredDuringExecution:
      # sum the weights for each node and compare
      - weight: 100
        podAffinityTerm:
          labelSelector:
            matchExpressions:
            - key: security
              operator: In
              values:
              - S2
          topologyKey: kubernetes.io/hostname

    # Exactly the same fields etc as podAffinity
    podAntiAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
      - labelSelector:
          matchExpressions:
          - key: app
            operator: In
            values:
            - store
        topologyKey: "kubernetes.io/hostname"
      preferredDuringSchedulingIgnoredDuringExecution:
      - weight: 100
        podAffinityTerm:
          labelSelector:
            matchExpressions:
            - key: security
              operator: In
              values:
              - S2
          topologyKey: kubernetes.io/hostname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant