-
Notifications
You must be signed in to change notification settings - Fork 1.4k
🐛 Do not overwrite global http.DefaultClient TLSConfig #13058
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
k8s-ci-robot
merged 1 commit into
kubernetes-sigs:main
from
jimmidyson:jimmi/extensionconfig-httpclient
Nov 27, 2025
Merged
Changes from all commits
Commits
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
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.
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.
@jimmidyson with this change we are moving away from a single, long lived http.Client and starting using many short lived httpClients, which as far as I understand, it means to give up on all the optimisations that exists inside golang http client (and defer
client.CloseIdleConnections()makes this very explicit)I need some time to dig more into details, but I was wondering what is your take on this?
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.
Honestly I'm not too worried about it because from what I can see this client is not that heavily used.
However I can take a look and try to provide a custom transport instead that dynamically configures the TLSConfig instead of creating a new client each time.
Uh oh!
There was an error while loading. Please reload this page.
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.
@fabriziopandini Pushed #13064 as an alternative implementation that fixes the same issue without creating a new
http.Clientevery call, while avoiding reconfiguring the globalhttp.DefaultClient.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.
This client is used by all the runtime extension calls; it is true that we did a few optimisations to reduce the number of calls, but it is definitely used in few controllers now.
Thanks. I will try to discuss with other maintainers what is the best solution here.
However, I also think that we should split the discussion in two parts:
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.
if #13064 is applied on top of all branches it will be exactly the same as it was before perf wise, but actually not having the bug of TLS config race..
and yes, i'd find it highly unlikely that a new client for each call would kick any bee hives.
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.
We need to fix the race one way or another. I can understand being rush averse at this stage of an RC, but we need to fix it.
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.
@jimmidyson BTW, i think something that is missing in the OP is the explanation of the issue at extension discovery.
i.e. what happens due to the TLS config race at scale.
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.
When this occurs the ExtensionConfigs become unreconciled and therefore ClusterClasses that reference them also become unreconcilable. Sorry I don't have resource histories showing this but the log I shared in the OP would trigger this.
We're hitting this with just 2 ExtensionConfigs and luckily for us so far this has recovered pretty quickly on requeue and thanks to jitter etc this does not materially affect cluster deployments. However, at scale with more ExtensionConfigs this race will be hit more often and could lead to worse outcomes.
I'll update the new PR with this detail as well as the original description from this PR.