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

fileReady is not idempotent #1760

Closed
mhrivnak opened this issue Jul 31, 2019 · 1 comment · Fixed by #1761
Closed

fileReady is not idempotent #1760

mhrivnak opened this issue Jul 31, 2019 · 1 comment · Fixed by #1761
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@mhrivnak
Copy link
Member

Bug Report

What did you do?
call Set() twice in a row, or Unset() twice in a row. If an operator is going to intelligently change the value of its readiness probe during runtime, there is a chance that multiple events will result in the value being set or unset.

For example, consider a case where an operator starts and begins an upgrade workflow. It sets not-ready as requested by OLM. If something goes wrong and the operator exits with an error, the last thing that will happen in main.go (based on a defer statement) will be to call Unset(). That will result in an error, because the file will be not-found.

What did you expect to see?
No error returned.

What did you see instead? Under which circumstances?
Error returned

Environment

  • operator-sdk version:
    0.9.0

Possible Solution

If Set() finds that the file already exists, return nil.

If Unset() fails to unlink the file because it doesn't exist, return nil.

djzager added a commit to djzager/operator-sdk that referenced this issue Jul 31, 2019
@jmrodri jmrodri added the kind/bug Categorizes issue or PR as related to a bug. label Aug 2, 2019
@jmrodri jmrodri self-assigned this Aug 2, 2019
@jmrodri
Copy link
Member

jmrodri commented Aug 2, 2019

Assigned to myself to track the PR that @djzager has done.

jmrodri pushed a commit that referenced this issue Aug 7, 2019
* pkg/ready: Make set/unset idempotent

Fixes #1760
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants