|
| 1 | +diff --git a/kubernetes/client/rest.py b/kubernetes/client/rest.py |
| 2 | +index 7c461b32e..e88290ef7 100644 |
| 3 | +--- a/kubernetes/client/rest.py |
| 4 | ++++ b/kubernetes/client/rest.py |
| 5 | +@@ -81,27 +81,40 @@ class RESTClientObject(object): |
| 6 | + else: |
| 7 | + maxsize = 4 |
| 8 | + |
| 9 | ++ if configuration.disable_strict_ssl_verification: |
| 10 | ++ ssl_context = ssl.create_default_context(cafile=configuration.ssl_ca_cert) |
| 11 | ++ if configuration.cert_file: |
| 12 | ++ ssl_context.load_cert_chain( |
| 13 | ++ configuration.cert_file, keyfile=configuration.key_file |
| 14 | ++ ) |
| 15 | ++ if not configuration.verify_ssl: |
| 16 | ++ ssl_context.check_hostname = False |
| 17 | ++ ssl_context.verify_mode = ssl.CERT_NONE |
| 18 | ++ if hasattr(ssl, 'VERIFY_X509_STRICT') and hasattr(ssl_context, 'verify_flags'): |
| 19 | ++ ssl_context.verify_flags &= ~ssl.VERIFY_X509_STRICT |
| 20 | ++ ssl_pool_kwargs = {'ssl_context': ssl_context} |
| 21 | ++ else: |
| 22 | ++ ssl_pool_kwargs = { |
| 23 | ++ 'cert_reqs': cert_reqs, |
| 24 | ++ 'ca_certs': configuration.ssl_ca_cert, |
| 25 | ++ 'cert_file': configuration.cert_file, |
| 26 | ++ 'key_file': configuration.key_file, |
| 27 | ++ } |
| 28 | ++ |
| 29 | + # https pool manager |
| 30 | + if configuration.proxy and not should_bypass_proxies(configuration.host, no_proxy=configuration.no_proxy or ''): |
| 31 | + self.pool_manager = urllib3.ProxyManager( |
| 32 | + num_pools=pools_size, |
| 33 | + maxsize=maxsize, |
| 34 | +- cert_reqs=cert_reqs, |
| 35 | +- ca_certs=configuration.ssl_ca_cert, |
| 36 | +- cert_file=configuration.cert_file, |
| 37 | +- key_file=configuration.key_file, |
| 38 | + proxy_url=configuration.proxy, |
| 39 | + proxy_headers=configuration.proxy_headers, |
| 40 | ++ **ssl_pool_kwargs, |
| 41 | + **addition_pool_args |
| 42 | + ) |
| 43 | + else: |
| 44 | + self.pool_manager = urllib3.PoolManager( |
| 45 | + num_pools=pools_size, |
| 46 | + maxsize=maxsize, |
| 47 | +- cert_reqs=cert_reqs, |
| 48 | +- ca_certs=configuration.ssl_ca_cert, |
| 49 | +- cert_file=configuration.cert_file, |
| 50 | +- key_file=configuration.key_file, |
| 51 | ++ **ssl_pool_kwargs, |
| 52 | + **addition_pool_args |
| 53 | + ) |
0 commit comments