Skip to content

test: add workload scheduler documentation and end-to-end coverage - #3116

Draft
Rajadi16 wants to merge 10 commits into
kubeflow:masterfrom
Rajadi16:kep-2962/docs-e2e
Draft

Rajadi16 wants to merge 10 commits into
kubeflow:masterfrom
Rajadi16:kep-2962/docs-e2e

Conversation

@Rajadi16

Copy link
Copy Markdown

Important

Stacked PR — depends on #3113, which depends on #3093.

Please review and merge #3093 first, followed by #3113. Do not merge this PR before #3113.
Until the earlier PRs land, this PR intentionally shows the cumulative PR1 + PR2 + PR3 diff.

Part of #2962.

Stack

  1. feat(api): add MinMember configuration for workload scheduling #3093 — API types, validation, RBAC, CRDs, and generated API artifacts
  2. feat(scheduler): add Kubernetes-native Workload/PodGroup backend #3113 — Kubernetes-native Workload/PodGroup scheduler implementation
  3. This PR — documentation, example, CI, and end-to-end coverage

Purpose of this PR

Documents the Kubernetes-native workload batch-scheduler backend and adds end-to-end coverage proving that executor pods are gang-scheduled through scheduling.k8s.io/v1alpha2.

Proposed changes:

  • Add a workload scheduler user guide and link it from the user-guide index.

  • Add a Spark Pi example configured with batchScheduler: workload.

  • Add a Kubernetes 1.36.1 Kind configuration with the required workload-scheduling feature gates.

  • Add a dedicated workload scheduler integration job to GitHub Actions.

  • Add a labeled end-to-end test that verifies:

    • one application-owned Workload
    • one application-owned PodGroup per submission
    • executor-only PodGroup membership
    • the configured minimum member count
    • no partial executor binding when insufficient placement is available
    • atomic binding of the complete executor gang
  • Allow additional Ginkgo arguments through E2E_TEST_ARGS.

  • Add a per-node containerd import fallback for Docker/Kind multi-platform Spark image-loading failures.

Prerequisites

The backend requires a cluster serving scheduling.k8s.io/v1alpha2 with:

  • GenericWorkload enabled on kube-apiserver and kube-scheduler
  • GangScheduling enabled on kube-scheduler

The v1alpha2 API is available in Kubernetes 1.36. These features are alpha and disabled by default.

If batchSchedulerOptions.priorityClassName is used, Kubernetes’ alpha WorkloadAwarePreemption feature gate must also be enabled on kube-apiserver and kube-scheduler.

Change Category

  • Bugfix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that could affect existing functionality)
  • Documentation update

Rationale

This final layer of the stack provides user-facing guidance and end-to-end proof for the scheduler implementation introduced by #3113. It also makes local and CI image loading resilient to the Docker/Kind multi-platform import failure encountered while exercising the feature.

Checklist

  • I have conducted a self-review of my own code.
  • I have updated documentation accordingly.
  • I have added tests that prove my changes are effective or that my feature works.
  • Existing unit tests pass locally with my changes.

Verification

  • make docs-test
  • make go-fmt
  • make go-vet
  • make go-lint
  • End-to-end package compilation
  • Workload-labeled E2E on a fresh Kubernetes 1.36.1 Kind cluster
  • E2E result: 1 passed, 0 failed, 23 skipped
  • Negative-control run confirmed that an incorrect PodGroup minimum fails the test
  • Docker/Kind Spark image-loading fallback tested on every Kind node
  • git diff --check
  • All commits include Signed-off-by

Additional Notes

This PR targets upstream master because the PR2 branch exists only in the contributor fork. After #3093 and #3113 merge, this branch will be rebased onto the updated upstream master so the earlier stack changes disappear from this PR’s diff.

@google-oss-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nabuskey for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@github-actions

Copy link
Copy Markdown

🎉 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!
Thanks again for contributing to Kubeflow! 🙏

