-
Notifications
You must be signed in to change notification settings - Fork 265
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
Allow Vault variables provider to retry #2376
Conversation
Signed-off-by: itowlson <ivan.towlson@fermyon.com>
2e876f1
to
cc90d8d
Compare
@@ -24,12 +25,14 @@ impl VaultProvider { | |||
token: impl Into<String>, | |||
mount: impl Into<String>, | |||
prefix: Option<impl Into<String>>, | |||
retry_limit: Option<u8>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a meaningful semantic difference between None
and Some(0)
? Seems like we could just pass a u8
no?
Err(e) => Err(e).context("Failed to check Vault for config"), | ||
|
||
let mut retry_count = 0; | ||
loop { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be clear to use a for _ in 0..=self.retry_limit {
Err(ClientError::APIError { code: 404, .. }) => return Ok(None), | ||
// Other Vault error so retry, or if at retry limit bail rather than looking elsewhere | ||
Err(e) => { | ||
if retry_count >= self.retry_limit { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should only retry on 5xx errors as other errors are unlikely to be recoverable.
@@ -70,6 +70,8 @@ pub struct VaultVariablesProviderOpts { | |||
pub mount: String, | |||
#[serde(default)] | |||
pub prefix: Option<String>, | |||
#[serde(default)] | |||
pub retry_limit: Option<u8>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[serde(default)]
should allow us to just have this be a u8
, no?
It looks like testing-framework supports Docker |
This seems to work:
|
Closing in favour of #2382 |
Maybe it will mitigate that flaky integration test. Please let it mitigate that flaky integration test.