-
Notifications
You must be signed in to change notification settings - Fork 185
Conversation
Codecov Report
@@ Coverage Diff @@
## master #133 +/- ##
==========================================
- Coverage 92.86% 92.62% -0.24%
==========================================
Files 13 13
Lines 1345 1356 +11
==========================================
+ Hits 1249 1256 +7
- Misses 96 100 +4
Continue to review full report at Codecov.
|
It would be nice to have those 3 commits squashed into 1 |
Doesn't GitHub support that when merging the PR? |
Manually yes, but we’re using bots to merge the commits so usually the commits need to be squashed.
… 在 2019年6月29日,01:01,Mitar ***@***.***> 写道:
Doesn't GitHub support that when merging the PR?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Done. |
/cc |
watch/watch.py
Outdated
yield self.unmarshal_event(line, return_type) | ||
event = self.unmarshal_event(line, return_type) | ||
if isinstance(event, dict) and event['type'] == 'ERROR': | ||
obj = event['raw_object'] |
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.
Is it safe to assume the APIs won't change for accessing event['raw_object']['code']
, @roycaihw ?
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 contract is that apiserver will always send a watch event of ERROR
type with object of metav1.Status
type.
We can check if the dict has the key code
and handle non-existence like what client-go does
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.
looks good in general. One major question about the retry behavior
watch/watch.py
Outdated
yield self.unmarshal_event(line, return_type) | ||
event = self.unmarshal_event(line, return_type) | ||
if isinstance(event, dict) and event['type'] == 'ERROR': | ||
obj = event['raw_object'] |
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 contract is that apiserver will always send a watch event of ERROR
type with object of metav1.Status
type.
We can check if the dict has the key code
and handle non-existence like what client-go does
watch/watch.py
Outdated
# but only if we have not already retried. | ||
if not retry_after_410 and obj['code'] == 410: | ||
retry_after_410 = True | ||
break |
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 should not retry the watch request with the same RV when it's already gone in apiserver
we can retry on 500 and 504 according to the client-go implementation
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.
@yliaog pointed out that we need to be careful about the code structure here. We want to be consistent to kubernetes client-go in terms of what a watch is capable of doing
- In client-go, a watch function call doesn't retry on err. A client can implement their own handling for watch errors
- client-go provides tooling like informer and retrywatcher for clients to leverage, which have retry logics for watch errors
We should be consistent and provide the same choices to our user
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.
But that would be backwards incompatible with current offering by Python package? It already supports retrying. So I think for Python it seems we already made decision that watch is retrying.
@@ -91,7 +91,7 @@ def unmarshal_event(self, data, return_type): | |||
except ValueError: | |||
return data | |||
js['raw_object'] = js['object'] | |||
if return_type: | |||
if return_type and js['type'] != 'ERROR': |
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.
this is where we fail to deserialize the response. Good catch
is this good to go ? |
Can someone review and approve the PR? we meet the problem now... Thanks. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Could you fix the merge conflict please ? |
Sorry. I will look into this now. |
Codecov Report
@@ Coverage Diff @@
## master #133 +/- ##
==========================================
- Coverage 92.69% 92.50% -0.20%
==========================================
Files 13 13
Lines 1519 1547 +28
==========================================
+ Hits 1408 1431 +23
- Misses 111 116 +5
Continue to review full report at Codecov.
|
Done. |
I have updated this. Please review it before it gets rotten again. |
thanks for the PR. /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mitar, yliaog The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
PR kubernetes-client#133 introduces the usage of `http` module for checking the status code for `GONE` HTTP status. However, this doesn't work in Python 2.7. This commit checks if the interpreter is Python 2 and imports the status code from `httplib` module instead and unifies the approach to the checks. Signed-off-by: Nabarun Pal <[email protected]>
This is a followup to #102 and fixes #57.