-
Notifications
You must be signed in to change notification settings - Fork 42
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
Abstract Resources #256
Abstract Resources #256
Conversation
7628b29
to
8a2d6ee
Compare
types/scheduler.go
Outdated
// ResourceMemory . | ||
ResourceMemory | ||
// ResourceVolume . | ||
ResourceVolume | ||
ResourceVolumeNeedSchedule |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ResourceScheduledVolume
types/node.go
Outdated
ResourceCPU: n.CPUUsed / float64(len(n.InitCPU)), | ||
ResourceMemory: 1.0 - float64(n.MemCap)/float64(n.InitMemCap), | ||
ResourceStorage: n.StorageUsage(), | ||
ResourceVolume: float64(n.VolumeUsed) / float64(n.Volume.Total()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我在想 CPU 和 CPU CORE 是不是应该算2类资源
d8fc3f7
to
07fe7c4
Compare
close(ch) | ||
|
||
for nodename := range deployMap { | ||
if e := c.store.DeleteProcessing(ctx, opts, nodename); e != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
憋偷懒。。。里面都是 err
cluster/calcium/create.go
Outdated
|
||
// if: alloc resources | ||
func(ctx context.Context) error { | ||
return c.withNodesLocked(ctx, opts.Podname, opts.Nodename, opts.NodeLabels, false, func(nodeMap map[string]*types.Node) (err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我记得我改过这个接口了?第二个参数是 opts.Nodenames, 是个 []string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
所以有冲突来着... 变基
可以直接看新的 create.go / realloc.go, 看 diff 太蛋疼了 |
那么哪里可以看到新的。。 |
https://github.com/projecteru2/core/blob/07fe7c4c0f6cf6e21a095fa35a060ea82a1c1a80/cluster/calcium/create.go 不过不能 comment |
哦,我已经拿最新的用 vscode 看了……不然看不下去…… |
24eae87
to
3f2816e
Compare
8007dee
to
c2a1e5d
Compare
@@ -147,10 +150,10 @@ func (vbs VolumeBindings) ApplyPlan(plan VolumePlan) (res VolumeBindings) { | |||
return | |||
} | |||
|
|||
// Merge combines two VolumeBindings | |||
func (vbs VolumeBindings) Merge(vbs2 VolumeBindings) (softVolumes VolumeBindings, hardVolumes VolumeBindings, err error) { | |||
// MergeVolumeBindings combines two VolumeBindings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
确定是 export 的么
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是吧, realloc 里要用, realloc 的请求是增量, 所以需要把已有的 volume 和增量 volume 合体
c2a1e5d
to
9224587
Compare
types, complex, rpc 覆盖率下降了 |
另外不考虑把 types/scheduler 的定义啊什么的放 scheduler 里面么……觉得这里放 interface 什么的怪怪的 |
循环依赖.. |
逼太紧😂 |
我的意思是在 scheduler 里面有个 types 的包,全局 types 依赖于这个模块的 types,而 scheduler 的实现依赖于全局 types 和自己的 types 不就好了 |
😈 |
好像不太容易, 因为 scheduler types 依赖 global types (NodeInfo, Node), 而 global types 也要依赖 scheudler types (DeployOptions.ResourceRequests 是 interface) ... |
9224587
to
515d3ec
Compare
complex 覆盖率下降是因为模块代码减少了... 其他的都改了 |
515d3ec
to
1f6c898
Compare
果然还是测出来了两个 bug, 现在应该可以了 |
6f4047b
to
be820ab
Compare
* intro scheduler v2: adapter to v1 * cluster: rewrite create and realloc * types: introduce resource interface to unify * scheduler: expose SelectNodes to encap ScheduleV1 * store: new UpdateNodes and Processing interfaces * strategy: adjust to new resource data structure * rpc: create option harness resource interface * utils: minor fix to transaction * pass lint and codacy * fix transactions for realloc and replace
指导思想
a. NodeInfo 分拆为两个对象 NodeInfo + StrategyInfo, 新 NodeInfo 只 负责给 scheduler 提供信息, StrategyInfo 只 为 strategy deploy 提供信息
b. scheduler 和 strategy 的返回信息不再记录在 NodeInfo 和 StrategyInfo 里, 而是单独返回数据结构
c. NodeInfo 只出现在 SelectNode 函数里, StrategyInfo 只出现在 strategy.Deploy 里, 不泄漏, 不滥用
a. doAllocResource 不再提交变更给 store, 只做计算, 提交变更由上层完成, 便于实现事务
b. doCreateWorkloads 实现资源元数据事务, 对资源元数据的提交和回滚都 只 在这个函数里实现
c. doDeployOneWorkload 实现容器元数据的提交, 容器元数据和容器实例的一致性在这个函数里保证