Add optional MinMember configuration with a minimum of one. Apply shared workload validation and queue warnings to SparkApplication and ScheduledSparkApplication templates.

Require both batch scheduler and workload enablement for native scheduling RBAC. Include webhook and Helm tests and regenerated API artifacts. Keep PodGroup binding metadata outside the public Spark API; defer executor-count upper-bound validation to the backend.

Part of kubeflow#2962

Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Create Kubernetes Workload and PodGroup resources for Spark applications, apply gang scheduling to executor pod templates using native Kubernetes scheduling fields, and preserve ephemeral submission metadata.

Part of kubeflow#2962

Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
…mber

- Add getInt32FromSparkConf helper to extract numeric values from SparkConf
- Update GetInitialExecutorNumber to check SparkConf for executor counts when typed fields are not set
- Support spark.executor.instances, spark.dynamicAllocation.initialExecutors, and spark.dynamicAllocation.minExecutors
- Prefer typed field values over SparkConf values for backward compatibility
- Add comprehensive test coverage for fixed, dynamic, and mixed configuration modes
- Handle malformed values gracefully by ignoring invalid SparkConf entries

Fixes the issue where applications specifying executor counts only via SparkConf
would be incorrectly sized by the workload scheduler, potentially causing valid
minMember configurations to be rejected.

Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
- Document the zero-executor clamping behavior (min of 1)
- Clarify that minMember validation happens in backend, not admission
- Explain the upper-bound check against resolved executor count
- Document quorum-based scheduling use case for smaller overrides
- Note that without override, all executors must be schedulable

Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Added test coverage for:
- SparkConf fixed count with and without minMember override
- SparkConf fixed count with smaller override (quorum scheduling)
- SparkConf-only dynamic allocation with distinct initial/min/instances
- Mixed typed and SparkConf configurations (typed preferred)
- Invalid SparkConf values defaulting to 1
- Combined typed DRA and SparkConf initial executors
- Precedence verification between typed fields and SparkConf

These tests ensure the workload scheduler correctly resolves executor
counts from all configuration sources and validates minMember constraints
against the effective initial executor count.

Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
- Remove orphaned 'Copy custom SchedulingGroup' comments from submission.go
  (the code these described was removed when custom Spark scheduling fields were dropped)
- Update controller.go comment to accurately describe native executor-template membership
  (spec.executor.template.spec.schedulingGroup.podGroupName) populated by workload scheduler
- Clarify that operator-generated state belongs to the temporary submission copy
- Remove outdated webhook rejection claim (custom fields no longer exist to be rejected)

Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Document the Kubernetes-native workload scheduler and add a Spark Pi example demonstrating its configuration.

Add a Kubernetes 1.36 Kind and Helm test that verifies Workload and PodGroup ownership, executor-only membership, and atomic gang binding.

Handle Docker and Kind multi-platform Spark image loading failures with a per-node containerd import fallback.

Part of kubeflow#2962

Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>
Corrected discovery timing and behavior:
- API discovery occurs when backend is invoked, not at startup
- Discovery failures affect individual reconciliation, not controller startup

Updated scheduling membership description:
- Document native path: spec.executor.template.spec.schedulingGroup.podGroupName
- Clarify operator populates this on temporary submission copy
- Remove outdated custom field paths (spec.driver/executor.schedulingGroup)

Improved validation and sizing documentation:
- Split admission (lower-bound) and backend (upper-bound) validation
- Document SparkConf-based executor sizing support
- Explain typed field preference over SparkConf values
- Updated dynamic allocation to include SparkConf alternatives

Clarified resource lifecycle:
- Explain Workload policy conflict behavior
- Note that deleting PodGroup alone doesn't fix retained Workload conflicts

Updated queue warning description:
- Specify warning occurs when workload backend is explicitly selected

Signed-off-by: Rajadi16 <rajputadityasingh2407@gmail.com>

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants