GWphua opened a new pull request, #19433:
URL: https://github.com/apache/druid/pull/19433
### Description
The existing Kubernetes task runner schedules all tasks into a single
Kubernetes cluster. This PR adds a `multik8s` task runner mode that can
schedule tasks across multiple Kubernetes clusters while keeping a single
Overlord-level view of task capacity, task state, task logs, and task reports.
This is useful for Druid deployments that need to spread indexing work
across multiple Kubernetes clusters, drain or disable specific clusters, or
route tasks with a simple cluster selection strategy.
#### Added multi-cluster Kubernetes task runner
Added `MultipleKubernetesTaskRunner`, which wraps multiple per-cluster
`KubernetesTaskRunner` instances and exposes them through the existing
`TaskRunner` and `TaskLogStreamer` APIs.
The runner supports:
- round-robin, random, and least-task cluster selection strategies
- disabled clusters that are not selected for new tasks
- aggregated running, pending, known task, and task slot views
- task log and task report streaming routed to the owning cluster runner
- `k8s_cluster` task context tag injection for pod-template selection
#### Added multi-cluster runner configuration
Added `MultipleKubernetesTaskRunnerConfig`, configured under the existing
`druid.indexer.runner` prefix, with per-cluster settings for cluster name,
kubeconfig path, task namespace, Overlord identifier, and disabled state.
The multi-cluster runner reuses the existing Kubernetes runner configuration
for common task settings such as capacity, labels, annotations, sidecar
support, task cleanup, task timeout, and shared informer behavior.
#### Built per-cluster Kubernetes runners
Added `MultipleKubernetesTaskRunnerFactory`, which creates one
`KubernetesTaskRunner` per configured cluster and registers the new `multik8s`
runner type in `KubernetesOverlordModule`.
Each per-cluster runner gets its own Kubernetes client and task adapter
while sharing a single task tracking executor. The factory also honors
`useK8sSharedInformers` by using `CachingKubernetesPeonClient` when shared
informers are enabled.
#### Shared task runner capacity across clusters
Added `AutoscalableThreadPoolExecutor` and updated `KubernetesTaskRunner` so
multiple Kubernetes task runners can share one executor. This keeps the
configured runner capacity as a global limit across all configured clusters
instead of multiplying capacity by the number of clusters.
#### Release note
Added experimental support for running Kubernetes indexing tasks across
multiple Kubernetes clusters. Set `druid.indexer.runner.type=multik8s` and
configure `druid.indexer.runner.clusters` to schedule tasks across multiple
Kubernetes clusters from a single Overlord.
<hr>
##### Key changed/added classes in this PR
* `MultipleKubernetesTaskRunner`
* `MultipleKubernetesTaskRunnerConfig`
* `MultipleKubernetesTaskRunnerFactory`
* `MultipleKubernetesTaskRunnerDelegate`
* `AutoscalableThreadPoolExecutor`
* `KubernetesTaskRunner`
* `KubernetesOverlordModule`
<hr>
This PR has:
- [x] been self-reviewed.
- [ ] using the [concurrency
checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md)
(Remove this item if the PR doesn't have any relation to concurrency.)
- [ ] 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 or updated version, license, or notice information in
[licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
- [ ] 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]