Skip to content

feat: refactors remote_excute #9809

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

Merged
merged 1 commit into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/controller/grpc/synchronizer/agent_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,5 @@ func (s *AgentService) Plugin(r *api.PluginRequest, in api.Synchronizer_PluginSe
}

func (s *AgentService) RemoteExecute(in api.Synchronizer_RemoteExecuteServer) error {
return s.vTapEvent.RemoteExecute(in)
return s.vTapEvent.RemoteExecute.RemoteExecute(in)
}
2 changes: 1 addition & 1 deletion server/controller/http/router/agent/agent_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func forwardToServerConnectedByAgent() gin.HandlerFunc {
}

reverseProxy := fmt.Sprintf("http://%s:%d", newHost, common.GConfig.HTTPNodePort)
log.Infof("agnet(key: %s), node ip(%s), reverse proxy(%s), agent current controller ip(%s), controller ip(%s)",
log.Infof("agent(key: %s), node ip(%s), reverse proxy(%s), agent current controller ip(%s), controller ip(%s)",
key, common.NodeIP, reverseProxy, agent.CurControllerIP, agent.ControllerIP, db.LogPrefixORGID)

proxyURL, err := url.Parse(reverseProxy)
Expand Down
10 changes: 5 additions & 5 deletions server/controller/http/service/agent/agent_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ var (

type AgentCMDManager map[string]*CMDManager

func AgentCommandLock() {
func LockAgentCMD() {
agentCMDMutex.Lock()
}

func AgentCommandUnlock() {
func UnlockAgentCMD() {
agentCMDMutex.Unlock()
}

Expand Down Expand Up @@ -333,19 +333,19 @@ func GetCMDAndNamespace(timeout, orgID, agentID int) (*RemoteExecResp, error) {
return nil, fmt.Errorf("timeout(%vs) to get remote commands and linux namespace", timeout)
case _, ok := <-cmdResp.RemoteCMDDoneCH:
if !ok {
return nil, fmt.Errorf("%sagent(key: %s, name: %s) command manager is lost", key, agent.Name)
return nil, fmt.Errorf("failed to get remote commands, agent(key: %s, name: %s) command manager is lost", key, agent.Name)
}
resp.RemoteCommand = GetCommands(key, requestID)
namespaceReq := &grpcapi.RemoteExecRequest{RequestId: &requestID, ExecType: grpcapi.ExecutionType_LIST_NAMESPACE.Enum()}
manager.ExecCH <- namespaceReq
case _, ok := <-cmdResp.LinuxNamespaceDoneCH:
if !ok {
return nil, fmt.Errorf("%sagent(key: %s, name: %s) command manager is lost", key, agent.Name)
return nil, fmt.Errorf("failed to get linux namespaces, agent(key: %s, name: %s) command manager is lost", key, agent.Name)
}
resp.LinuxNamespace = GetNamespaces(key, requestID)
case _, ok := <-cmdResp.ExecDoneCH: // error occurred
if !ok {
return nil, fmt.Errorf("%sagent(key: %s, name: %s) command manager is lost", key, agent.Name)
return nil, fmt.Errorf("failed to execute command, agent(key: %s, name: %s) command manager is lost", key, agent.Name)
}
if len(GetCommands(key, requestID)) != 0 {
return &RemoteExecResp{RemoteCommand: GetCommands(key, requestID)}, nil
Expand Down
Loading
Loading