fix(运维监控模块): 微服务应用多次点击重启后无反应
需要更新k8s应用的metadataTemplate字段才可使应用发生重启操作
This commit is contained in:
parent
555ef0fc80
commit
2d5d43b37e
|
|
@ -161,7 +161,7 @@ public class GlobalResponseFilter implements GlobalFilter, Ordered {
|
|||
ServerHttpResponseDecorator decoratedResponse = new ServerHttpResponseDecorator(originalResponse) {
|
||||
@Override
|
||||
public Mono<Void> writeWith(Publisher<? extends DataBuffer> body) {
|
||||
HttpStatus status = getStatusCode() != null ? getStatusCode() : HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
HttpStatus status = getStatusCode();
|
||||
if (!status.isError()) {
|
||||
return super.writeWith(body);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,7 +203,8 @@ public class MicroManagementServiceImpl extends CommonService implements IMicroM
|
|||
if (annotationsTemplateJson == null) {
|
||||
annotationsTemplateJson = new JSONObject();
|
||||
}
|
||||
annotationsTemplateJson.put("creationTimestamp", null);
|
||||
|
||||
annotationsTemplateJson.put("kubectl.kubernetes.io/restartedAt", DateUtils.getNowDate());
|
||||
metadataTemplateJson.put("annotations", annotationsTemplateJson);
|
||||
templateJson.put("metadata", metadataTemplateJson);
|
||||
applicationSpecJson.put("template", templateJson);
|
||||
|
|
@ -265,7 +266,7 @@ public class MicroManagementServiceImpl extends CommonService implements IMicroM
|
|||
public Boolean editApplication(String kind, String namespace, String applicationName, String yamlContent) {
|
||||
ApplicationType applicationType = ApplicationType.getApplicationTypeByKey(kind);
|
||||
try (Response response = remoteRancherService.editK8sApplication(applicationType.getFullName(), namespace, applicationName, yamlContent, SecurityContextHolder.getUserKey())) {
|
||||
return RancherResponseHandler.handleBoolean(response, "启动应用");
|
||||
return RancherResponseHandler.handleBoolean(response, "编辑应用");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue