-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20343 from vsevel/vault_retry
Allow retries on Vault MP Config Source initialization
- Loading branch information
Showing
18 changed files
with
157 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/VaultIOException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.quarkus.vault.runtime; | ||
|
||
import io.quarkus.vault.VaultException; | ||
|
||
public class VaultIOException extends VaultException { | ||
|
||
public VaultIOException() { | ||
} | ||
|
||
public VaultIOException(String message) { | ||
super(message); | ||
} | ||
|
||
public VaultIOException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public VaultIOException(Throwable cause) { | ||
super(cause); | ||
} | ||
|
||
public VaultIOException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { | ||
super(message, cause, enableSuppression, writableStackTrace); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
integration-tests/vault/src/test/java/io/quarkus/vault/VaultUnableToConnectITCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package io.quarkus.vault; | ||
|
||
import static io.quarkus.credentials.CredentialsProvider.PASSWORD_PROPERTY_NAME; | ||
|
||
import org.eclipse.microprofile.config.inject.ConfigProperty; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Disabled; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
@Disabled // test is expected to fail on quarkus app startup | ||
public class VaultUnableToConnectITCase { | ||
|
||
// start the test with no vault listening on 4850 | ||
// the application startup should fail with the following debug logs 3 times: | ||
// attempt ... to fetch secrets from vault failed with: ... | ||
// retrying to fetch secrets | ||
// ... | ||
// you can also validate the retry on read timeout by starting a server that answers | ||
// POSTs on http://localhost:4850/v1/auth/userpass/login/{user} and sleeps more than 10 secs | ||
// again you are expected to see several attempts in the logs | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addAsResource("application-unable-to-connect.properties", "application.properties")); | ||
|
||
@ConfigProperty(name = PASSWORD_PROPERTY_NAME) | ||
String someSecret; | ||
|
||
@Test | ||
void test() { | ||
// we will not reach that point | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
integration-tests/vault/src/test/resources/application-unable-to-connect.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
quarkus.vault.url=http://localhost:4850 | ||
quarkus.vault.authentication.userpass.username=bob | ||
quarkus.vault.authentication.userpass.password=sinclair | ||
quarkus.vault.secret-config-kv-path=config | ||
|
||
quarkus.vault.read-timeout=10S | ||
quarkus.vault.mp-config-initial-attempts=3 | ||
|
||
quarkus.log.category."io.quarkus.vault".level=DEBUG | ||
|
||
#quarkus.log.level=DEBUG | ||
quarkus.log.min-level=DEBUG | ||
quarkus.log.console.level=DEBUG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters