Skip to content

Feature: Support resource reservation - #4323

Open
LegGasai wants to merge 36 commits into
volcano-sh:masterfrom
LegGasai:support_resource_reservation
Open

Feature: Support resource reservation#4323
LegGasai wants to merge 36 commits into
volcano-sh:masterfrom
LegGasai:support_resource_reservation

Conversation

@LegGasai

@LegGasai LegGasai commented May 27, 2025

Copy link
Copy Markdown

What type of PR is this?

/kind feature

What this PR does / why we need it:

Support resource reservation.
Phase 1: Resource Reservation
The reservation task goes through the complete scheduling logic but does not perform an actual pod bind. Instead, it reserves resources on the target node, updates the reservation cache, and modifies the Reservation custom resource (CR) status.

Phase 2: Reservation Scheduling
Tasks that use the reserved resources require special handling during allocate action — they are directly bound to the reserved node. Additionally, the reservation cache and the Reservation CR status are updated accordingly.

Design docs: #4148
Test/User docs:https://c05j6bovqhh.feishu.cn/docx/EDHLdozMTohoBoxIqWtcwwaqnMf

Related PR:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

There are some issues to optimize:

  • Write PodGroup for reservation to scheduler cache
  • Move some fields to ReservationContext
  • Asynchronous processing for bind operations of reservation tasks.
  • PostBind: Refer to pkg/scheduler/plugins/predicates/predicates.go and move reservation logic to reservation plugin to decouple
  • TTL mechanism
  • Move Reservation CRD to pkg/apis/scheduling
  • Support specifying multiple target nodes during reservation, with the final decision made by the scheduler.
  • Decouple reservation tasks in allocating and binding

Due to the addition of new CRDs, keeping the descriptions would cause the YAML file to exceed the size limit. Therefore, the following is used:
$(CONTROLLER_GEN) $(CRD_OPTIONS_EXCLUDE_DESCRIPTION)

Does this PR introduce a user-facing change?


@volcano-sh-bot volcano-sh-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label May 27, 2025
@LegGasai LegGasai changed the title Feature: Support resource reservation [WIP]: Feature: Support resource reservation May 27, 2025
@volcano-sh-bot volcano-sh-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 27, 2025
@volcano-sh-bot volcano-sh-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 28, 2025
@volcano-sh-bot volcano-sh-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 28, 2025
@LegGasai

Copy link
Copy Markdown
Author

/assign @Monokaix

@volcano-sh-bot volcano-sh-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 1, 2025
@volcano-sh-bot volcano-sh-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 1, 2025
@volcano-sh-bot volcano-sh-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 6, 2025
@volcano-sh-bot volcano-sh-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 8, 2025
@volcano-sh-bot volcano-sh-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Jun 22, 2025
@volcano-sh-bot volcano-sh-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 21, 2025
@volcano-sh-bot volcano-sh-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 24, 2025
Signed-off-by: leggasai <jyc132780208@sina.com>
@volcano-sh-bot volcano-sh-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 7, 2025
@volcano-sh-bot volcano-sh-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 27, 2025
@volcano-sh-bot

Copy link
Copy Markdown
Contributor

@LegGasai: PR needs rebase.

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/test-infra repository.

Signed-off-by: leggasai <jyc132780208@sina.com>
Copilot AI review requested due to automatic review settings December 28, 2025 12:38
@volcano-sh-bot

Copy link
Copy Markdown
Contributor

Adding label do-not-merge/contains-merge-commits because PR contains merge commits, which are not allowed in this repository.
Use git rebase to reapply your commits on top of the target branch. Detailed instructions for doing so can be found here.

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/test-infra repository.

@volcano-sh-bot

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 ask for approval from monokaix. 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

Signed-off-by: leggasai <jyc132780208@sina.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR implements resource reservation functionality in the Volcano scheduler, enabling users to pre-reserve cluster resources for later use by specific workloads.

Key Changes:

  • Adds reservation plugin and action to handle resource reservation lifecycle
  • Implements reservation cache for tracking and managing reservations
  • Introduces reserve action between enqueue and allocate in the scheduling pipeline
  • Adds new Reservation CRD and RBAC permissions

Reviewed changes

Copilot reviewed 46 out of 51 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/scheduler/plugins/reservation/reservation.go New reservation plugin implementing validation, node selection, and bind lifecycle hooks
pkg/scheduler/actions/reserve/reserve.go New reserve action to swap reservation tasks with actual workload tasks
pkg/scheduler/cache/reservation_cache.go Cache management for reservations including TTL expiration and status synchronization
pkg/scheduler/framework/statement.go Added UnAllocateForReservationTask to support reservation resource handover
pkg/scheduler/framework/session.go Helper functions for matching and validating reservations against jobs
pkg/scheduler/cache/interface.go Extended cache interface with PostBinder and reservation methods
installer/volcano-development.yaml CRD definitions and RBAC for the Reservation resource
config files Configuration updates to enable the reservation plugin and action
Comments suppressed due to low confidence (5)

pkg/scheduler/plugins/reservation/reservation.go:1

  • Corrected spelling of 'aruguments' to 'arguments'.
    pkg/scheduler/framework/session.go:1
  • Empty line 1235 should be removed to improve code readability. The empty line between the condition check and return statement is unnecessary.
    pkg/scheduler/cache/util.go:1
  • The function name 'tolerationKey' is inconsistent with its internal usage where it's referenced as 'generateTolerationKey' in the comment on line 156. Consider renaming to 'generateTolerationKey' to match the documentation.
    pkg/scheduler/cache/event_handlers.go:1
  • The variable name changed from 'podgroup' (line 849) to 'podgroup' (line 854 in original) but the pattern is inconsistent with line 928 where it uses 'PodGroup' in the struct literal. Consider using consistent naming throughout.
    pkg/scheduler/cache/reservation_cache.go:1
  • Grammatical error in message text. 'have be allocated' should be 'have been allocated'.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread go.mod
Comment on lines +55 to +56
//volcano.sh/apis v1.12.3-0.20250922071132-1aeba4dd588f
volcano.sh/apis v0.0.0

Copilot AI Dec 28, 2025

Copy link

Choose a reason for hiding this comment

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

Using version v0.0.0 is not a standard practice for Go module dependencies. This appears to be a placeholder that should be replaced with an actual version before merging.

Suggested change
//volcano.sh/apis v1.12.3-0.20250922071132-1aeba4dd588f
volcano.sh/apis v0.0.0
volcano.sh/apis v1.12.3-0.20250922071132-1aeba4dd588f

Copilot uses AI. Check for mistakes.
Signed-off-by: leggasai <jyc132780208@sina.com>
Signed-off-by: leggasai <jyc132780208@sina.com>
Signed-off-by: leggasai <jyc132780208@sina.com>
@hwdef

hwdef commented Aug 13, 2026

Copy link
Copy Markdown
Member

/cc

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

Labels

do-not-merge/contains-merge-commits kind/feature Categorizes issue or PR as related to a new feature. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants