-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Adds support for custom Server Name Indication (SNI) #1933
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-client:master
from
tigrato:support-tls-server-name
Jul 31, 2023
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
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
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
diff --git a/kubernetes/client/configuration.py b/kubernetes/client/configuration.py | ||
index 2b9dd96a50..ac5a18bf8a 100644 | ||
--- a/kubernetes/client/configuration.py | ||
+++ b/kubernetes/client/configuration.py | ||
@@ -144,6 +144,10 @@ def __init__(self, host="http://localhost", | ||
self.assert_hostname = None | ||
"""Set this to True/False to enable/disable SSL hostname verification. | ||
""" | ||
+ self.tls_server_name = None | ||
+ """SSL/TLS Server Name Indication (SNI) | ||
+ Set this to the SNI value expected by the server. | ||
+ """ | ||
|
||
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 | ||
"""urllib3 connection pool's maximum number of connections saved | ||
diff --git a/kubernetes/client/rest.py b/kubernetes/client/rest.py | ||
index 48cd2b7752..4f04251bbf 100644 | ||
--- a/kubernetes/client/rest.py | ||
+++ b/kubernetes/client/rest.py | ||
@@ -77,6 +77,9 @@ def __init__(self, configuration, pools_size=4, maxsize=None): | ||
if configuration.retries is not None: | ||
addition_pool_args['retries'] = configuration.retries | ||
|
||
+ if configuration.tls_server_name: | ||
+ addition_pool_args['server_hostname'] = configuration.tls_server_name | ||
+ | ||
if maxsize is None: | ||
if configuration.connection_pool_maxsize is not None: | ||
maxsize = configuration.connection_pool_maxsize |
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
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.
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.
Unfortunately I think this file is generated, in order to make permanent changes here I believe the PR would need to go to the generator repo
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 you provide some more information on what to do? Because the gen repo doesn't really say nor point to what needs to be updated. The contributing guide doesn't go into detail either.
This file seems to ref https://github.com/kubernetes-client/gen/blob/master/proto/dependencies.sh even more generated files from the apimachinery repo.
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.
@fabianvf @yliaog
The auto-generated code is available for
openapi-generator
version>=6.6.0
(PR).Since this repo uses version
v4.3.0
, I decided to apply a patch - similar to the current one that exists - to apply the necessary changes to support SNI. Once we start using a version that includes the upstream fix, the patch can be safely removed.Can you please check it again?
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.
thanks for the PR. it looks good to me, @fabianvf do you have any question or concern?