Skip to content

Support network topology constrain with highestTierName - #4795

Merged
volcano-sh-bot merged 1 commit into
volcano-sh:masterfrom
zhaoqi612:master_tiername
Dec 17, 2025
Merged

Support network topology constrain with highestTierName#4795
volcano-sh-bot merged 1 commit into
volcano-sh:masterfrom
zhaoqi612:master_tiername

Conversation

@zhaoqi612

@zhaoqi612 zhaoqi612 commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

When submitting a job and specifying the affinity tier, users can choose either of the two methods: highestTierName or highestTierAllowed, which makes the operation more convenient.

Which issue(s) this PR fixes:

Partial fixes for #4188

Special notes for your reviewer:

@JesseStutler @wangyang0616

Example YAML for vcJob after modification

apiVersion: batch.volcano.sh/v1alpha1
kind: Job
metadata:
  name: network-topology-job
spec:
  minAvailable: 6
  schedulerName: volcano
  networkTopology:
    mode: hard
    highestTierName: "volcano.sh/hypernode"
  tasks:
    - replicas: 6
      name: "task"
      partitionPolicy:
        totalPartitions: 2
        partitionSize: 3
        minPartitions: 2
        networkTopology:
            mode: hard
            highestTierName: "volcano.sh/hypernode"
      template:
        metadata:
          name: task
        spec:
          containers:
            - image: ubuntu
              imagePullPolicy: IfNotPresent
              name: task
              resources:
                requests:
                  cpu: "2"
                  memory: 2Gi
          restartPolicy: OnFailure

Example YAML for podgroup after modification

apiVersion: scheduling.volcano.sh/v1beta1
kind: PodGroup
metadata:
  name: network-topology-podgroup
spec:
  minMember: 6
  networkTopology:
    mode: hard 
    highestTierName: "volcano.sh/hypercluster"
  subGroupPolicy: 
    - subGroupSize: 3
      minSubGroups: 2
      name: task
      labelSelector:
        matchLabels:
           volcano.sh/task-spec: task
      matchLabelKeys:
        - volcano.sh/partition-id
      networkTopology:
        mode: hard 
        highestTierName: "volcano.sh/hypernode"

@volcano-sh-bot

Copy link
Copy Markdown
Contributor

@zhaoqi612: The label(s) kind/what, kind/this, kind/pr, kind/does, kind//, kind/why, kind/we, kind/need, kind/it: cannot be applied, because the repository doesn't have them.

Details

In response to this:

What type of PR is this?

/kind

What this PR does / why we need it:

When submitting a job and specifying the affinity tier, users can choose either of the two methods: highestTierName or highestTierAllowed, which makes the operation more convenient.

Which issue(s) this PR fixes:

Fixes #4188

Special notes for your reviewer:

@JesseStutler @wangyang0616

Example YAML for vcJob after modification

apiVersion: batch.volcano.sh/v1alpha1
kind: Job
metadata:
 name: network-topology-job
spec:
 minAvailable: 6
 schedulerName: volcano
 networkTopology:
   mode: hard
   highestTierName: "volcano.sh/hypernode"
 tasks:
   - replicas: 6
     name: "task"
     partitionPolicy:
       totalPartitions: 2
       partitionSize: 3
       minPartitions: 2
       networkTopology:
           mode: hard
           highestTierName: "volcano.sh/hypernode"
     template:
       metadata:
         name: task
       spec:
         containers:
           - image: ubuntu
             imagePullPolicy: IfNotPresent
             name: task
             resources:
               requests:
                 cpu: "2"
                 memory: 2Gi
         restartPolicy: OnFailure

Example YAML for podgroup after modification

apiVersion: scheduling.volcano.sh/v1beta1
kind: PodGroup
metadata:
 name: network-topology-podgroup
spec:
 minMember: 6
 networkTopology:
   mode: hard 
   highestTierName: "volcano.sh/hypercluster"
 subGroupPolicy: 
   - subGroupSize: 3
     minSubGroups: 2
     name: task
     matchPolicy:
       - labelKey: volcano.sh/task-subgroup-id
     networkTopology:
       mode: hard 
       highestTierName: "volcano.sh/hypernode"

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 volcano-sh-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Dec 11, 2025
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @zhaoqi612, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the flexibility of network topology constraints within Volcano by introducing the highestTierName field. This allows users to define job affinity based on a more descriptive named tier, making configurations more intuitive. The changes span across API definitions, controller logic for job and podgroup management, and the core scheduler, ensuring that these new constraints are properly validated, processed, and applied during resource allocation. This enhancement provides a more user-friendly and robust mechanism for specifying network-aware scheduling requirements.

