Skip to content

Commit

Permalink
Merge pull request #144 from Monokaix/network-topo
Browse files Browse the repository at this point in the history
Network topology API definition
  • Loading branch information
volcano-sh-bot authored Dec 18, 2024
2 parents 7e0a058 + 6aa1e55 commit e5d361b
Show file tree
Hide file tree
Showing 42 changed files with 2,057 additions and 17 deletions.
29 changes: 29 additions & 0 deletions pkg/apis/batch/v1alpha1/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,35 @@ type JobSpec struct {
// +kubebuilder:validation:Minimum=1
// +optional
MinSuccess *int32 `json:"minSuccess,omitempty" protobuf:"varint,12,opt,name=minSuccess"`

// NetworkTopology defines the NetworkTopology config, this field works in conjunction with network topology feature and hyperNode CRD.
// +optional
NetworkTopology *NetworkTopologySpec `json:"networkTopology,omitempty" protobuf:"bytes,13,opt,name=networkTopology"`
}

// NetworkTopologyMode represents the networkTopology mode, valid values are "hard" and "soft".
// +kubebuilder:validation:Enum=hard;soft
type NetworkTopologyMode string

const (
// HardNetworkTopologyMode represents a strict network topology constraint that jobs must adhere to.
HardNetworkTopologyMode NetworkTopologyMode = "hard"

// SoftNetworkTopologyMode represents a flexible network topology constraint that allows jobs
// to cross network boundaries under certain conditions.
SoftNetworkTopologyMode NetworkTopologyMode = "soft"
)

type NetworkTopologySpec struct {
// Mode specifies the mode of the network topology constrain.
// +kubebuilder:default=hard
// +optional
Mode NetworkTopologyMode `json:"mode,omitempty" protobuf:"bytes,1,opt,name=mode"`

// HighestTierAllowed specifies the highest tier that a job allowed to cross when scheduling.
// +kubebuilder:default=1
// +optional
HighestTierAllowed *int `json:"highestTierAllowed,omitempty" protobuf:"bytes,2,opt,name=highestTierAllowed"`
}

// VolumeSpec defines the specification of Volume, e.g. PVC.
Expand Down
26 changes: 26 additions & 0 deletions pkg/apis/batch/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions pkg/apis/scheduling/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,35 @@ type PodGroupSpec struct {
// if there's not enough resources to start all tasks, the scheduler
// will not start anyone.
MinResources *v1.ResourceList

// NetworkTopology defines the NetworkTopology config, this field works in conjunction with network topology feature and hyperNode CRD.
// +optional
NetworkTopology *NetworkTopologySpec
}

// NetworkTopologyMode represents the networkTopology mode, valid values are "hard" and "soft".
// +kubebuilder:validation:Enum=hard;soft
type NetworkTopologyMode string

const (
// HardNetworkTopologyMode represents a strict network topology constraint that jobs must adhere to.
HardNetworkTopologyMode NetworkTopologyMode = "hard"

// SoftNetworkTopologyMode represents a flexible network topology constraint that
// allows jobs to cross network boundaries under certain conditions.
SoftNetworkTopologyMode NetworkTopologyMode = "soft"
)

type NetworkTopologySpec struct {
// Mode specifies the mode of the network topology constrain.
// +kubebuilder:default=hard
// +optional
Mode NetworkTopologyMode

// HighestTierAllowed specifies the highest tier that a job allowed to cross when scheduling.
// +kubebuilder:default=1
// +optional
HighestTierAllowed *int
}

// PodGroupStatus represents the current state of a pod group.
Expand Down
28 changes: 28 additions & 0 deletions pkg/apis/scheduling/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,34 @@ type PodGroupSpec struct {
// if there's not enough resources to start all tasks, the scheduler
// will not start anyone.
MinResources *v1.ResourceList `json:"minResources,omitempty" protobuf:"bytes,4,opt,name=minResources"`

// NetworkTopology defines the NetworkTopology config, this field works in conjunction with network topology feature and hyperNode CRD.
// +optional
NetworkTopology *NetworkTopologySpec `json:"networkTopology,omitempty" protobuf:"bytes,5,opt,name=networkTopology"`
}

type NetworkTopologyMode string

const (
// HardNetworkTopologyMode represents a strict network topology constraint that jobs must adhere to.
HardNetworkTopologyMode NetworkTopologyMode = "hard"

// SoftNetworkTopologyMode represents a flexible network topology constraint that allows jobs
// to cross network boundaries under certain conditions.
SoftNetworkTopologyMode NetworkTopologyMode = "soft"
)

type NetworkTopologySpec struct {
// Mode specifies the mode of the network topology constrain.
// +kubebuilder:validation:Enum=hard;soft
// +kubebuilder:default=hard
// +optional
Mode NetworkTopologyMode `json:"mode,omitempty" protobuf:"bytes,1,opt,name=mode"`

// HighestTierAllowed specifies the highest tier that a job allowed to cross when scheduling.
// +kubebuilder:default=1
// +optional
HighestTierAllowed *int `json:"highestTierAllowed,omitempty" protobuf:"bytes,2,opt,name=highestTierAllowed"`
}

// PodGroupStatus represents the current state of a pod group.
Expand Down
34 changes: 34 additions & 0 deletions pkg/apis/scheduling/v1beta1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions pkg/apis/scheduling/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions pkg/apis/scheduling/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions pkg/apis/topology/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
Copyright 2024 The Volcano Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// +k8s:deepcopy-gen=package
// +k8s:defaulter-gen=TypeMeta
// +groupName=topology.volcano.sh
package v1alpha1
Loading

0 comments on commit e5d361b

Please sign in to comment.