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

secrets: Fix bug about not wait for secrets.json to become available #585

Merged
merged 1 commit into from
Nov 16, 2022

Conversation

fishy
Copy link
Member

@fishy fishy commented Nov 16, 2022

When we added support for CSI directories, we introduced a bug that we no longer wait for secrets.json to become available, because os.Stat call would fail with file not exist error immediately.

Since in CSI directories case the directory would be guaranteed to be available immediately (unlike the vault case), assume file not exist errors from os.Stat as using file instead of directory, and let filewatcher.New to handle the waiting as before. Also add a test for it.

While I'm here, also remove the usages of os.IsNotExist and os.IsExist follow the docs.

@fishy fishy requested a review from a team as a code owner November 16, 2022 18:03
@fishy fishy requested review from kylelemons, pacejackson and ghirsch-reddit and removed request for a team November 16, 2022 18:03
Comment on lines 497 to 498
writeDelay = time.Second / 5
timeout = time.Second * 5
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
writeDelay = time.Second / 5
timeout = time.Second * 5
writeDelay = 200*time.Millisecond
timeout = 5*time.Second

When we added support for CSI directories, we introduced a bug that we
no longer wait for secrets.json to become available, because os.Stat
call would fail with file not exist error immediately.

Since in CSI directories case the directory would be guaranteed to be
available immediately (unlike the vault case), assume file not exist
errors from os.Stat as using file instead of directory, and let
filewatcher.New to handle the waiting as before. Also add a test for it.

While I'm here, also remove the usages of os.IsNotExist and os.IsExist
follow the docs.
@fishy fishy merged commit a2aa10c into reddit:master Nov 16, 2022
@fishy fishy deleted the secrets-init-bug-fix branch November 16, 2022 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants