kubernetes-client/python-base

kubernetes.stream with proxy

AyliD opened this issue · 7 comments

AyliD commented

Seems like even though i have setup proxy to all of my k8s python api calls i cannot use stream in order to perform the call to connect_get_namespaced_pod_exec

c = client.Configuration()
c.proxy = proxy_url
client.Configuration.set_default(c)

stream(api.connect_get_namespaced_pod_exec, 'some_name', 'default', command="/bin/sh", stderr=True, stdin=False, stdout=True, tty=True)

the class 'WSClient' doesnt seem to take this into account:
Example for the cod e i expected:

ws.connect = ('wss://blabla.com', http_proxy_host='ip', http_proxy_port='8080')
AyliD commented

The exception im getting prior to fix is:

    (data) = self.connect_get_namespaced_pod_exec_with_http_info(name, namespace, **kwargs)
  File "/data/users/ayeletrd/fbsource/fbcode/buck-out/dev/gen/express_wifi/partners/setup/standalone/partner_setup#link-tree/kubernetes/client/apis/core_v1_api.py", line 935, in connect_get_namespaced
_pod_exec_with_http_info
    collection_formats=collection_formats)
  File "/data/users/ayeletrd/fbsource/fbcode/buck-out/dev/gen/express_wifi/partners/setup/standalone/partner_setup#link-tree/kubernetes/client/api_client.py", line 334, in call_api
    _return_http_data_only, collection_formats, _preload_content, _request_timeout)
  File "/data/users/ayeletrd/fbsource/fbcode/buck-out/dev/gen/express_wifi/partners/setup/standalone/partner_setup#link-tree/kubernetes/client/api_client.py", line 168, in __call_api
    _request_timeout=_request_timeout)
  File "/data/users/ayeletrd/fbsource/fbcode/buck-out/dev/gen/express_wifi/partners/setup/standalone/partner_setup#link-tree/kubernetes/stream/stream.py", line 31, in _intercept_request_call
    return ws_client.websocket_call(config, *args, **kwargs)
  File "/data/users/ayeletrd/fbsource/fbcode/buck-out/dev/gen/express_wifi/partners/setup/standalone/partner_setup#link-tree/kubernetes/stream/ws_client.py", line 259, in websocket_call
    raise ApiException(status=0, reason=str(e))
kubernetes.client.rest.ApiException: (0)
AyliD commented

For all other API calls (except the exec) proxy works great.

resp = api.read_namespaced_pod(name=name, namespace='default')
print(f"{type(resp)}")
<class 'kubernetes.client.models.v1_pod.V1Pod'>

/assign @roycaihw

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.