-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
[DSIP-19] Support k8s connections in the connection center, as well as external connections to the connection center in k8s tasks #14977
Conversation
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
@Data |
Check notice
Code scanning / CodeQL
Missing Override annotation Note
ConnectionParam.setPassword
|
||
protected String username; | ||
|
||
protected String password; |
Check notice
Code scanning / CodeQL
Missing Override annotation Note
ConnectionParam.getPassword
@xdu-chenrj The commit history seems not correct. |
yes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting for CI to pass
@xdu-chenrj |
Codecov Report
@@ Coverage Diff @@
## dev #14977 +/- ##
============================================
+ Coverage 38.19% 38.21% +0.01%
- Complexity 4684 4693 +9
============================================
Files 1275 1280 +5
Lines 45329 45410 +81
Branches 4949 4953 +4
============================================
+ Hits 17315 17354 +39
- Misses 26121 26163 +42
Partials 1893 1893
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
...ce-k8s/src/main/java/org/apache/dolphinscheduler/plugin/datasource/k8s/K8sClientWrapper.java
Fixed
Show fixed
Hide fixed
...ce-k8s/src/main/java/org/apache/dolphinscheduler/plugin/datasource/k8s/K8sClientWrapper.java
Fixed
Show fixed
Hide fixed
SonarCloud Quality Gate failed. 0 Bugs 50.5% Coverage Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
k8sTaskExecutionContext | ||
.setConfigYaml(JSONUtils.getNodeString(k8sTaskExecutionContext.getConnectionParams(), "kubeConfig")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can not directly change this. For normal task, like spark on k8s, K8sTaskExecutionContext
is constructed by TaskExecutionContextFactory
, when they call getClient
, connectionParams
is null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your suggestion
.../src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/K8sTaskParameters.java
Show resolved
Hide resolved
Hi @xdu-chenrj, non-K8S task should better be refactored and use k8s connection together with k8s task, maybe we have to revert this PR, or to fix this bug (refactor) ASAP. cc @EricGao888 |
ok |
@xdu-chenrj I suggest submitting a patch to fix it instead of reverting the whole PR. BTW, as the PR passed the CI, it seems the UT hadn't covered this case. I think it will be better to add related UT to cover this scenario for those tasks using k8s connection. |
Yes, thank you for your suggestion |
You can see |
pretty cool |
Thank you very much for your suggestion :D |
private K8sTaskExecutionContext setK8sTaskRelation(TaskInstance taskInstance) {
K8sTaskExecutionContext k8sTaskExecutionContext = null;
String namespace = "", kubeConfig = "";
log.info("getTaskParams {}", taskInstance.getTaskParams());
switch (taskInstance.getTaskType()) {
case "K8S":
case "KUBEFLOW":
K8sTaskParameters k8sTaskParameters =
JSONUtils.parseObject(taskInstance.getTaskParams(), K8sTaskParameters.class);
namespace = k8sTaskParameters.getNamespace();
kubeConfig = k8sTaskParameters.getKubeConfig();
break;
case "SPARK":
SparkParameters sparkParameters =
JSONUtils.parseObject(taskInstance.getTaskParams(), SparkParameters.class);
if (StringUtils.isNotEmpty(sparkParameters.getNamespace())) {
namespace = sparkParameters.getNamespace();
}
break;
default:
break;
}
if (StringUtils.isNotEmpty(namespace)) {
String configYaml = kubeConfig;
log.info("String configYaml {}", configYaml);
if (configYaml != null) {
k8sTaskExecutionContext =
new K8sTaskExecutionContext(configYaml, JSONUtils.toMap(namespace).get(NAMESPACE_NAME));
}
}
return k8sTaskExecutionContext;
} hi, I want to assign the value |
Can we move method |
I fixed this issue, and then I will create an issue and PR |
and I plan to submit a PR to fix the problem first, and then add UT. Is that okay? |
Glad to hear that!
Sure, you can. I think, for a single pr, sometimes, small is better :D |
…naged in connection center (apache#14977)" This reverts commit c532fea.
issue: #14338
Related issues: [DSIP-19][Feature] Add connection center feature for DS #10283
Mail: https://lists.apache.org/thread/xl6pb3sbrt0ffrf1fltcph39s9w1pjlx