77
88import com .google .gson .Gson ;
99import io .codearte .props2yaml .Props2YAML ;
10- import org .hzero .websocket .constant .ClientWebSocketConstant ;
11- import org .hzero .websocket .helper .KeySocketSendHelper ;
12- import org .hzero .websocket .vo .MsgVO ;
1310import org .slf4j .Logger ;
1411import org .slf4j .LoggerFactory ;
1512import org .springframework .beans .factory .annotation .Autowired ;
4441import io .choerodon .devops .infra .mapper .DevopsClusterMapper ;
4542import io .choerodon .devops .infra .util .*;
4643
44+ import org .hzero .websocket .constant .ClientWebSocketConstant ;
45+ import org .hzero .websocket .helper .KeySocketSendHelper ;
46+ import org .hzero .websocket .vo .MsgVO ;
47+
4748
4849/**
4950 * Created by younger on 2018/4/18.
@@ -65,7 +66,7 @@ public class AgentCommandServiceImpl implements AgentCommandService {
6566 private static final String OPERATE_POD_COUNT = "operate_pod_count" ;
6667 private static final String OPERATE_DOCKER_REGISTRY_SECRET = "operate_docker_registry_secret" ;
6768 private static final String CLUSTER_AGENT = "choerodon-cluster-agent-" ;
68-
69+ private static final String RESTART_AGENT = "restart_agent" ;
6970
7071 private static final Pattern PATTERN = Pattern .compile ("^[-+]?[\\ d]*$" );
7172 private static final Gson gson = new Gson ();
@@ -446,4 +447,12 @@ public void sendChartMuseumAuthentication(Long clusterId, ConfigVO configVO) {
446447 sendToWebSocket (clusterId , msg );
447448 LOGGER .debug ("Finished to sendChartMuseumAuthentication. cluster id {}" , clusterId );
448449 }
450+
451+ @ Override
452+ public void sendRestartAgent (Long clusterId ) {
453+ AgentMsgVO msg = new AgentMsgVO ();
454+ msg .setType (RESTART_AGENT );
455+ msg .setKey (String .format (CLUSTER_FORMAT , clusterId ));
456+ sendToWebSocket (clusterId , msg );
457+ }
449458}
0 commit comments