-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Create a new KubernetesPeonClient that uses fabric8 informers to reduce load on an underlying k8s API #18599
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
Merged
Merged
Changes from all commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
47dce70
app code working but needs cleanup and testing
capistrant e4fbdf5
caching side cleaner. need to add back direct client
capistrant 8911e1f
Implementation ready for deeper UT and ET writing
capistrant 0a10243
Merge branch 'master' into k8s-overlord-api-redux
capistrant ce7493a
checkstyle cleanup
capistrant 8f13cda
Remove the busy waiting. Overhaul caching client testing
capistrant 3778883
some config and instantion cleanup along with basic docs
capistrant 5dcc64d
extnd the K8s task runner docker test to run with both direct and cac…
capistrant a1b1381
Merge branch 'master' into k8s-overlord-api-redux
capistrant af306e1
fix spelling and add resync to dictionary
capistrant 08764c5
fix strict compile issues
capistrant a90b2d2
fixup checkstyle
capistrant 0d9672c
fix k8s overlord module setup
capistrant 2f24623
Merge branch 'master' into k8s-overlord-api-redux
capistrant 1fe0f87
few small fixups
capistrant e9b3947
fix checkstyle
capistrant d62bbc7
fix up some issues with wait for job completion
capistrant 5f6920b
cleanup and fix some tests
capistrant 5b6c8f3
Make DruidKubernetesClient defend against invalid use if caching is off
capistrant 11db5ad
cleanup checkstyle
capistrant 144dd49
dont use deprecated method
capistrant 7fcbcec
doc update
capistrant 264879a
Merge branch 'master' into k8s-overlord-api-redux
capistrant 2301dde
fix spelling
capistrant 3455b0d
Merge branch 'master' into k8s-overlord-api-redux
capistrant 8983477
fix checkstyle after merge with master
capistrant 06ed528
Improve reliability of the Caching K8s Peon Client code and associate…
capistrant 3451026
fix checkstyle
capistrant d963d55
Modifications to try and reduce caching client api impact even more
capistrant 09ab11f
Fixup tests now that we have refactored log fetching
capistrant 7dd0fe8
remove some whitespace from the diff. Can be corrected in a future fo…
capistrant baf5015
one more whitespace cleanup
capistrant 4109b6c
more diff cleanup
capistrant d96cabe
Make another api usage optimization for the caching client. Clean up …
capistrant a7104a7
diff cleanup
capistrant e129bd0
Some better class javadocs for the k8s clients
capistrant c5cf208
logging and comment cleanup
capistrant 9bf9c4a
DruidKubernetesClient tidy up
capistrant 6b51c9b
javadoc link add
capistrant ab1cd89
Use background propagation policy when deleting jobs to lessen load o…
capistrant 9495e3c
fix an npe and add a test to caching client
capistrant 70d46a5
Merge branch 'master' into k8s-overlord-api-redux
capistrant b664b12
Merge branch 'master' into k8s-overlord-api-redux
capistrant b04e779
Remove AbstractK8sClient, rename DirectClient
kfaraz e1c1d13
Remove formatting changes in KubernetesPeonClient
kfaraz 6ea97f4
Remove more formatting changes
kfaraz ceb10bc
Address the more minor review comments
capistrant f447b7a
re-add log watch refactors to KubernetesPeonClient, they reduce API t…
capistrant 5653132
migrate timers to stopwatch in caching k8s client per review comments
capistrant aa8e12e
Remove unused code
capistrant 8df9dfe
style fix
capistrant ae29963
remove unneeded code
capistrant 66f3cda
Extract Caching client code from DruidKubernetesClient per review
capistrant f99673c
Make name for cache read methods more logical
capistrant 8ec81cf
Stop exposing the EventNotifier in DruidKubernetesCachingClient
capistrant 78e1c82
Improve informer executor name per review
capistrant ed671f9
Simplify informer setup for caching client
capistrant 6b58a29
cleanup caching client tests and add a lifecycle stop to the informers
capistrant 62ddcc3
Improve thread safety of KubernetesResourceEventNotifier
capistrant e58be26
Simply the peon waiting code for the caching client
capistrant 94bfa2a
Merge branch 'master' into k8s-overlord-api-redux
capistrant 4b7a408
Fix the k8s overlord module for the caching client
capistrant ef93c44
fix configs for docker embedded test
capistrant 53d0976
fix broken embedded tests
capistrant b2982c3
use the indexer not informer for cache reads
capistrant 4f735a4
Cleanup after another review round
capistrant File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...java/org/apache/druid/testing/embedded/k8s/KubernetesTaskRunnerCachingModeDockerTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.druid.testing.embedded.k8s; | ||
|
|
||
| /** | ||
| * Runs ingestion tests using SharedInformer caching mode. | ||
| * Uses Fabric8 SharedInformers to maintain a local cache of Jobs and Pods, | ||
| * reducing load on the Kubernetes API server. | ||
| */ | ||
| public class KubernetesTaskRunnerCachingModeDockerTest extends BaseKubernetesTaskRunnerDockerTest | ||
| { | ||
| @Override | ||
| protected boolean useSharedInformers() | ||
| { | ||
| return true; | ||
| } | ||
| } |
33 changes: 33 additions & 0 deletions
33
.../java/org/apache/druid/testing/embedded/k8s/KubernetesTaskRunnerDirectModeDockerTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.druid.testing.embedded.k8s; | ||
|
|
||
| /** | ||
| * Runs ingestion tests using direct K8s API interaction (default mode). | ||
| * Each task makes direct API calls to the Kubernetes API server. | ||
| */ | ||
| public class KubernetesTaskRunnerDirectModeDockerTest extends BaseKubernetesTaskRunnerDockerTest | ||
| { | ||
| @Override | ||
| protected boolean useSharedInformers() | ||
| { | ||
| return false; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,6 +72,25 @@ public interface KubernetesTaskRunnerConfig | |
|
|
||
| Integer getCapacity(); | ||
|
|
||
| /** | ||
| * Whether to use caching for Kubernetes resources tied to indexing tasks. | ||
| * <p> | ||
| * Enabling shared informers can significantly reduce the number of API calls made to the Kubernetes API server, | ||
| * improving performance and reducing load on the server. However, it also increases memory usage as informers | ||
| * maintain local caches of resources. | ||
| * </p> | ||
| */ | ||
| boolean isUseK8sSharedInformers(); | ||
|
|
||
| /** | ||
| * The resync period for the Kubernetes shared informers, if enabled. | ||
| * <p> | ||
| * Periodic resyncs ensure that the informer's local cache is kept up to date with the remote Kubernetes API server | ||
| * state. This helps handle missed events or transient errors. | ||
| * </p> | ||
| */ | ||
| Period getK8sSharedInformerResyncPeriod(); | ||
|
Comment on lines
+83
to
+92
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add 1-line javadocs for these. |
||
|
|
||
| static Builder builder() | ||
| { | ||
| return new Builder(); | ||
|
|
@@ -100,6 +119,8 @@ public static class Builder | |
| private Integer capacity; | ||
| private Period taskJoinTimeout; | ||
| private Period logSaveTimeout; | ||
| private boolean useK8sSharedInformers; | ||
| private Period k8sSharedInformerResyncPeriod; | ||
|
|
||
| public Builder() | ||
| { | ||
|
|
@@ -232,6 +253,18 @@ public Builder withLogSaveTimeout(Period logSaveTimeout) | |
| return this; | ||
| } | ||
|
|
||
| public Builder withUseK8sSharedInformers(boolean useK8sSharedInformers) | ||
| { | ||
| this.useK8sSharedInformers = useK8sSharedInformers; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder withK8sSharedInformerResyncPeriod(Period k8sSharedInformerResyncPeriod) | ||
| { | ||
| this.k8sSharedInformerResyncPeriod = k8sSharedInformerResyncPeriod; | ||
| return this; | ||
| } | ||
|
|
||
| public KubernetesTaskRunnerStaticConfig build() | ||
| { | ||
| return new KubernetesTaskRunnerStaticConfig( | ||
|
|
@@ -255,7 +288,9 @@ public KubernetesTaskRunnerStaticConfig build() | |
| this.labels, | ||
| this.annotations, | ||
| this.capacity, | ||
| this.taskJoinTimeout | ||
| this.taskJoinTimeout, | ||
| this.useK8sSharedInformers, | ||
| this.k8sSharedInformerResyncPeriod | ||
| ); | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.