-
Notifications
You must be signed in to change notification settings - Fork 937
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
Fetch all resources before watching them individually in KubernetesEndpointGroup
#6154
base: main
Are you sure you want to change the base?
Conversation
…ndpointGroup` Motivation: If `whenReady()` in `KubernetesEndpointGroup` completes with partial endpoints, the nodes could receive heavy loads. To prevent this , it would be better to fetch all resources using `GET` methods at the beginning instead of watching, and then use `WATCh` incrementally to update the information. Modifications: - Add `start()` method to initialize the resources at the beginning. - Remove the debounce logic which is no longer necessary. - Add `failInit()` in `DyanmicEndpointGroup` to notify an initialization failure. - Breaking) `KubernetesEndpointGroup` now requires `get` verbs in the RBAC rules to fetch endpoints. Result: `KubernetesEndpointGroup.whenReady()` now completes after collecting all endpoints.
🔍 Build Scan® (commit: fce9903) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 👍 👍
@@ -251,8 +239,54 @@ public static KubernetesEndpointGroupBuilder builder(Config kubeConfig) { | |||
this.portName = portName; | |||
this.nodeAddressFilter = nodeAddressFilter; | |||
this.autoClose = autoClose; | |||
watchJob(this::watchNode); | |||
watchJob(this::start); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to safeRun?
watchJob(this::start); | |
safeRun(this::start); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
safeRun sounds like the job is executed in the current thread. Let me rename it to executeJob
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds good. 👍
Please also fix the test failure. 😉 |
newServiceWatch.close(); | ||
return; | ||
initial = false; | ||
// Repeat until all `start()` requests are handled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't it just to this only once when start()
method is called concurrently? I'm not sure why it needs to handle all of them.
Motivation:
If
whenReady()
inKubernetesEndpointGroup
is complete with partial endpoints, the nodes could receive heavy loads unexpectedly. To prevent this, it would be better to fetch all resources usingGET
methods at the beginning instead of watching, and then useWATCH
incrementally to update the information.Modifications:
start()
method to initialize the resources at the beginning.failInit()
inDynamicEndpointGroup
to notify an initialization failure.KubernetesEndpointGroup
now requiresget
verbs in the RBAC rules to fetch endpoints.Result:
KubernetesEndpointGroup.whenReady()
is now complete after collecting all endpoints.