Skip to content

Commit

Permalink
Add hyperNode CRD and add networkTopologies spec for job
Browse files Browse the repository at this point in the history
Signed-off-by: Monokaix <changxuzheng@huawei.com>
  • Loading branch information
Monokaix committed Nov 27, 2024
1 parent aac8f44 commit 2010613
Show file tree
Hide file tree
Showing 42 changed files with 2,057 additions and 17 deletions.
28 changes: 28 additions & 0 deletions pkg/apis/batch/v1alpha1/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,34 @@ type JobSpec struct {
// +kubebuilder:validation:Minimum=1
// +optional
MinSuccess *int32 `json:"minSuccess,omitempty" protobuf:"varint,12,opt,name=minSuccess"`

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

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 NetworkTopologiesSpec 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 int32 `json:"highestTierAllowed,omitempty" protobuf:"bytes,2,opt,name=highestTierAllowed"`
}

// VolumeSpec defines the specification of Volume, e.g. PVC.
Expand Down
21 changes: 21 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.

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

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

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 NetworkTopologiesSpec struct {
// Mode specifies the mode of the network topology constrain.
// +kubebuilder:validation:Enum=hard;soft
// +kubebuilder:default=hard
// +optional
Mode NetworkTopologyMode

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

// 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"`

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

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 NetworkTopologiesSpec 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 int32 `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.

21 changes: 21 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.

21 changes: 21 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 2010613

Please sign in to comment.