Skip to content

Adding Semver comparison operators for both NodeAffinity and Tolerations #5721

@galal-hussein

Description

@galal-hussein

Enhancement Description

Currently, Kubernetes tolerations and NodeAffinity rules lack semantic versioning support. This feature will allow filtering based on semver ranges (e.g., >=v1.26.0) by adding new comparison operators:

  • SemverLt
  • SemverGt
  • SemverEq

This enables clean support for firmware checks, Kubernetes version preferences, and other semver-based scheduling use cases.

Examples

Tolerations

tolerations:
  - key: "node.kubernetes.io/kubelet-version"
    operator: "SemverGt"
    value: "v1.28.0"

NodeAffinity

nodeAffinity:
  requiredDuringSchedulingIgnoredDuringExecution:
    nodeSelectorTerms:
      - matchExpressions:
          - key: "kubeletVersion"
            operator: "SemverEq"
            values: ["v1.28.0"]

Background

Current KEP #5471 focuses on integer operators only compliance for SLA/failure-probability for tolerations by adding Gt and Lt operators. Similarly this enhancement will involve parsing semantic versioning and using the new operators to support various scenarios, for example:

  • Comparing node kubelet versions (e.g., feature gating)
  • Firmware version targeting for device scheduling

/sig scheduling
/sig apps

  • One-line enhancement description (can be used as a release note): Add Semantic Version Comparison operators to Tolerations and NodeAffinity.
  • Discussion Link:
  • PRs by stage and milestone:
    • Alpha - v1.xx
      • KEP (k/enhancements) update PR(s):
      • Code (k/k) update PR(s):
      • Docs (k/website) update PR(s):

Please keep this description up to date. This will help the Enhancement Team to track the evolution of the enhancement efficiently.

Metadata

Metadata

Assignees

Labels

sig/appsCategorizes an issue or PR as relevant to SIG Apps.sig/schedulingCategorizes an issue or PR as relevant to SIG Scheduling.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

Status

Needs Triage

Status

Needs Triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions