Closed carreter closed 5 months ago
Hi @carreter. Thanks for your PR.
I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test
on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test
label.
I understand the commands that are listed here.
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: carreter Once this PR has been reviewed and has the lgtm label, please assign cheftako for approval. For more information see the Kubernetes Code Review Process.
The full list of commands accepted by this bot can be found here.
@avrittrohwer for visibility
/ok-to-test
@carreter: The following test failed, say /retest
to rerun all failed tests or /retest-required
to rerun all mandatory failed tests:
Test name | Commit | Details | Required | Rerun command |
---|---|---|---|---|
pull-apiserver-network-proxy-make-lint-master | d2120466a6b2e8512c7294108b2fc2604780b326 | link | true | /test pull-apiserver-network-proxy-make-lint-master |
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.
An initial pass at the groundwork for #358 and #273 (i.e. allowing a dynamic proxy server count on both the server and the agent in a backwards-compatible manner). Currently a draft, depends on #632. Design doc here.
Changes
New package:
pkg/servercounter
This package is structured around the
ServerCounter
interface:Currently provided are
StaticServerCounter
, which simply returns a stored int, andCachedServerCounter
, which wraps anotherServerCounter
and provides catching functionality with a configurable cache expiry time.Proxy server
This PR wires the
ServerCounter
into the proxy server without changing its behavior by creating aStaticServerCounter
with the command-line provided count.Proxy agent
This PR wires the
ServerCounter
into the proxy agent without changing its behavior by creating aStaticServerCounter
with a default count of 0.This PR also adds the
respectReceivedServerCount
field to the agentClientSet
struct. This field toggles whether the server count received from the proxy server should overwrite the proxy agent's server counter. Since I didn't want to change the behavior of the agent yet, this is set totrue
by default.Open questions
Should
CountServers()
return anerror
?Sometimes the
ServerCounter
will fail to get an updated server count. In this case, we could haveCountServers()
return(int, error)
instead.I opted against this because we can handle errors in the
ServerCounter
itself. This simplifies things on the caller side and allows for including a fallback server count in theServerCounter
.Should
ServerCounter
include anUpdateCount(int)
method?It might be useful for clients to (a) temporarily override the server count or (b) request an update to any cached server counts. They could do this by calling
UpdateCount()
with a non-negative value to temporarily override the count or with -1 to reset the override and request a count update.I opted against this because the client can accomplish (a) using a
StaticServerCounter
(downside: this overwrites the previousServerCounter
if stored in the same field), and (b) seems like it would have limited use as theServerCounter
should be completely responsible for managing the server count.A possible workaround is to add the
UpdateCount()
method to justCachedServerCounter
rather than the entire interface. This allows for finer control of caching while maintaining a simple API for the general case.Should
respectReceivedServerCount
betrue
orfalse
by default?My take: have it
true
by default unless an alternative server count method is provided in the commandline args to the proxy agent. This ensures backwards compatibility with old proxy servers.