Bugfix: do not panic when a yurthub serving port is disabled - #2744
Open
Rad710 wants to merge 1 commit into
Open
Bugfix: do not panic when a yurthub serving port is disabled#2744Rad710 wants to merge 1 commit into
Rad710 wants to merge 1 commit into
Conversation
ApplyTo leaves SecureServingInfo nil when BindPort <= 0, but prepareServerServing dereferenced it, so --proxy-secure-port=0 or --multiplexer-port=0 panicked at startup. Guard both serving blocks with a nil check; default ports stay positive so normal startup is unchanged. Signed-off-by: Rolando Medina Rosner <rolmedro@gmail.com>
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



What type of PR is this?
/kind bug
What this PR does / why we need it:
SecureServingOptions.ApplyToleaves theSecureServingInfonil whenBindPort <= 0(which is how a serving port is switched off), butprepareServerServingthen dereferenced it to setClientCA/DisableHTTP2. As a result, starting yurthub with--proxy-secure-port=0or--multiplexer-port=0panics before the servers are even created.This guards both the secure-proxy and multiplexer serving blocks with a nil check, matching
RunYurtHubServers, which already skips a nil serving config. The secure-proxy case logs a Warning (in-cluster clients reach the apiserver through it, so disabling it has a real consequence); the multiplexer case logs an Info.Default ports are positive, so the normal startup path is unchanged — only operators who explicitly set a serving port to 0 are affected, and for them the change turns a crash into a cleanly disabled listener.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Adds
cmd/yurthub/app/config/serving_disabled_port_test.gocovering both ports disabled, negative ports, only-the-multiplexer-off, a positive port still settingClientCA, and that the defaults are positive. The test panics without the guard.Does this PR introduce a user-facing change?