Skip to content

KEP-4671: Add Workload API#134564

Merged
k8s-ci-robot merged 6 commits intokubernetes:masterfrom
macsko:gang_scheduling
Nov 6, 2025
Merged

KEP-4671: Add Workload API#134564
k8s-ci-robot merged 6 commits intokubernetes:masterfrom
macsko:gang_scheduling

Conversation

@macsko
Copy link
Copy Markdown
Member

@macsko macsko commented Oct 13, 2025

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR adds a Workload API based on KEP-4671. Moreover, it adds a WorkloadReference to the Pod spec.

This PR doesn't contain the gang scheduling implementation that is posted in #134722.

Which issue(s) this PR is related to:

Part of #134471
Fixes #134472
Fixes #134473
Fixes #134474
Fixes #134478

KEP: kubernetes/enhancements#4671

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Introduce scheduling.k8s.io/v1alpha1 Workload API to allow for expressing workload-level scheduling requirements and let kube-scheduler act on those.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

- [KEP]: https://github.com/kubernetes/enhancements/tree/master/keps/sig-scheduling/4671-gang-scheduling

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 13, 2025
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/apiserver area/code-generation area/kubectl area/test kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/etcd Categorizes an issue or PR as relevant to SIG Etcd. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 13, 2025
@k8s-ci-robot k8s-ci-robot added the sig/testing Categorizes an issue or PR as relevant to SIG Testing. label Oct 13, 2025
@github-project-automation github-project-automation Bot moved this to Needs Triage in SIG CLI Oct 13, 2025
@github-project-automation github-project-automation Bot moved this to Needs Triage in SIG Apps Oct 13, 2025
@macsko macsko changed the title WIP: Add Workload API WIP: KEP-4671: Add Workload API Oct 13, 2025
@dom4ha
Copy link
Copy Markdown
Member

dom4ha commented Oct 31, 2025

It looks great!
@sanposhiho @helayoty do you see anything else from the scheduler POV?

Copy link
Copy Markdown
Member

@thockin thockin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open question on impl: #134564 (review)

Otherwise this LGTM for API

metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
//
// +optional
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not common to say the name format here, even though we should. Please do.

}
}
if ref.Kind == "" {
allErrs = append(allErrs, field.Required(fldPath.Child("kind"), "must be specified"))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nit-picky: the last arg to Required() is for rare cases where more context is needed. The error message will already say "Required value".

pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath.Child("labels").Key(key),
pkg/apis/core/validation/validation.go:         el = append(el, field.Required(namePath, ""))
pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath, "must specify a volume type"))
pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath.Child("path"), ""))
pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath.Child("repository"), ""))
pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath.Child("targetPortal"), ""))
pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath.Child("iqn"), ""))
pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath.Child("secretRef"), ""))
pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath.Child("targetPortal"), ""))
pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath.Child("iqn"), ""))
pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath.Child("secretRef"), ""))
pkg/apis/core/validation/validation.go:         allErrs = append(allErrs, field.Required(fldPath.Child("secretRef", "name"), ""))
pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath.Child("targetWWNs"), "must specify either targetWWNs or wwids, but not both"))
pkg/apis/core/validation/validation.go:         allErrs = append(allErrs, field.Required(fldPath.Child("lun"), "lun is required if targetWWNs is specified"))
pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath.Child("pdName"), ""))
pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath.Child("volumeID"), ""))
pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath.Child("secretName"), ""))
pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath.Child("name"), ""))
pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath.Child("key"), ""))
pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath.Child("path"), ""))
pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath.Child("claimName"), ""))
pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath.Child("server"), ""))
pkg/apis/core/validation/validation.go:     allErrs = append(allErrs, field.Required(fldPath.Child("path"), ""))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, changed to empty arg

}
}
if ref.Name == "" {
allErrs = append(allErrs, field.Required(fldPath.Child("name"), "must be specified"))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

Copy link
Copy Markdown
Member

@sanposhiho sanposhiho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sanposhiho @helayoty do you see anything else from the scheduler POV?

Only one point from me: #134564 (comment)

// When set, it cannot be changed.
//
// +optional
ControllerRef *TypedLocalObjectReference
Copy link
Copy Markdown
Member

@alvaroaleman alvaroaleman Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this redundant with metadata.OwnerRef with Controller: true?


// PodGroupPolicy defines the scheduling configuration for a PodGroup.
type PodGroupPolicy struct {
// Basic specifies that the pods in this group should be scheduled using
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we usually use a discriminator like a type field for enums, especially if there are members that have no settings? E.G. in deployment.spec.strategy there is a type

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #134564 (comment). The decision was to remove this field

@thockin
Copy link
Copy Markdown
Member

thockin commented Nov 3, 2025

/approve for API

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: erictune, macsko, thockin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@SergeyKanzhelev
Copy link
Copy Markdown
Member

lgtm from sig node. Looking forward for more feedback on this and follow ups

@macsko
Copy link
Copy Markdown
Member Author

macsko commented Nov 4, 2025

/hold
For gang scheduling implementation to be approved (#134722)

@wojtek-t
Copy link
Copy Markdown
Member

wojtek-t commented Nov 4, 2025

The implementation part is formally approved too now:
#134722 (review)

@macsko - can you please rebase this PR so that we can merge it?

@wojtek-t
Copy link
Copy Markdown
Member

wojtek-t commented Nov 6, 2025

Tagging and unholding based on approval from SIG scheduling TLs on the implementation PR:
#134722 (review)

/lgtm
/hold cancel

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: cbce30a3aa15b504deb8b5b319c9641309378cb8

@dom4ha
Copy link
Copy Markdown
Member

dom4ha commented Nov 6, 2025

/lgtm

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: d6f4b6c5437819f682404c26403942f4c1f97dcf

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

@macsko: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubernetes-apidiff-client-go 54b6ab6 link false /test pull-kubernetes-apidiff-client-go
pull-kubernetes-e2e-kind-alpha-beta-features 54b6ab6 link false /test pull-kubernetes-e2e-kind-alpha-beta-features

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-review Categorizes an issue or PR as actively needing an API review. approved Indicates a PR has been approved by an approver from all required OWNERS files. area/apiserver area/code-generation area/kubectl area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/etcd Categorizes an issue or PR as relevant to SIG Etcd. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

Status: API review completed, 1.35
Archived in project
Archived in project
Archived in project