Skip to content

Commit 360e623

Browse files
committed
Merge branch 'bug/nodename-env' into 'master'
oops See merge request !52
2 parents 0c328fe + 29b28ec commit 360e623

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

cluster/calcium/create_container.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func (c *calcium) doCreateContainerWithCPUPeriod(nodename string, connum int, qu
9494
}
9595

9696
for i := 0; i < connum; i++ {
97-
config, hostConfig, networkConfig, containerName, err := c.makeContainerOptions(nil, specs, opts, "cpuperiod", node.GetIP())
97+
config, hostConfig, networkConfig, containerName, err := c.makeContainerOptions(nil, specs, opts, "cpuperiod", node)
9898
ms[i].ContainerName = containerName
9999
ms[i].Podname = opts.Podname
100100
ms[i].Nodename = node.Name
@@ -378,7 +378,7 @@ func (c *calcium) doCreateContainerWithScheduler(nodename string, cpumap []types
378378

379379
for i, quota := range cpumap {
380380
// create options
381-
config, hostConfig, networkConfig, containerName, err := c.makeContainerOptions(quota, specs, opts, "scheduler", node.GetIP())
381+
config, hostConfig, networkConfig, containerName, err := c.makeContainerOptions(quota, specs, opts, "scheduler", node)
382382
if err != nil {
383383
log.Errorf("Error when creating CreateContainerOptions, %v", err)
384384
ms[i].Error = err.Error()
@@ -484,7 +484,7 @@ func (c *calcium) releaseQuota(node *types.Node, quota types.CPUMap) {
484484
c.store.UpdateNodeCPU(node.Podname, node.Name, quota, "+")
485485
}
486486

487-
func (c *calcium) makeContainerOptions(quota map[string]int, specs types.Specs, opts *types.DeployOptions, optionMode, nodeIP string) (
487+
func (c *calcium) makeContainerOptions(quota map[string]int, specs types.Specs, opts *types.DeployOptions, optionMode string, node *types.Node) (
488488
*enginecontainer.Config,
489489
*enginecontainer.HostConfig,
490490
*enginenetwork.NetworkingConfig,
@@ -539,10 +539,11 @@ func (c *calcium) makeContainerOptions(quota map[string]int, specs types.Specs,
539539
}
540540

541541
// env
542+
nodeIP := node.GetIP()
542543
env := append(opts.Env, fmt.Sprintf("APP_NAME=%s", specs.Appname))
543544
env = append(env, fmt.Sprintf("ERU_POD=%s", opts.Podname))
544545
env = append(env, fmt.Sprintf("ERU_NODE_IP=%s", nodeIP))
545-
env = append(env, fmt.Sprintf("ERU_NODE_NAME=%s", opts.Nodename))
546+
env = append(env, fmt.Sprintf("ERU_NODE_NAME=%s", node.Name))
546547
env = append(env, fmt.Sprintf("ERU_ZONE=%s", c.config.Zone))
547548

548549
// mount paths

0 commit comments

Comments
 (0)