Skip to content
This repository was archived by the owner on May 27, 2025. It is now read-only.

Commit f8cec1d

Browse files
authored
Merge pull request #34 from humpback/develop-0.0.1
add container name when remove
2 parents 649fd17 + d1e8c7f commit f8cec1d

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

backend/internal/node/agentHelper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ var (
1515
ErrNodeNotExist = errors.New("The node does not exist")
1616
)
1717

18-
func RemoveNodeContainer(nodeId string, containerId string) error {
18+
func RemoveNodeContainer(nodeId string, containerId string, containerName string) error {
1919
// remove container
2020
node := GetNodeInfo(nodeId)
2121
if node != nil {
22-
url := fmt.Sprintf("http://%s:%d/api/v1/container/%s?force=true", node.IpAddress, node.Port, containerId)
22+
url := fmt.Sprintf("http://%s:%d/api/v1/container/%s?force=true&containerName=%s", node.IpAddress, node.Port, containerId, containerName)
2323
slog.Info("[Agent Helper] Remove container", "url", url)
2424
err := httpx.NewHttpXClient().Delete(url, nil, nil, nil)
2525
if err != nil {

backend/scheduler/serviceController.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func (sc *ServiceController) HandleContainerChanged() {
120120
func (sc *ServiceController) HandleContainerRemove() {
121121
for containerStatus := range sc.ContainerRemoveChan {
122122
if containerStatus.State != types.ContainerStatusRemoved {
123-
node.RemoveNodeContainer(containerStatus.NodeId, containerStatus.ContainerId)
123+
node.RemoveNodeContainer(containerStatus.NodeId, containerStatus.ContainerId, containerStatus.ContainerName)
124124
}
125125
}
126126
}

backend/scheduler/serviceManager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ func (sm *ServiceManager) DeleteContainer(nodeId string, containerName string, c
178178
if containerId == "" { // 没创建出来的时候没有Id
179179
containerId = containerName
180180
}
181-
node.RemoveNodeContainer(nodeId, containerId)
181+
node.RemoveNodeContainer(nodeId, containerId, containerName)
182182

183183
sm.ServiceInfo.Containers = lo.Filter(sm.ServiceInfo.Containers, func(cs *types.ContainerStatus, index int) bool {
184184
return cs.ContainerName != containerName

0 commit comments

Comments
 (0)