feat: add proxy_ssl_context to Configuration for a separate proxy TLS context - #2658
feat: add proxy_ssl_context to Configuration for a separate proxy TLS context#2658emmanuel-adu wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: emmanuel-adu The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @emmanuel-adu! |
… context Adds a proxy_ssl_context parameter to Configuration and threads it through RESTClientObject to urllib3.ProxyManager, so the HTTPS proxy's own TLS certificate can be validated independently of the destination (Kubernetes API server) TLS settings - the "HTTPS Proxy + HTTPS Destination" scenario urllib3 documents at: https://urllib3.readthedocs.io/en/stable/advanced-usage.html#https-proxy-https-destination kubernetes/client is generated from kubernetes-client/gen; this applies the equivalent of the companion gen-repo patch directly to the already-generated files, so the feature is usable now rather than waiting on the next full regeneration. Added an end-to-end test (kubernetes/e2e_test) using a mock HTTPS proxy and a mock HTTPS destination server, each with an independent self-signed CA - it doesn't require a live cluster, only openssl on PATH. Verified: without proxy_ssl_context, connecting through a proxy with a different CA than the destination fails with CERTIFICATE_VERIFY_FAILED; with it set to trust the proxy's CA, the connection succeeds and the destination is still validated against its own separate CA.
6985e88 to
f526d68
Compare
|
/kind feature |
|
|
||
|
|
||
| import copy | ||
| import ssl |
There was a problem hiding this comment.
This file is generated by upstream openapi-generator. Please send a PR to update the upstream generator to properly support this feature.
There was a problem hiding this comment.
Opened kubernetes-client/gen#308 to add proxy_ssl_context for the sync client, following the existing pattern, and this PR applies that generated change now.
Or are you asking for this to be implemented in OpenAPITools/openapi-generator itself instead?
Fixes #2387.
Configurationgainsproxy_ssl_context: Optional[ssl.SSLContext] = None, passed through tourllib3.ProxyManagerinRESTClientObject. This lets the HTTPS proxy's TLS cert be validated independently of the destination (K8s API server) settings - the "HTTPS Proxy + HTTPS Destination" scenario urllib3 already supports natively.kubernetes/clientis generated from kubernetes-client/gen; companion PR kubernetes-client/gen#308 adds the same patch there. This PR applies it to the already-generated files so it's usable now.Verification:
kubernetes/e2e_test/test_issue_2387_proxy_ssl_context.pyspins up a mock HTTPS proxy and destination server with independent self-signed CAs (no live cluster needed). Withoutproxy_ssl_context: fails withCERTIFICATE_VERIFY_FAILED. With it set to trust the proxy's CA: succeeds, destination still validated separately.