Skip to content

Commit 9daf4e2

Browse files
author
Your Name
committed
add README
1 parent a4db818 commit 9daf4e2

File tree

4 files changed

+34
-10
lines changed

4 files changed

+34
-10
lines changed

README.md

+31-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,32 @@
11
# k8s-scheduler
2-
bin packing
2+
3+
### 设计:
4+
1. 利用kubernetes scheduler framework提供的插件形式,自定义kubernetes的调度器
5+
2. 采用bin packing装箱算法实现kubernetes的调度
6+
3. 首先通过扩展queueSort插件,排序目前等待调度的pods队列,优先调度cpu(核数)+Mem(KB)小的pods
7+
4. 然后扩展score插件,根据目前node上的pod数量评分len(pods)*10,这样优先调度pods数多的node节点
8+
5. 由此解决尽可能少占用node节点的装箱问题
9+
10+
### 编译:
11+
12+
#### binary
13+
```shell
14+
$ make local
15+
```
16+
17+
#### image
18+
```shell
19+
$ make image
20+
```
21+
22+
### 运行
23+
24+
#### 部署自定义调度器
25+
```shell
26+
$ kubectl apply -f ./deploy/bin-packing-plugin.yaml
27+
```
28+
29+
#### 测试
30+
```shell
31+
$ kubectl apply -f ./deploy/test.yaml
32+
```

deploy/bin-packing-plugin.yaml

+1-7
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,6 @@ data:
164164
score:
165165
enabled:
166166
- name: "Bin-Packing-Plugin"
167-
pluginConfig:
168-
- name: "Bin-Packing-Plugin"
169-
args:
170-
favorite_color: "#326CE5"
171-
favorite_number: 7
172-
thanks_to: "thockin"
173167
---
174168
apiVersion: apps/v1
175169
kind: Deployment
@@ -196,7 +190,7 @@ spec:
196190
name: scheduler-config
197191
containers:
198192
- name: scheduler-ctrl
199-
image: bin-packing-plugin:1.0.0
193+
image: docker.io/library/bin-packing-plugin:1.0.1
200194
imagePullPolicy: IfNotPresent
201195
args:
202196
- bin-packing-plugin

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ replace (
2828
)
2929

3030
require (
31-
github.com/go-logr/logr v0.1.0
31+
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc // indirect
3232
k8s.io/api v0.0.0
3333
k8s.io/apimachinery v0.0.0
3434
k8s.io/component-base v0.0.0

pkg/plugin/plugin.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func (bppl *BinPackingPlugin) Score(ctx context.Context, state *framework.CycleS
7272
return 0, framework.NewStatus(framework.Error, fmt.Sprintf("getting node %q from Snapshot: %v", nodeName, err))
7373
}
7474
podNum := len(nodeInfo.Pods)
75-
return int64(podNum * 100), nil
75+
return int64(podNum * 10), nil
7676
}
7777

7878
func (bppl *BinPackingPlugin) ScoreExtensions() framework.ScoreExtensions {

0 commit comments

Comments
 (0)