apache / dolphinscheduler

Apache DolphinScheduler is the modern data orchestration platform. Agile to create high performance workflow with low-code
https://dolphinscheduler.apache.org/
Apache License 2.0
12.44k stars 4.51k forks source link

[DSIP]Creating Users on Linux System Using Tenent_id in k8s Environment #16008

Open wjmmjr opened 1 month ago

wjmmjr commented 1 month ago

Search before asking

Motivation

When deploying the dolphinscheduler worker service in a k8s environment and mounting PVC, all files in the PVC have corresponding users. When the dolphinscheduler worker service restarts, the users in the container are cleared, and the users are recreated in order of connecting to the dolphinscheduler worker. At this time, the username and userid are not consistent with the situation before restarting. Due to the username and userid matching in the PVC file, the user corresponding to the PVC file is incorrect after restarting the container

Design Detail

Add tenantId to ProcessInstance.java and TaskExecutionContext.java Add method "createUser(int userId, String userName)" and "createUserIfAbsent(int userId, String userName)" and "createLinuxUser(int userId, String userName, String userGroup)" to OSUtils.java Modify method createTenant of TenantServiceImpl.java Modify method handleCommand of ProcessServiceImpl.java,add code "processInstance.setTenantId" Modify method buildProcessInstanceRelatedInfo of TaskExecutionContextBuilder.java,add code "taskExecutionContext.setTenantId" Modify method getOrCreateTenant of TaskExecutionContextUtils.java, add user by tenantId

Compatibility, Deprecation, and Migration Plan

No response

Test Plan

Run the dolphinscheduler worker service in the k8s environment and mount the shared PVC. Use different users to submit tasks, generate files in the PVC, and restart the dolphinscheduler worker service repeatedly. At this time, the user IDs in each worker are inconsistent

Code of Conduct

davidzollo commented 1 month ago

Good suggestion.

You can add your ideas to https://docs.qq.com/doc/DQ3BGVHZ1bXp5R2FZ at the community meeting for discussion. Conference theme: DS Community May 2024 Conference Meeting address: Tencent Meeting Conference theme: DolphinSchedule community meeting Meeting time: May 29, 2024 20:00-21:00 (GMT+08:00) China Standard Time - Beijing Meeting address: https://meeting.tencent.com/dm/rC7GQmeBb4MQ

Tencent Meeting: 601-804-233

Tencent Document: https://docs.qq.com/doc/DQ3BGVHZ1bXp5R2FZ

By the way, if you need any help, please contact me, here is my address, LinkedIn: https://www.linkedin.com/in/davidzollo My WeChat: davidzollo