Highlights

  • Enhanced Network Topology Constraints: Introduced the highestTierName field, allowing users to specify network topology affinity using a named tier (e.g., "volcano.sh/hypernode") instead of or in addition to the numerical highestTierAllowed.
  • Mutual Exclusivity Validation: Added validation to ensure that users cannot specify both highestTierAllowed and highestTierName simultaneously within NetworkTopologySpec for both Jobs and PodGroups, preventing ambiguous configurations.
  • Scheduler Integration: The scheduler now processes highestTierName by mapping it to its corresponding numerical tier during the allocation phase, ensuring that jobs with named tier constraints are correctly scheduled within the defined network topology.
  • API and Internal Data Structure Updates: Modified internal data structures like HyperNodeInfo and ClusterInfo to store and manage tierName, along with new utility functions to build and update HyperNodes with this new field.
  • Comprehensive Testing: New test cases have been added across controllers, schedulers, and webhooks to validate the correct behavior and error handling of the highestTierName functionality under various scenarios.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the concept of tierName for network topology, allowing users to specify a symbolic name for a tier instead of a numerical highestTierAllowed. The changes involve adding a tierName field to HyperNodeInfo and related structures, updating utility functions to handle this new field, and modifying the job controller and scheduler to process highestTierName. Specifically, the scheduler now translates highestTierName to its corresponding numerical tier during allocation. Validation logic has been added to prevent simultaneous specification of highestTierAllowed and highestTierName in job and podgroup network topology configurations. Review comments highlighted a potential non-deterministic behavior in HyperNodeTierNameMap() if conflicting tierName to tier mappings exist, suggesting a warning log and consistent tier selection (e.g., minimum tier). Another comment pointed out that the job controller's createOrUpdatePodGroup function introduced a default HighestTierAllowed of 1 when networkTopology was specified without either HighestTierAllowed or HighestTierName, which could be a breaking change and was advised against for backward compatibility. Additionally, the error messages in validateNetworkTopology were improved for clarity and specificity.

Comment thread pkg/controllers/job/job_controller_actions.go
Comment thread pkg/scheduler/api/hyper_node_info.go
Comment thread pkg/webhooks/admission/podgroups/validate/validate_podgroup.go
@zhaoqi612
zhaoqi612 force-pushed the master_tiername branch 2 times, most recently from 065dcdf to f4d66cc Compare December 12, 2025 07:49
@wangyang0616

Copy link
Copy Markdown
Member

/lgtm

@volcano-sh-bot volcano-sh-bot added the lgtm Indicates that a PR is ready to be merged. label Dec 16, 2025
@wangyang0616

Copy link
Copy Markdown
Member

defer to @JesseStutler

@wangyang0616

Copy link
Copy Markdown
Member

For the matchPolicy field in SubgroupPolicy, the master branch has been updated. The PR description needs to be refreshed to reflect the latest definition. For details on the API changes, please refer to #202 #4785 .

@zhaoqi612

Copy link
Copy Markdown
Contributor Author

For the matchPolicy field in SubgroupPolicy, the master branch has been updated. The PR description needs to be refreshed to reflect the latest definition. For details on the API changes, please refer to #202 #4785 .

@zhaoqi612 zhaoqi612 closed this Dec 16, 2025
@zhaoqi612 zhaoqi612 reopened this Dec 16, 2025
@zhaoqi612

Copy link
Copy Markdown
Contributor Author

For the matchPolicy field in SubgroupPolicy, the master branch has been updated. The PR description needs to be refreshed to reflect the latest definition. For details on the API changes, please refer to #202 #4785 .

done

@wangyang0616

Copy link
Copy Markdown
Member

/lgtm
/approve

@volcano-sh-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wangyang0616

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

@volcano-sh-bot volcano-sh-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 17, 2025
@volcano-sh-bot
volcano-sh-bot merged commit eab01d7 into volcano-sh:master Dec 17, 2025
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. 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.

3 participants