-
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-63][k8s] Support User-customized K8s YAML Task #16478
Comments
@caishunfeng pls help to add this issue to #14102 |
Done. You're also DS Committer and have permission to add to it. |
Before discussing this DSIP, I hope everyone can reach a basic consensus. Supporting customization can indeed meet more demand scenarios, but excessive customization can bring more problems. I see in the design that it supports users to directly create pod and configmap, and even supports creating multiple POD. Regarding the support for configmap, I have some questions:
Regarding the support for pod, I have some questions:
If the issues are not adequately addressed, I am afraid I will vote -1 on this DSIP. |
5.Perhaps this issue can be targeted at a single pod, without considering multiple pods. In fact, if there are multiple pods in a node, we can give multiple pods a label with the value of processInstanceId+taskInstanceId, and obtain multiple pods through processInstance and obtain logs separately. @Gallardot cc @EricGao888 @Mighten @SbloodyS WDYT? |
Totally agreed with @Gallardot From my persional perspective, since DS is a scheduling system. The current k8s task is mainly used to replace the cron-job of k8s. And we have no plans to support k8s deployment scheduling management since this maintenance will involve a huge amount of work. So we need to reach a basic consensus. |
This is indeed too big. At present, the most commonly used in our company are configMap and pod types. Deployments are only used when using flink. For SaaS type products.ConfigMap is usually initiated by users or when users modify their own configurations. In most cases, pod type is the most commonly used type. We can open an issue only for pods and first discuss how to complete type of pods. |
For the scenario of a pod with multiple containers, I think it is necessary to divide the logs by container. When querying the logs, the front end needs to pass the container name to check the logs of the specific container. The front end needs to make a table to switch containers to view the logs. This transformation is a bit much. I hope that this issue will only consider a single pod and a single container. |
I’m sorry, but I don’t agree with this view. Pods are the most commonly used because they are the basic unit of service workload. But they are also the least used since only early versions of Kubernetes directly used pods. That’s why more advanced workload like Deployments and StatefulSets were introduced later. Managing the lifecycle of pods is an important task in Kubernetes, not just creating a pod. |
From the current low-code functions of k8s Task, it is to put a pod in a job type task, which is not much different from a single pod task. |
I agree with @Gallardot thinking. And for @fuchanghai said support pod level. Few questions:
Overall, vote -1 for this DSIP. |
My suggestion is that using a single pod with a single container, this scenario is suitable for rapid testing and development. And to concern, my response are as follows, Pod names must be unique within the same namespace in Kubernetes. DS can generate unique names programmatically using Kubernetes Java Client API by appending identifiers like workflow name, task ID, and timestamp or uuid, this is not difficult.
|
Closing for no plans to do this. |
Action List: Extension of operations for the k8s YAML task:
Search before asking
Motivation
Supporting user-customized K8s YAML tasks has the following benefits:
Flexibility: Unlike the existing K8s low-code job with limited functionality, YAML tasks provide users with the flexibility to define sophisticated task instances in DolphinScheduler, similar to how custom JSON does in DataX.
Workflow Customization: Users can integrate operational and maintenance processes into DolphinScheduler using YAML for complex workflows.
Configuration Requirements: The current K8s low-code job does not meet users' in-depth needs, particularly for tasks involving multiple pods or specific configurations like environment variables and tolerations; in contrast, K8s YAML tasks do.
In short, by enabling user-customized YAML tasks, DolphinScheduler can better support a wide range of Kubernetes-based workflows and operational requirements.
Design Detail
2.1 Design Overview
The following is a Swimlane Diagram showing how this k8s YAML task is embedded into Apache DolphinScheduler:
Figure 2-1(1). Design Overview
2.2 Frontend Design
The frontend adds support for user-customized k8s YAML tasks while remaining compatible with the original k8s low-code jobs.
Figure 2-2(1). Design Overview
The Web UI layouts
When the user switches on the Custom Template, the Low-code k8s Job fields should hide and YAML editor should appear (or vice versa), similar to the JSON Custom Template in the DataX plugin.
This feature, as shown in Figure 2-2(1), is implemented using the Vue component span, which is controlled by reactive variables (such as
yamlEditorSpan
) in the filedolphinscheduler-ui/src/views/projects/task/components/node/fields/use-k8s.ts
.The Request body
When the user switches to Custom Template mode, the request body should include only YAML-related fields (
customConfig
andyamlContent
), and all previously hidden fields should not be sent.This feature is implemented using the
taskParams
in the filedolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts
i18n/locales
Apache DolphinScheduler is an international software and should support multiple languages.
The text on the Web UI are retrieved from variables defined in the file
dolphinscheduler-ui/src/locales/{en_US, zh_CN}/project.ts
. And for user-customized k8s YAML tasks, there are three key variables to consider:k8s_custom_template
: the label for the switch to enable user-customized k8s YAML tasks.k8s_yaml_template
: the label for the text editor used to input user YAML.k8s_yaml_empty_tips
: the warning message displayed when a user tries to submit empty YAMLThis feature is implemented by invoking
t('project.node.${variable_name}')
(such ast('project.node.k8s_yaml_template')
) in the filedolphinscheduler-ui/src/views/projects/task/components/node/fields/use-k8s.ts
.2.3 Backend Design
The backend design describes the process of how the worker executes user-customized k8s YAML tasks. As shown in Figure 2-3(1), we can see how user-customized k8s YAML Pod tasks are related to the original k8s low-code jobs.
Figure 2-3(1). Backend Design Overview
After the worker checks the parameters,
K8sYamlTaskExecutor
is loaded for the current user-customized k8s YAML Pod task. Once the YAML is parsed intoHasMetadata
, itskind
field is used to assignabstractK8sOperation
asK8sPodOperation
for executing the YAML Pod task.K8s Task Executors
Figure 2-3(2). K8s Task Executors
Three k8s task executor are involved, as shown in Figure 2-3(2):
AbstractK8sTaskExecutor
is an abstract class that represents a k8s task executor.K8sTaskExecutor
is a concrete class that extendsAbstractK8sTaskExecutor
to represent a low-code executorK8sYamlTaskExecutor
is a concrete class that extendsAbstractK8sTaskExecutor
to represent a user-customized k8s YAML task executor.K8s Operation handler
Figure 2-3(3). K8s Operation Handlers
Two operation handlers are involved, as shown in Figure 2-3(3):
AbstractK8sOperation
is an interface representing all k8s resource operations.K8sPodOperation
is a concrete class that implementsAbstractK8sOperation
to handle Pod operations2.4 Usecase Design
A typical use case for a k8s YAML task includes uploading YAML, online workflows, and starting workflows, similar to k8s low-code jobs, unless users switch to the Custom Template option to fill in YAML.
Figure 2-4(1). Usecase Design
Compatibility, Deprecation, and Migration Plan
3.1 Compatibility Plan
The user-customized k8s YAML feature requires only
customConfig
to be activated, By default, the value is 0, which applies to the existing k8s low-code jobs.The remainder of this section will demonstrate the flexibility and compatibility of this design by using the example of introducing
Configmaps
:After parsing with
YamlUtils::load
, thekind
field acquired bythis.metadata.getKind()
will beConfigMaps
. Then,this.k8sYamlType
is determined and used to generate the corresponding operations:Consequently,
generateOperation()
will setthis.abstractK8sOperation
to a new instance ofK8sConfigmapsOperation
. Next, we can implement K8sConfigmapsOperation to handle the ConfigMaps operations.3.2 Deprecation Plan
N/A for now, waiting for community opinions.
3.3 Migration Plan
N/A for now, waiting for community opinions.
Test Plan
4.1 Overview
The User-customized k8s YAML task feature allows users to submit YAML task to k8s, including Pod, ConfigMaps, and other resources.
This test plan aims to ensure that the feature functions as expected and meets user requirements.
4.2 Scope
Code of Conduct
The text was updated successfully, but these errors were encountered: