GWphua opened a new pull request, #17701:
URL: https://github.com/apache/druid/pull/17701

   ### Description
   
   There may be some circumstances where we want to change the config of the 
task pod, such as changing the cpu requests/limits of default task pods by 
editing the base YAML pod template file. In my case, I am editing something 
that looks like this [example 
ConfigMap](https://druid.apache.org/docs/latest/development/extensions-contrib/k8s-jobs/#custom-template-pod-adapter),
 to directly make changes to the pod templates. 
   
   However, since the code only updates `HashMap<String, PodTemplate> 
templates` during Overlord initialization, the changes are not immediately 
reflected.
   
   This PR aims to solve this problem and make Druid more adaptable in 
Kubernetes environments. Instead of internally keeping track of the 
deserialized PodTemplates we have read from all template files, we will now run 
the deserialization process whenever a new Task Pod is to be created. Do note 
this PR does not support reading from newly created pod template files. (e.g. 
If we create a `newPodTemplate.yaml`, we will still need to let the Overlord 
run template initialization for the new file to take effect).
   
   The original intention of fail-fast for invalid pod templates is retained by 
validating all of the pod templates defined during initialization. 
   
   #### Performance Considerations
   Given that a ingestion task will create `n` task pods, and we have `k` pod 
templates defined, we will be reading from the pod template `n + k` times 
instead of just `k` times. 
   
   #### Release note
   <!-- Give your best effort to summarize your changes in a couple of 
sentences aimed toward Druid users. 
   
   You can now configure Kubernetes task pod specifications by directly editing 
existing pod templates.
   
   ##### Key changed/added classes in this PR
    * `PodTemplateSelectStrategy.java`
    * `SelectorBasedPodTemplateSelectStrategy.java`
    * `TaskTypePodTemplateSelectStrategy.java`
    * `DynamicConfigPodTemplateSelector.java`
    * `PodTemplateTaskAdapter.java`
    * `SelectorBasedPodTemplateSelectStrategyTest.java`
   
   <hr>
   
   <!-- Check the items by putting "x" in the brackets for the done things. Not 
all of these items apply to every PR. Remove the items which are not done or 
not relevant to the PR. None of the items from the checklist below are strictly 
necessary, but it would be very helpful if you at least self-review the PR. -->
   
   This PR has:
   
   - [x] been self-reviewed.
   - [ ] added documentation for new or modified features or behaviors.
   - [x] a release note entry in the PR description.
   - [ ] added Javadocs for most classes and all non-trivial methods. Linked 
related entities via Javadoc links.
   - [x] added comments explaining the "why" and the intent of the code 
wherever would not be obvious for an unfamiliar reader.
   - [x] added unit tests or modified existing tests to cover new code paths, 
ensuring the threshold for [code 
coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
 is met.
   - [ ] added integration tests.
   - [x] been tested in a test Druid cluster.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to