Skip to content
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

Add retry after receiving too many requests error from kubernetes #963

Merged
merged 1 commit into from
Feb 7, 2023

Conversation

wjsi
Copy link
Contributor

@wjsi wjsi commented Sep 20, 2022

Add retry when receiving HTTP 429 (too many reequests) from k8s when performing infinite_watch.

Fixes #962

@gdlx
Copy link

gdlx commented Jan 16, 2023

I'm facing this issue too, and each time, I have to restart the operator to avoid "forgotten" resources.

@nolar Any chance you can review this PR ?

Signed-off-by: Wenjun Si <swj0066@gmail.com>
@mecampbellsoup
Copy link

@nolar sorry to nag but do you know when we can expect this to be released?

if ex.code != HTTP_TOO_MANY_REQUESTS_CODE:
raise

retry_wait = ex.details.get("retryAfterSeconds") or DEFAULT_RETRY_DELAY_SECONDS

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wjsi quick question - is this key correct? Does APIClientError do some parsing/formatting of the response headers? When we saw this issue our response looked like:

<ClientResponse(https://kubernetes.default.svc/apis/monitoring.coreos.com/v1/namespaces/tenant-sta-cwdev04-added01/servicemonitors/knative-proxy) [429 Too Many Requests]> <CIMultiDictProxy('Cache-Control': 'no-cache, private', 'Content-Type': 'text/plain; charset=utf-8', 'Retry-After': '1', 'X-Content-Type-Options': 'nosniff', 'Date': 'Tue, 14 Mar 2023 16:47:45 GMT', 'Content-Length': '43')>

So the response header is just Retry-After in our example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

After receiving Too Many Requests error from kubernetes, the operator stops watching
4 participants