Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create sonic scheduler for test #1

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
3 changes: 3 additions & 0 deletions cmd/controller/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,15 @@ func Run(s *ServerRunOptions) error {

coreInformerFactory := informers.NewSharedInformerFactory(kubeClient, 0)
podInformer := coreInformerFactory.Core().V1().Pods()
dpInformer := coreInformerFactory.Apps().V1().Deployments()
pgCtrl := controller.NewPodGroupController(kubeClient, pgInformer, podInformer, schedClient)
eqCtrl := controller.NewElasticQuotaController(kubeClient, eqInformer, podInformer, schedClient)
sonicCtrl := controller.NewSonicDeamonsetController(kubeClient, podInformer, dpInformer)

run := func(ctx context.Context) {
go pgCtrl.Run(s.Workers, ctx.Done())
go eqCtrl.Run(s.Workers, ctx.Done())
go sonicCtrl.Run(s.Workers, ctx.Done())
select {}
}
schedInformerFactory.Start(stopCh)
Expand Down
10 changes: 10 additions & 0 deletions cmd/scheduler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,26 @@ import (
"sigs.k8s.io/scheduler-plugins/pkg/podstate"
"sigs.k8s.io/scheduler-plugins/pkg/preemptiontoleration"
"sigs.k8s.io/scheduler-plugins/pkg/qos"
"sigs.k8s.io/scheduler-plugins/pkg/sonic"
"sigs.k8s.io/scheduler-plugins/pkg/trimaran/loadvariationriskbalancing"
"sigs.k8s.io/scheduler-plugins/pkg/trimaran/targetloadpacking"

// Ensure scheme package is initialized.
"fmt"
"runtime/debug"

_ "sigs.k8s.io/scheduler-plugins/apis/config/scheme"
)

func main() {
// Register custom plugins to the scheduler framework.
// Later they can consist of scheduler profile(s) and hence
// used by various kinds of workloads.
defer func() {
if r := recover(); r != nil {
fmt.Println("stacktrace from panic: \n" + string(debug.Stack()))
}
}()
command := app.NewSchedulerCommand(
app.WithPlugin(capacityscheduling.Name, capacityscheduling.New),
app.WithPlugin(coscheduling.Name, coscheduling.New),
Expand All @@ -52,6 +61,7 @@ func main() {
// app.WithPlugin(crossnodepreemption.Name, crossnodepreemption.New),
app.WithPlugin(podstate.Name, podstate.New),
app.WithPlugin(qos.Name, qos.New),
app.WithPlugin(sonic.Name, sonic.New),
)

code := cli.Run(command)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ rules:
verbs: ["get", "list", "watch", "patch"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["delete", "get", "list", "watch", "update"]
verbs: ["delete", "get", "list", "watch", "update", "patch"]
- apiGroups: [""]
resources: ["bindings", "pods/binding"]
verbs: ["create"]
Expand Down Expand Up @@ -87,7 +87,7 @@ metadata:
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch"]
verbs: ["get", "list", "watch", "patch"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch", "patch"]
Expand Down
6 changes: 3 additions & 3 deletions manifests/install/charts/as-a-second-scheduler/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@

scheduler:
name: scheduler-plugins-scheduler
image: k8s.gcr.io/scheduler-plugins/kube-scheduler:v0.23.10
image: localhost:5000/scheduler-plugins/kube-scheduler:latest
namespace: scheduler-plugins
replicaCount: 1
leaderElect: false

controller:
name: scheduler-plugins-controller
image: k8s.gcr.io/scheduler-plugins/controller:v0.23.10
image: localhost:5000/scheduler-plugins/controller:latest
namespace: scheduler-plugins
replicaCount: 1

# LoadVariationRiskBalancing and TargetLoadPacking are not enabled by default
# as they need extra RBAC privileges on metrics.k8s.io.

plugins:
enabled: ["Coscheduling","CapacityScheduling","NodeResourceTopologyMatch","NodeResourcesAllocatable"]
enabled: ["Coscheduling","CapacityScheduling","NodeResourceTopologyMatch","NodeResourcesAllocatable", "SonicScheduling"]
disabled: ["PrioritySort"] # only in-tree plugins need to be defined here

# Customize the enabled plugins' config.
Expand Down
Loading