Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions k8s/apis/k8s/v1alpha1/vineyardd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,19 @@ type VolumeConfig struct {
MountPath string `json:"mountPath,omitempty"`
}

// SchedulingConfig holds all configurations about scheduling
type SchedulingConfig struct {
// GPUType is a request to schedule this pod onto a specific GPU node. If it is non-empty,
// the scheduler simply schedules this pod onto that node, assuming that it fits resource
// requirements.
// +optional
GPUType string `json:"gpuType,omitempty"`
// If specified, the pod's scheduling constraints
// value should be the model name, model.aibrix.ai/name: deepseek-coder-7b-instruct
// +optional
AffinityWorkload string `json:"affinityWorkload,omitempty"`
}

// VineyardConfig holds all configuration about vineyard container
type VineyardConfig struct {
// represent the vineyardd's image
Expand Down Expand Up @@ -228,6 +241,11 @@ type VineyarddSpec struct {
// +kubebuilder:default:={pvcName: "", mountPath: ""}
Volume VolumeConfig `json:"volume,omitempty"`

// the configuration of scheduling
// +kubebuilder:validation:Optional
// +kubebuilder:default:={}
Scheduler SchedulingConfig `json:"scheduler,omitempty"`

// SecurityContext holds the security context settings for the vineyardd container.
// +kubebuilder:validation:Optional
// +kubebuilder:default:={}
Expand Down
16 changes: 16 additions & 0 deletions k8s/apis/k8s/v1alpha1/zz_generated.deepcopy.go

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

6 changes: 3 additions & 3 deletions k8s/cmd/commands/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ func startScheduler(mgr manager.Manager, schedulerConfigFile string) {
}

// checkKubernetesVersionForScheduler checks the kubernetes version for the scheduler
// the scheduler only supports kubernetes version 1.19-1.24
// the scheduler only supports kubernetes version 1.19-1.30
func checkKubernetesVersionForScheduler() (bool, error) {
config := util.GetKubernetesConfig()

Expand All @@ -321,8 +321,8 @@ func checkKubernetesVersionForScheduler() (bool, error) {
return false, err
}

if major != 1 || minor < 19 || minor > 24 {
return false, fmt.Errorf("the scheduler only supports kubernetes version 1.19-1.24")
if major != 1 || minor < 19 || minor > 30 {
return false, fmt.Errorf("the scheduler only supports kubernetes version 1.19-1.30")
}

return true, nil
Expand Down
8 changes: 1 addition & 7 deletions k8s/config/crd/bases/k8s.v6d.io_backups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
controller-gen.kubebuilder.io/version: v0.11.0
creationTimestamp: null
name: backups.k8s.v6d.io
spec:
Expand Down Expand Up @@ -622,9 +622,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
8 changes: 1 addition & 7 deletions k8s/config/crd/bases/k8s.v6d.io_csidrivers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
controller-gen.kubebuilder.io/version: v0.11.0
creationTimestamp: null
name: csidrivers.k8s.v6d.io
spec:
Expand Down Expand Up @@ -95,9 +95,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
8 changes: 1 addition & 7 deletions k8s/config/crd/bases/k8s.v6d.io_globalobjects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
controller-gen.kubebuilder.io/version: v0.11.0
creationTimestamp: null
name: globalobjects.k8s.v6d.io
spec:
Expand Down Expand Up @@ -75,9 +75,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
8 changes: 1 addition & 7 deletions k8s/config/crd/bases/k8s.v6d.io_localobjects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
controller-gen.kubebuilder.io/version: v0.11.0
creationTimestamp: null
name: localobjects.k8s.v6d.io
spec:
Expand Down Expand Up @@ -82,9 +82,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
8 changes: 1 addition & 7 deletions k8s/config/crd/bases/k8s.v6d.io_operations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
controller-gen.kubebuilder.io/version: v0.11.0
creationTimestamp: null
name: operations.k8s.v6d.io
spec:
Expand Down Expand Up @@ -59,9 +59,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
8 changes: 1 addition & 7 deletions k8s/config/crd/bases/k8s.v6d.io_recovers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
controller-gen.kubebuilder.io/version: v0.11.0
creationTimestamp: null
name: recovers.k8s.v6d.io
spec:
Expand Down Expand Up @@ -53,9 +53,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
8 changes: 1 addition & 7 deletions k8s/config/crd/bases/k8s.v6d.io_sidecars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
controller-gen.kubebuilder.io/version: v0.11.0
creationTimestamp: null
name: sidecars.k8s.v6d.io
spec:
Expand Down Expand Up @@ -1524,9 +1524,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
15 changes: 8 additions & 7 deletions k8s/config/crd/bases/k8s.v6d.io_vineyardds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
controller-gen.kubebuilder.io/version: v0.11.0
creationTimestamp: null
name: vineyardds.k8s.v6d.io
spec:
Expand Down Expand Up @@ -80,6 +80,13 @@ spec:
replicas:
default: 3
type: integer
scheduler:
properties:
affinityWorkload:
type: string
gpuType:
type: string
type: object
securityContext:
properties:
allowPrivilegeEscalation:
Expand Down Expand Up @@ -1570,9 +1577,3 @@ spec:
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
22 changes: 22 additions & 0 deletions k8s/pkg/templates/vineyardd/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,28 @@ spec:
- name: log
emptyDir: {}
affinity:
{{- if .Spec.Scheduler.GPUType }}
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
# extract the key to configuration
- key: machine.cluster.vke.volcengine.com/gpu-name
operator: In
values:
- {{ .Spec.Scheduler.GPUType }}
{{- end }}
{{- if .Spec.Scheduler.AffinityWorkload }}
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "model.aibrix.ai/name"
operator: In
values:
- {{ .Spec.Scheduler.AffinityWorkload }}
topologyKey: "kubernetes.io/hostname"
{{- end }}
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
Expand Down
Loading