Skip to content

added configuration 'http_proxy' to allow the usage of a proxy #206

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions kubernetes/client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ def __init__(self):
# Set this to True/False to enable/disable SSL hostname verification.
self.assert_hostname = None

# http proxy setting
self.http_proxy_url = None

@property
def logger_file(self):
"""
Expand Down
11 changes: 8 additions & 3 deletions kubernetes/client/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,14 @@ def __init__(self, pools_size=4, config=configuration):
kwargs['assert_hostname'] = config.assert_hostname

# https pool manager
self.pool_manager = urllib3.PoolManager(
**kwargs
)
if config.http_proxy_url is not None:
self.pool_manager = urllib3.proxy_from_url(
config.http_proxy_url, **kwargs
)
else:
self.pool_manager = urllib3.PoolManager(
**kwargs
)

def request(self, method, url, query_params=None, headers=None,
body=None, post_params=None, _preload_content=True, _request_timeout=None):
Expand Down