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

[Feature] Leverage Affinity rather than nodeSelector to target Control Plane Nodes #2644

Closed
brownz11 opened this issue Nov 9, 2023 · 4 comments · Fixed by #2803
Closed
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@brownz11
Copy link

brownz11 commented Nov 9, 2023

Is this a BUG REPORT or FEATURE REQUEST?:

Uncomment only one, leave it on its own line:

/kind bug
/kind feature

What happened:
The current manifests use a nodeSelector to target controlplane node. Specifically an empty label. Some distributions may leverage other labels, or populate the label value. This causes the pods to not get scheduled.

What you expected to happen:
The pods to be scheduled to control plane nodes.

How to reproduce it (as minimally and precisely as possible):
Label controlplane nodes with "node-role.kubernetes.io/control-plane=true" rather than empty.

Anything else we need to know?:
An easy fix, and what I've seen in other projects, as well as tested on my clusters is to remove the nodeSelector and instead add a nodeAffinity that matches the label rather than the label AND it's contents.

nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      nodeSelectorTerms:
        - matchExpressions:
            - key: node-role.kubernetes.io/control-plane
              operator: Exists
        - matchExpressions:
            - key: node-role.kubernetes.io/controlplane
              operator: Exists
        - matchExpressions:
            - key: node-role.kubernetes.io/master
              operator: Exists

Environment:

  • csi-vsphere version: 3.1.1
  • vsphere-cloud-controller-manager version: N/a
  • Kubernetes version: 1.25
  • vSphere version: N/a
  • OS (e.g. from /etc/os-release): N/a
  • Kernel (e.g. uname -a): N/a
  • Install tools: N/a
  • Others: N/a
@divyenpatel divyenpatel added the kind/feature Categorizes issue or PR as related to a new feature. label Nov 13, 2023
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 11, 2024
@vdkotkar
Copy link
Contributor

/assign vdkotkar

@chethanv28
Copy link
Collaborator

  • matchExpressions:
    - key: node-role.kubernetes.io/controlplane
    operator: Exists

This looks like additional selector with a typo. It should have been control-plane and it is already part of the selector above.

@brownz11
Copy link
Author

brownz11 commented Feb 26, 2024

It is not a typo, at least not mine. Some k8s distributions use "control-plane" other use "controlplane".

The Azure CSI driver already uses the affinity stanza provided above.

https://github.com/kubernetes-sigs/azuredisk-csi-driver/blob/bc6ce67e47376ccea4c639dadc7fb5e3feb17ad5/deploy/v1.30.0/csi-snapshot-controller.yaml#L38

And there's a lot of other projects that use the affinity explicitly to avoid this "control-plane" vs "controlplane" issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
6 participants