Skip to content
This repository has been archived by the owner on Sep 14, 2020. It is now read-only.

Configure reactions to errors in the handlers, per-handler #222

Merged
merged 8 commits into from
Nov 12, 2019

Conversation

nolar
Copy link
Contributor

@nolar nolar commented Nov 8, 2019

Extra keywords for the handlers to override the default exception-reacting behaviour (timeouts, retries, cool-down periods, arbitrary error interpretations).

Issue : closes #16

Description

With this PR, the error handling mode can be configured by handler (for arbitrary exceptions):

  • Treat them as permanent: errors=kopf.ErrorsMode.PERMANENT
  • Treat them as temporary for N attempts: retries=3
  • Treat them as temporary for some time: timeout=60 (exists already)
  • Ignore them -- same as permanent, with better logging: errors=kopf.ErrorsMode.IGNORED

The current and historic behaviour (the new default) is to treat all errors as temporary until the timeout is reached, or forever until the resource is deleted (if timeout is not set).

Also, a cooldown period between retries can be configured. Previously, it was hard-coded to 60 seconds.

The example with exceptions is changed accordingly to demo the now extended usage.

See the list of commits for detailed step-by-step changes.

Types of Changes

  • New feature (non-breaking change which adds functionality)
  • Refactor/improvements

Review

List of tasks the reviewer must do to review the PR

  • Tests
  • Documentation

@nolar nolar added the enhancement New feature or request label Nov 8, 2019
@nolar nolar requested a review from ancelotpinto November 8, 2019 14:37
@nolar nolar requested a review from samurang87 as a code owner November 8, 2019 14:37
@zincr
Copy link

zincr bot commented Nov 8, 2019

🤖 zincr found 0 problems , 0 warnings

✅ Large Commits
✅ Approvals
✅ Specification
✅ Dependency Licensing

@zincr
Copy link

zincr bot commented Nov 8, 2019

🤖 zincr found 1 problem , 0 warnings

❌ Approvals
✅ Large Commits
✅ Specification
✅ Dependency Licensing

Details on how to resolve are provided below


Approvals

All proposed changes must be reviewed by project maintainers before they can be merged

Not enough people have approved this pull request - please ensure that 1 additional user, who have not contributed to this pull request approve the changes.

  • ✅ Approved by PR author @nolar
  • ❌ 1 additional approval needed
     

docs/errors.rst Outdated
depending on the settings.
Kopf assumes that any arbitrary errors
(i.e. not `TemporaryError` and not `PermanentError`)
are the environment issues and can self-resolve after some time.

Choose a reason for hiding this comment

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

should be: "are environment issues" without "the"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@nolar nolar merged commit 47476bf into zalando-incubator:master Nov 12, 2019
@nolar nolar deleted the handler-error-modes branch November 12, 2019 10:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not show the stacktraces on the retry/fatal exceptions
2 participants