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

Allow Vault variables provider to retry #2376

Closed
wants to merge 1 commit into from

Conversation

itowlson
Copy link
Contributor

Maybe it will mitigate that flaky integration test. Please let it mitigate that flaky integration test.

Signed-off-by: itowlson <ivan.towlson@fermyon.com>
@@ -24,12 +25,14 @@ impl VaultProvider {
token: impl Into<String>,
mount: impl Into<String>,
prefix: Option<impl Into<String>>,
retry_limit: Option<u8>,
Copy link
Collaborator

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 {
Copy link
Collaborator

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 {
Copy link
Collaborator

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>,
Copy link
Collaborator

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?

@lann
Copy link
Collaborator

lann commented Mar 19, 2024

Please let it mitigate that flaky integration test.

It looks like testing-framework supports Docker HEALTHCHECKs. I wonder that might solve your flakiness more directly?

@lann
Copy link
Collaborator

lann commented Mar 19, 2024

This seems to work:

HEALTHCHECK --interval=3s CMD vault status -address=http://127.0.0.1:8200

@lann
Copy link
Collaborator

lann commented Mar 19, 2024

#2382

@itowlson
Copy link
Contributor Author

Closing in favour of #2382

@itowlson itowlson closed this Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants