Skip to content

Commit

Permalink
Modify the ScalerCrd for mannual scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
workingloong committed Jan 16, 2023
1 parent 37d2307 commit b7ba855
Show file tree
Hide file tree
Showing 3 changed files with 149 additions and 20 deletions.
37 changes: 35 additions & 2 deletions dlrover/go/operator/api/v1alpha1/scaler_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,20 @@ type ScalerSpec struct {
// }
ReplicaResourceSpecs map[commonv1.ReplicaType]ReplicaResourceSpec `json:"replicaResourceSpec,omitempty"`

// NodeResourceSpec specifics resources configurations of nodes.
NodeResourceSpec map[string]ResourceSpec `json:"nodeResourceSpec,omitempty"`
// CreatePods are Pods to be created.
CreatePods []PodMeta `json:"createPods,omitempty"`

// RemovePods are Pods to be removed
RemovePods []string `json:"removePods,omitempty"`

// MigratePods are Pods to be migrated to other Pods with the new resource.
MigratePods []PodMeta `json:"migratePods,omitempty"`

// PsHosts are hosts of PS Pods
PsHosts []string `json:"psHosts,omitempty"`

// MaunnalScaling specifies the ScalerCRD created by users.
MaunnalScaling bool `json:"manunalScaling,omitempty"`

// OwnerJob specifies a job to scale.
OwnerJob string `json:"ownerJob,omitempty"`
Expand All @@ -63,6 +75,27 @@ type ResourceSpec struct {
GPU string `json:"gpu,omitempty"`
}

// PodMeta specifies the meta of a Pod.
type PodMeta struct {
// Name is the name of the Pod
Name string `json:"name,omitempty"`

// Id is the identity of the Pod
ID int `json:"id,omitempty"`

// Type is the type of the Pod
Type string `json:"type,omitempty"`

// RankIndex is the index of the Pod
RankIndex int `json:"randIndex,omitempty"`

// Service is the service whose endpoint is the Pod.
Service string `json:"service,omitempty"`

// Resource defines the resource of each replica
Resource ResourceSpec `json:"resoruce,omitempty"`
}

// ScalerStatus defines the observed state of ElasticJob
type ScalerStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
Expand Down
41 changes: 35 additions & 6 deletions dlrover/go/operator/api/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,93 @@ spec:
spec:
description: ScalerSpec defines the desired resource state of an ElasticJob
properties:
nodeResourceSpec:
additionalProperties:
description: ResourceSpec specifies the resources of a repalica
createPods:
description: CreatePods are Pods to be created.
items:
description: PodMeta specifies the meta of a Pod.
properties:
cpu:
description: CPU is the requested CPU cores of a replica
id:
description: Id is the identity of the Pod
type: integer
name:
description: Name is the name of the Pod
type: string
gpu:
description: GPU is the requested GPU of a replica
randIndex:
description: RankIndex is the index of the Pod
type: integer
resoruce:
description: Resource defines the resource of each replica
properties:
cpu:
description: CPU is the requested CPU cores of a replica
type: string
gpu:
description: GPU is the requested GPU of a replica
type: string
memory:
description: Memory is the requested memory (MB) of a replica
type: string
type: object
service:
description: Service is the service whose endpoint is the Pod.
type: string
memory:
description: Memory is the requested memory (MB) of a replica
type:
description: Type is the type of the Pod
type: string
type: object
description: NodeResourceSpec specifics resources configurations of
nodes.
type: object
type: array
manunalScaling:
description: MaunnalScaling specifies the ScalerCRD created by users.
type: boolean
migratePods:
description: MigratePods are Pods to be migrated to other Pods with
the new resource.
items:
description: PodMeta specifies the meta of a Pod.
properties:
id:
description: Id is the identity of the Pod
type: integer
name:
description: Name is the name of the Pod
type: string
randIndex:
description: RankIndex is the index of the Pod
type: integer
resoruce:
description: Resource defines the resource of each replica
properties:
cpu:
description: CPU is the requested CPU cores of a replica
type: string
gpu:
description: GPU is the requested GPU of a replica
type: string
memory:
description: Memory is the requested memory (MB) of a replica
type: string
type: object
service:
description: Service is the service whose endpoint is the Pod.
type: string
type:
description: Type is the type of the Pod
type: string
type: object
type: array
ownerJob:
description: OwnerJob specifies a job to scale.
type: string
psHosts:
description: PsHosts are hosts of PS Pods
items:
type: string
type: array
removePods:
description: RemovePods are Pods to be removed
items:
type: string
type: array
replicaResourceSpec:
additionalProperties:
description: ReplicaResourceSpec specifies the number and resources
Expand Down

0 comments on commit b7ba855

Please sign in to comment.