feat(scheduler): add Kubernetes-native Workload/PodGroup backend - #3113
Open
Rajadi16 wants to merge 18 commits into
Open
feat(scheduler): add Kubernetes-native Workload/PodGroup backend#3113Rajadi16 wants to merge 18 commits into
Rajadi16 wants to merge 18 commits into
Conversation
…load scheduling Adds the preparatory API surface for the upcoming native Kubernetes Workload/PodGroup (scheduling.k8s.io/v1alpha2) batch-scheduler backend. No user-facing behavior change in this release — the workload scheduler name is not yet registered. Changes: - api/v1beta2: Add PodSchedulingGroup type and SchedulingGroup field on SparkPodSpec, plus MinMember field on BatchSchedulerConfiguration. SchedulingGroup is operator-managed (set by the workload scheduler backend); MinMember is an optional user override for the gang minCount. - internal/webhook: Add validateWorkloadSchedulerFields() that rejects user-set schedulingGroup fields and emits a warning when batchSchedulerOptions.queue is set with batchScheduler=workload (queue has no effect on the Workload API). Table-driven unit tests included. - charts: Add scheduling.k8s.io RBAC rule (workloads, podgroups) gated on new controller.batchScheduler.workload.enable Helm value (default false). - Generated: deepcopy, CRD schemas (both SparkApplication and ScheduledSparkApplication), OpenAPI spec, Python SDK models. Part of kubeflow#2962 Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Part of kubeflow#2962 Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Regenerate the Helm chart CRDs and API reference documentation for the workload scheduling API fields. Part of kubeflow#2962 Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Require a positive minMember, reject values above the initial executor gang size for the workload scheduler, and synchronize API documentation and generated artifacts. Part of kubeflow#2962 Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Upgrade Kubernetes dependencies from v0.35.4 to v0.36.0 to access the scheduling.k8s.io/v1alpha2 API (Workload and PodGroup resources) required for the workload scheduler implementation. Changes: - k8s.io/api: v0.35.4 -> v0.36.0 - k8s.io/apimachinery: v0.35.4 -> v0.36.0 - k8s.io/client-go: v0.35.4 -> v0.36.0 - k8s.io/apiserver: v0.35.4 -> v0.36.0 - k8s.io/apiextensions-apiserver: v0.35.4 -> v0.36.0 - k8s.io/component-base: v0.35.4 -> v0.36.0 - k8s.io/code-generator: v0.35.4 -> v0.36.0 - All replace directives updated to v0.36.0 Note: K8s 1.36 APIs require Go 1.26+. Dockerfile and go.mod Go version will be updated in subsequent commit. Part of kubeflow#2962 Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
K8s 1.36 APIs require Go 1.26 or later. Update both Dockerfile and go.mod to meet this requirement. Changes: - Dockerfile: golang:1.25.11 -> golang:1.26 - go.mod: go 1.25.0 -> go 1.26.0 - go.mod: toolchain go1.25.11 -> toolchain go1.26 Part of kubeflow#2962 Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
controller-runtime v0.23.x pairs with K8s v0.35 (client-go v0.35). For K8s v0.36 compatibility, controller-runtime v0.24.x is required. Upgraded: - sigs.k8s.io/controller-runtime: v0.23.3 -> v0.24.1 - github.com/onsi/ginkgo/v2: v2.27.2 -> v2.27.4 (transitive) - github.com/onsi/gomega: v1.38.2 -> v1.39.0 (transitive) Part of kubeflow#2962 Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Run 'make manifests' to regenerate CRDs and OpenAPI code against the upgraded K8s v0.36.0 dependencies. Generated files updated: - api/v1alpha1/zz_generated.openapi.go - api/v1beta2/zz_generated.openapi.go - api/openapi-spec/swagger.json - config/crd/bases/*.yaml Part of kubeflow#2962 Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Include Python models and schema updates introduced by Kubernetes v0.36.0. Part of kubeflow#2962 Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Register the workload backend, propagate PodGroup references to executor pods, align the E2E module with Kubernetes v0.36.0, and add scheduler and controller tests. Part of kubeflow#2962 Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Use runtime.NewSchemeBuilder for the v1alpha1 API to maintain compatibility with controller-runtime v0.24.1. Part of kubeflow#2962 Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Pin the Go 1.26.7 builder image by digest and normalize Dockerfile line endings. Part of kubeflow#2962 Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Update generated clients, informers, deepcopy code, chart CRDs, and the code-generator tool version for Kubernetes v0.36.0. Part of kubeflow#2962 Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Keep operator-managed scheduling metadata on an ephemeral submission copy, clean up stale per-submission PodGroups before retries, validate gang sizes and submission IDs, and reject conflicting immutable scheduling objects. Document the complete Kubernetes feature-gate prerequisites and add regression coverage for ownership, policy drift, cleanup failures, and webhook-safe submission. Part of kubeflow#2962 Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
🎉 Welcome to the Kubeflow Spark Operator! 🎉 Thanks for opening your first PR! We're happy to have you as part of our community 🚀 Here's what happens next:
Join the community:
Feel free to ask questions in the comments if you need any help or clarification! |
Avoid copying the workload backend name into pod.spec.schedulerName because Kubernetes-native workload scheduling is handled by kube-scheduler's GangScheduling plugin. Preserve role-specific scheduler overrides and add regression coverage for driver and executor pods. Part of kubeflow#2962 Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Stacked PR — depends on #3093.
Please review and merge #3093 first. Do not merge this PR before #3093.
Until #3093 lands, this PR intentionally shows the cumulative PR1 + PR2 diff.
Part of #2962.
Stack
Purpose of this PR
Adds the Kubernetes-native
workloadbatch-scheduler backend usingscheduling.k8s.io/v1alpha2.Proposed changes
workloadscheduler behindcontroller.batchScheduler.workload.enable.scheduling.k8s.io/v1alpha2availability when the backend is selected.WorkloadperSparkApplicationand onePodGroupper submission.batchSchedulerOptions.minMemberwhen specified; otherwise derive the DRA-aware initial executor count and clamp it to at least one.SparkApplicationspec or rejected by the validating webhook.Ordering and webhook safety
The controller assigns a non-empty
status.submissionIDbefore scheduling; the workload scheduler also rejects an empty submission ID defensively.Scheduling mutations are applied to a deep copy passed only to the submitter. The reconciled
SparkApplicationretains no operator-managedschedulingGroupin its spec, preventing the operator from triggering PR1’s webhook rejection on a later full-object update.Prerequisites
The backend requires Kubernetes v1.36+ with:
scheduling.k8s.io/v1alpha2served by the API serverGenericWorkloadenabled on kube-apiserver and kube-schedulerGangSchedulingenabled on kube-schedulerIf
batchSchedulerOptions.priorityClassNameis used, the alphaWorkloadAwarePreemptionfeature gate must also be enabled on kube-apiserver and kube-scheduler.Compatibility note
The Kubernetes/controller-runtime upgrade also required migrating the v1alpha1 SparkConnect scheme registration from deprecated
controller-runtime/pkg/scheme.Buildertoruntime.NewSchemeBuilder.This is a compatibility-only refactor with no SparkConnect behavior change; it removes the staticcheck SA1019 failure introduced by controller-runtime v0.24.1.
The remaining broad generated-file changes are deterministic fallout from the Kubernetes v0.36.0 API and code-generator upgrade.
Change category
Verification
make generate manifestsmake verify-codegenmake build-api-docsmake detect-crds-driftmake go-fmtmake build-operatormake unit-testmake go-vetmake go-lintmake helm-unittest(230 tests)git diff --checkSigned-off-byReview note
This PR targets upstream
masterbecause the PR1 branch exists only in the contributor fork. After #3093 merges, its files should disappear from this PR’s diff.If #3093 is squash-merged, this branch will be rebased onto the updated upstream
masterto remove the PR1 commits cleanly.