-
Notifications
You must be signed in to change notification settings - Fork 183
Change utility functions to use newly generated client #34
Conversation
We can ignore CI failure on this PR as the upstream client is updated to this change in kubernetes-client/python#353 and if CI passes there, it would be good enough. |
8b386bb
to
ca29238
Compare
config/kube_config.py
Outdated
config = type.__call__(Configuration) | ||
loader.load_and_set(config) | ||
Configuration.set_default(config) | ||
print("ZZZ1: %s" % config.api_key) |
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.
Print statement should be removed :)
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.
The PR is still a Work In Progress :)
@@ -368,8 +372,8 @@ def new_client_from_config( | |||
"""Loads configuration the same as load_kube_config but returns an ApiClient | |||
to be used with any API object. This will allow the caller to concurrently | |||
talk with multiple clusters.""" | |||
client_config = ConfigurationObject() | |||
client_config = type.__call__(Configuration) |
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.
Why is the call required?
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.
We need a fresh configuration object not the default one. With the change in Configuration class in swagger-codegen (that we did), creating a configuration object will give you the default object that has been set before. But here if we get that, we would have mixed old/new configuration. We rather want a fresh Configuration object with __init__
default values not the set_default
'ed object.
stream/ws_client.py
Outdated
header.append("Sec-WebSocket-Protocol: %s" % | ||
configuration.ws_streaming_protocol) | ||
if headers and 'sec-websocket-protocol' in headers: | ||
header.append("sec-websocket-protocol: %s" % headers['authorization']) |
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.
Not autorization but 'sec-websocket-protocol'
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.
Indeed it can be use get with default value:
headers.get('sec-websocket-procotol', 'v4.channel.k8s.io')
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.
doesn't help much because if headers is None we still want a default value.
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.
Mehdy, we are checking for
'sec-websocket-protocol' in headers
BUT then using on line 52
headers['authorization']
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.
line 52 should be
header.append("sec-websocket-protocol: %s" % headers['sec-websocket-protocol'])
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.
Nice catch. Fixed.
Now this is ready to review. |
@pokoli @dims Can you help reviewing this PR? Please ignore CI failure. That won't fix until I submit this and merge kubernetes-client/python#353 |
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.
please see inline request
…aring to use swagger-codegen HEAD
LGTM 👍 |
Ref: kubernetes-client/python#341