Skip to content

Commit

Permalink
Merge pull request #53 from XinyiSong/dev/echo/support-rescheduling
Browse files Browse the repository at this point in the history
dev/echo/support rescheduling
  • Loading branch information
NickrenREN authored Aug 13, 2024
2 parents 128f9f7 + 0fad9e8 commit e54718b
Show file tree
Hide file tree
Showing 98 changed files with 9,194 additions and 313 deletions.
5 changes: 5 additions & 0 deletions cmd/scheduler/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ func (o *Options) ApplyTo(c *schedulerappconfig.Config) error {
if o.ComponentConfig.DefaultProfile.BlockQueue != nil && *o.ComponentConfig.DefaultProfile.BlockQueue != godelschedulerconfig.DefaultBlockQueue {
toUse.DefaultProfile.BlockQueue = o.ComponentConfig.DefaultProfile.BlockQueue
}

// check max waiting deletion duration is set
if toUse.DefaultProfile.MaxWaitingDeletionDuration == 0 {
toUse.DefaultProfile.MaxWaitingDeletionDuration = o.ComponentConfig.DefaultProfile.MaxWaitingDeletionDuration
}
}
// 6. preemption config
{
Expand Down
6 changes: 4 additions & 2 deletions cmd/scheduler/app/options/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ func TestLoadFileV1beta1(t *testing.T) {
AttemptImpactFactorOnPriority: &FLOAT64_3,
UnitInitialBackoffSeconds: &INT64_1,
UnitMaxBackoffSeconds: &INT64_100,
MaxWaitingDeletionDuration: 120,
}

profile := cfg.ComponentConfig.DefaultProfile
Expand All @@ -231,8 +232,9 @@ func TestLoadFileV1beta1(t *testing.T) {
// SubClusterProfiles: subCluster 1
{
expectedProfile := &schedulerconfig.GodelSchedulerProfile{
SubClusterName: "subCluster 1",
DisablePreemption: &TRUE,
SubClusterName: "subCluster 1",
DisablePreemption: &TRUE,
MaxWaitingDeletionDuration: 300,
UnitQueueSortPlugin: &schedulerconfig.Plugin{
Name: "FCFS",
},
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/davecgh/go-spew v1.1.1
github.com/evanphx/json-patch v4.12.0+incompatible
github.com/google/go-cmp v0.5.9
github.com/kubewharf/godel-scheduler-api v0.0.0-20231129083306-7282cca41429
github.com/kubewharf/godel-scheduler-api v0.0.0-20240715084102-cb5e548bca92
github.com/kubewharf/katalyst-api v0.4.1-0.20240222122824-be538f641f58
github.com/onsi/ginkgo v1.14.0
github.com/onsi/gomega v1.19.0
Expand All @@ -19,6 +19,7 @@ require (
go.opentelemetry.io/otel v0.20.0
go.opentelemetry.io/otel/trace v0.20.0
golang.org/x/crypto v0.14.0
golang.org/x/time v0.3.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.24.6
k8s.io/apiextensions-apiserver v0.24.6
Expand Down Expand Up @@ -117,7 +118,6 @@ require (
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.8.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kubewharf/godel-scheduler-api v0.0.0-20231129083306-7282cca41429 h1:YpoBFCSUzafRlN5FVEGfGvopEWH3OSV/sAik3MAmlVo=
github.com/kubewharf/godel-scheduler-api v0.0.0-20231129083306-7282cca41429/go.mod h1:ten2w2gEy8fdAjGiy7WJ5FrTBQ2PF2GQjSJK02oHvhU=
github.com/kubewharf/godel-scheduler-api v0.0.0-20240715084102-cb5e548bca92 h1:G2oiaA1iqjY5PKRYlG1BKOMGpUnGHUtM6vfEQlQpevg=
github.com/kubewharf/godel-scheduler-api v0.0.0-20240715084102-cb5e548bca92/go.mod h1:ten2w2gEy8fdAjGiy7WJ5FrTBQ2PF2GQjSJK02oHvhU=
github.com/kubewharf/katalyst-api v0.4.1-0.20240222122824-be538f641f58 h1:D9dCR5EIR0k0Qil2A5biZjrubagRkEr7fyov6fb2ApY=
github.com/kubewharf/katalyst-api v0.4.1-0.20240222122824-be538f641f58/go.mod h1:Y2IeIorxQamF2a3oa0+URztl5QCSty6Jj3zD83R8J9k=
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE=
Expand Down
3 changes: 2 additions & 1 deletion manifests/base/crds/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ resources:
- node.katalyst.kubewharf.io_customnoderesources.yaml
- node.godel.kubewharf.io_nmnodes.yaml
- scheduling.godel.kubewharf.io_podgroups.yaml
- scheduling.godel.kubewharf.io_schedulers.yaml
- scheduling.godel.kubewharf.io_schedulers.yaml
- scheduling.godel.kubewharf.io_movements.yaml
186 changes: 186 additions & 0 deletions manifests/base/crds/scheduling.godel.kubewharf.io_movements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.0
creationTimestamp: null
name: movements.scheduling.godel.kubewharf.io
spec:
group: scheduling.godel.kubewharf.io
names:
kind: Movement
listKind: MovementList
plural: movements
singular: movement
scope: Cluster
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: Movement stores necessary information for rescheduling decisions.
It has a group of task movements which need to be performed in one attempt,
movement creator, movement generation and so on.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec defines the behavior of a Movement.
properties:
creator:
description: Creator of this movement.
type: string
deletedTasks:
description: A list of tasks need to be rescheduled
items:
description: Information of each task needs to be rescheduled
properties:
name:
description: Task name, e.g. pod name
type: string
namespace:
description: Task namespace, e.g. pod namespace
type: string
node:
description: Node of this task
type: string
uid:
description: Task uid, e.g. pod uid
type: string
required:
- name
- namespace
- node
- uid
type: object
type: array
generation:
description: Generation of this movement. When a new round of rescheduling
decisions are made, generation is bumped.
type: integer
type: object
status:
description: Status describes the current status of a Movement. This data
may not be up to date.
properties:
notifiedSchedulers:
description: Names of godel schedulers which have received this movement
crd
items:
type: string
type: array
ownerMovements:
description: A list of movement info for all owners
items:
description: Contain node suggestions for each owner
properties:
nodeSuggestions:
description: Information of suggested nodes
items:
description: Contain desired state and actual state for node
properties:
actualPods:
description: Pods using this suggestion
items:
description: Information of each task needs to be rescheduled
properties:
name:
description: Task name, e.g. pod name
type: string
namespace:
description: Task namespace, e.g. pod namespace
type: string
node:
description: Node of this task
type: string
uid:
description: Task uid, e.g. pod uid
type: string
required:
- name
- namespace
- node
- uid
type: object
type: array
desiredPodCount:
description: Desired pod count for this node
format: int64
type: integer
node:
description: Node Name
type: string
type: object
type: array
owner:
description: Information of task owner
properties:
name:
description: Owner name
type: string
namespace:
description: Owner namespace
type: string
type:
description: Owner type, e.g. ReplicaSet/StatefulSet...
type: string
uid:
description: Owner uid
type: string
required:
- name
- namespace
- type
- uid
type: object
tasksBreakSuggestion:
description: Tasks scheduled successfully but not use suggestion
items:
description: Information of each task needs to be rescheduled
properties:
name:
description: Task name, e.g. pod name
type: string
namespace:
description: Task namespace, e.g. pod namespace
type: string
node:
description: Node of this task
type: string
uid:
description: Task uid, e.g. pod uid
type: string
required:
- name
- namespace
- node
- uid
type: object
type: array
required:
- owner
type: object
type: array
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
15 changes: 15 additions & 0 deletions manifests/base/roles/cluster-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,18 @@ rules:
- customnoderesources
verbs:
- "*"
- apiGroups:
- "*"
resources:
- movements
verbs:
- list
- watch
- patch
- apiGroups:
- "*"
resources:
- movements/status
verbs:
- update
- patch
12 changes: 12 additions & 0 deletions pkg/binder/cache/fake/fake_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,15 @@ func (c *Cache) SetUnitSchedulingStatus(unitKey string, status unitstatus.Schedu
func (c *Cache) GetUnitSchedulingStatus(unitKey string) unitstatus.SchedulingStatus {
return unitstatus.ScheduledStatus
}

func (c *Cache) AddMovement(movement *schedulingv1a1.Movement) error {
return nil
}

func (c *Cache) UpdateMovement(oldMovement, newMovement *schedulingv1a1.Movement) error {
return nil
}

func (c *Cache) DeleteMovement(movement *schedulingv1a1.Movement) error {
return nil
}
Loading

0 comments on commit e54718b

Please sign in to comment.