Skip to content

Commit

Permalink
Merge pull request #1131 from jumpojoy/retry_forbiden
Browse files Browse the repository at this point in the history
Retry requests on APIForbiddenError
  • Loading branch information
nolar authored Nov 19, 2024
2 parents 3d1c8ef + da0f971 commit c158bae
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kopf/_cogs/clients/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ async def request(
)
await errors.check_response(response) # but do not parse it!

except (aiohttp.ClientConnectionError, errors.APIServerError, asyncio.TimeoutError) as e:
# NOTE(vsaienko): during k8s upgrade API might throw 403 forbiden. Use retries for this exception as well.
except (aiohttp.ClientConnectionError, errors.APIServerError, asyncio.TimeoutError, errors.APIForbiddenError) as e:
if backoff is None: # i.e. the last or the only attempt.
logger.error(f"Request attempt {idx} failed; escalating: {what} -> {e!r}")
raise
Expand Down

0 comments on commit c158bae

Please sign in to comment.