@@ -21,8 +21,6 @@ import (
21
21
)
22
22
23
23
const (
24
- MEMORY_PRIOR = "MEM"
25
- CPU_PRIOR = "CPU"
26
24
RESTART_ALWAYS = "always"
27
25
)
28
26
@@ -34,7 +32,7 @@ func (c *calcium) CreateContainer(specs types.Specs, opts *types.DeployOptions)
34
32
if err != nil {
35
33
return nil , err
36
34
}
37
- if pod .Scheduler == CPU_PRIOR {
35
+ if pod .Favor == types . CPU_PRIOR {
38
36
return c .createContainerWithCPUPrior (specs , opts )
39
37
}
40
38
log .Infof ("Creating container with options: %v" , opts )
@@ -110,7 +108,7 @@ func (c *calcium) doCreateContainerWithMemoryPrior(nodeInfo types.NodeInfo, spec
110
108
}
111
109
112
110
for i = 0 ; i < nodeInfo .Deploy ; i ++ {
113
- config , hostConfig , networkConfig , containerName , err := c .makeContainerOptions (i + index , nil , specs , opts , node , MEMORY_PRIOR )
111
+ config , hostConfig , networkConfig , containerName , err := c .makeContainerOptions (i + index , nil , specs , opts , node , types . MEMORY_PRIOR )
114
112
ms [i ].ContainerName = containerName
115
113
ms [i ].Podname = opts .Podname
116
114
ms [i ].Nodename = node .Name
@@ -281,7 +279,7 @@ func (c *calcium) doCreateContainerWithCPUPrior(nodeName string, cpuMap []types.
281
279
282
280
for i , quota := range cpuMap {
283
281
// create options
284
- config , hostConfig , networkConfig , containerName , err := c .makeContainerOptions (i + index , quota , specs , opts , node , CPU_PRIOR )
282
+ config , hostConfig , networkConfig , containerName , err := c .makeContainerOptions (i + index , quota , specs , opts , node , types . CPU_PRIOR )
285
283
ms [i ].ContainerName = containerName
286
284
ms [i ].Podname = opts .Podname
287
285
ms [i ].Nodename = node .Name
@@ -385,7 +383,7 @@ func (c *calcium) releaseQuota(node *types.Node, quota types.CPUMap) {
385
383
c .store .UpdateNodeCPU (node .Podname , node .Name , quota , "+" )
386
384
}
387
385
388
- func (c * calcium ) makeContainerOptions (index int , quota types.CPUMap , specs types.Specs , opts * types.DeployOptions , node * types.Node , optionMode string ) (
386
+ func (c * calcium ) makeContainerOptions (index int , quota types.CPUMap , specs types.Specs , opts * types.DeployOptions , node * types.Node , favor string ) (
389
387
* enginecontainer.Config ,
390
388
* enginecontainer.HostConfig ,
391
389
* enginenetwork.NetworkingConfig ,
@@ -528,7 +526,7 @@ func (c *calcium) makeContainerOptions(index int, quota types.CPUMap, specs type
528
526
}
529
527
530
528
var resource enginecontainer.Resources
531
- if optionMode == CPU_PRIOR {
529
+ if favor == types . CPU_PRIOR {
532
530
resource = c .makeCPUPriorSetting (quota )
533
531
} else {
534
532
resource = c .makeMemoryPriorSetting (opts .Memory , opts .CPUQuota )
0 commit comments