|
@@ -83,15 +83,26 @@ public class JobApiImpl implements JobApi {
|
|
|
);
|
|
);
|
|
|
} catch (ApiException e){
|
|
} catch (ApiException e){
|
|
|
LoggerUtil.error(logger, e, "删除Job失败,namespace={}, name={}, response={}", job.getNamespace(), job.getName(), e.getResponseBody());
|
|
LoggerUtil.error(logger, e, "删除Job失败,namespace={}, name={}, response={}", job.getNamespace(), job.getName(), e.getResponseBody());
|
|
|
-
|
|
|
|
|
if (e.getCode() == NOT_FOUND) {
|
|
if (e.getCode() == NOT_FOUND) {
|
|
|
throw new K8sApiException(NOT_FOUND, "namespace不存在");
|
|
throw new K8sApiException(NOT_FOUND, "namespace不存在");
|
|
|
}else {
|
|
}else {
|
|
|
throw K8s_SYSTEM_ERROR_EXCEPTION;
|
|
throw K8s_SYSTEM_ERROR_EXCEPTION;
|
|
|
}
|
|
}
|
|
|
} catch (Exception e){
|
|
} catch (Exception e){
|
|
|
- LoggerUtil.error(logger, e, "删除Job失败,namespace={}, name={}, response={}", job.getNamespace());
|
|
|
|
|
- throw e;
|
|
|
|
|
|
|
+ // k8s api 删除job的时候存在bug
|
|
|
|
|
+ if (e.getCause() instanceof IllegalStateException) {
|
|
|
|
|
+ IllegalStateException ise = (IllegalStateException) e.getCause();
|
|
|
|
|
+ if (ise.getMessage() != null && ise.getMessage().contains("Expected a string but was BEGIN_OBJECT")) {
|
|
|
|
|
+ // 实际上是删除成功了
|
|
|
|
|
+ LoggerUtil.error(logger, e, "Catching exception because of issue https://github.com/kubernetes/kubernetes/issues/65121");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LoggerUtil.error(logger, e, "删除Job失败,namespace={}, name={}, response={}", job.getNamespace());
|
|
|
|
|
+ throw e;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LoggerUtil.error(logger, e, "删除Job失败,namespace={}, name={}, response={}", job.getNamespace());
|
|
|
|
|
+ throw e;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|