Skip to content

Commit b7124e4

Browse files
authored
Merge branch 'dev' into dev
2 parents 92cece5 + d92e2b3 commit b7124e4

File tree

5 files changed

+13
-27
lines changed

5 files changed

+13
-27
lines changed

.github/mergeable.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,5 @@ mergeable:
5858
regex: 'feature|bug|improvement|document|chore'
5959
message: 'Label must include one of the following: `feature`, `bug`, `improvement`, `document`, `chore`'
6060
- must_include:
61-
regex: '\d+\.\d+\.\w+'
62-
message: 'Label must include one or more version numbers.'
61+
regex: 'ready-to-merge'
62+
message: 'Please check if there are PRs that already have a `ready-to-merge` label and can be merged, if exists please merge them first.'

dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/k8s/K8sClientService.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ public class K8sClientService {
4444

4545
public ResourceQuota upsertNamespaceAndResourceToK8s(K8sNamespace k8sNamespace,
4646
String yamlStr) throws RemotingException {
47-
upsertNamespaceToK8s(k8sNamespace.getNamespace(), k8sNamespace.getClusterCode());
47+
if (!checkNamespaceToK8s(k8sNamespace.getNamespace(), k8sNamespace.getClusterCode())) {
48+
throw new RemotingException(String.format(
49+
"namespace %s does not exist in k8s cluster, please create namespace in k8s cluster first",
50+
k8sNamespace.getNamespace()));
51+
}
4852
return upsertNamespacedResourceToK8s(k8sNamespace, yamlStr);
4953
}
5054

@@ -101,19 +105,9 @@ private Optional<Namespace> getNamespaceFromK8s(String name, Long clusterCode) t
101105
return list;
102106
}
103107

104-
private Namespace upsertNamespaceToK8s(String name, Long clusterCode) throws RemotingException {
108+
private boolean checkNamespaceToK8s(String name, Long clusterCode) throws RemotingException {
105109
Optional<Namespace> result = getNamespaceFromK8s(name, clusterCode);
106-
// if not exist create
107-
if (!result.isPresent()) {
108-
KubernetesClient client = k8sManager.getK8sClient(clusterCode);
109-
Namespace body = new Namespace();
110-
ObjectMeta meta = new ObjectMeta();
111-
meta.setNamespace(name);
112-
meta.setName(name);
113-
body.setMetadata(meta);
114-
return client.namespaces().create(body);
115-
}
116-
return result.get();
110+
return result.isPresent();
117111
}
118112

119113
}

dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/K8SNamespaceServiceImpl.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.apache.dolphinscheduler.dao.entity.User;
3030
import org.apache.dolphinscheduler.dao.mapper.ClusterMapper;
3131
import org.apache.dolphinscheduler.dao.mapper.K8sNamespaceMapper;
32-
import org.apache.dolphinscheduler.remote.exceptions.RemotingException;
3332

3433
import org.apache.commons.collections4.CollectionUtils;
3534
import org.apache.commons.lang3.StringUtils;
@@ -322,15 +321,7 @@ public Map<String, Object> deleteNamespaceById(User loginUser, int id) {
322321
putMsg(result, Status.K8S_NAMESPACE_NOT_EXIST, id);
323322
return result;
324323
}
325-
if (!Constants.K8S_LOCAL_TEST_CLUSTER_CODE.equals(k8sNamespaceObj.getClusterCode())) {
326-
try {
327-
k8sClientService.deleteNamespaceToK8s(k8sNamespaceObj.getNamespace(), k8sNamespaceObj.getClusterCode());
328-
} catch (RemotingException e) {
329-
log.error("Namespace delete in k8s error, namespaceId:{}.", id, e);
330-
putMsg(result, Status.K8S_CLIENT_OPS_ERROR, id);
331-
return result;
332-
}
333-
}
324+
334325
k8sNamespaceMapper.deleteById(id);
335326
log.info("K8s namespace delete complete, namespace:{}.", k8sNamespaceObj.getNamespace());
336327
putMsg(result, Status.SUCCESS);

dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskInstance.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,8 @@ public boolean isTaskComplete() {
347347

348348
return this.getState().isSuccess()
349349
|| this.getState().isKill()
350-
|| (this.getState().isFailure() && !taskCanRetry());
350+
|| (this.getState().isFailure() && !taskCanRetry())
351+
|| this.getState().isForceSuccess();
351352
}
352353

353354
public boolean isSubProcess() {

dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/ProcessUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public static String getPidsStr(int processId) throws Exception {
135135
}
136136

137137
/**
138-
* cacel k8s / yarn application
138+
* cancel k8s / yarn application
139139
*
140140
* @param taskExecutionContext
141141
* @return

0 commit comments

Comments
 (0)