-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle various microcluster ready endpoints #142
Conversation
01eed65
to
6141475
Compare
Raises: | ||
K8sdConnectionError: If the response is Not Found on all endpoints. | ||
""" | ||
ready_endpoints = ["/core/1.0/ready", "/cluster/1.0/ready"] |
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'll try the "new one" first -- then back up with the old one
if ex.code == 404: | ||
logger.warning( | ||
"Encountered 404 while checking if micro-cluster is ready @ %s: %s", | ||
endpoint, | ||
ex, | ||
) | ||
# Try the next endpoint if the current one is not found | ||
continue |
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.
k8sd responding with a 404 is its way of saying "I see that request -- but that doesn't exist". A clear sign we should try another endpoint!
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.
So... this may be misleading the user into thinking something is wrong with the code.
Could the log be modified to mention this could be normal and we're cycling through possible endpoints?
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.
Maybe Trying endpoint 1 of 2: ...
not_found = InvalidResponseError(code=404, msg="Not Found") | ||
mock_send_request.side_effect = [not_found, not_found] |
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.
A wise man once said...
two wrongs don't make a right, but three lefts do
if ex.code == 404: | ||
logger.warning( | ||
"Encountered 404 while checking if micro-cluster is ready @ %s: %s", | ||
endpoint, | ||
ex, | ||
) | ||
# Try the next endpoint if the current one is not found | ||
continue |
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.
So... this may be misleading the user into thinking something is wrong with the code.
Could the log be modified to mention this could be normal and we're cycling through possible endpoints?
Overview
With the advent of v2 microcluster, the ready endpoint moved from
/cluster/1.0/ready
to/core/1.0/ready
because changing endpoints is a totally natural thing to do for runDetails
404
.K8sdConnectionError
if we run out of endpoints to try