oscerd opened a new pull request, #2113:
URL: https://github.com/apache/camel-spring-boot/pull/2113

   ## Summary
   
   [CAMEL-27024](https://issues.apache.org/jira/browse/CAMEL-27024): the early 
resolution of vault properties of Camel on Spring Boot 
(`camel.component.<vault>.early-resolve-properties=true`) creates a client in 
`createPropertiesFunction`, and nothing closed it once the properties were 
resolved. Each of these stayed open for the life of the application, although 
the early resolution uses it only at startup:
   - the AWS Secrets Manager parser's `SecretsManagerClient`, with its HTTP 
connection pool;
   - the Google Secret Manager parser's `SecretManagerServiceClient`, with its 
gRPC channel and threads;
   - the CyberArk parser's `ConjurClient`.
   
   CAMEL-26919 (#2091) added a `release(PropertiesFunction)` hook to 
`AbstractEarlyResolutionPropertiesParser`. The base class calls it once the 
properties are resolved, also when they could not be, but so far only the 
HashiCorp Vault parser overrode it. Its default now stops the function when it 
is a Camel `Service`:
   - **All the vault functions are services.** Their `doStop()` closes their 
client:
     - AWS Secrets Manager, Google Secret Manager and CyberArk close the client;
     - HashiCorp Vault closes its client and revokes the token of its login;
     - Azure Key Vault (whose `SecretClient` cannot be closed), IBM Secrets 
Manager (the IBM SDK shares its HTTP client) and Spring Cloud Config (no 
client) have nothing to close, so stopping them is harmless.
   - **Never started.** A Camel service runs `doStop()` also when it was never 
started, as here.
   - **AWS credentials.** Closing the AWS client closes only what it owns. With 
`camel.vault.aws.defaultCredentialsProvider`, the SDK (2.57) builds its own 
`DefaultCredentialsProvider` instance, not the JVM-wide singleton of 
CAMEL-26367. The parser creates the static and profile providers itself.
   - **HashiCorp Vault.** The parser no longer overrides `release`, since the 
default does the same.
   - **Failures and opt-out.** A failure to release is still logged and 
ignored. A parser whose function is shared with something else can override 
`release` to do nothing.
   
   The hook is new in 4.24.0, so changing its default affects no released 
version.
   
   ## Tests
   
   - `AbstractEarlyResolutionPropertiesParserTest`: by default, a function that 
is a Camel service is stopped once the properties are resolved, and also when 
the resolution fails. A function that is not a service is resolved as before.
   - `EarlyResolvedPropertiesAppRoleTest` (Vault container) still checks that 
the token of the AppRole login is revoked once the properties are resolved, now 
through the default `release`.
   - Built `core/camel-spring-boot` and the seven vault starters against the 
published 4.24.0-SNAPSHOT. All 20 tests of 
`AbstractEarlyResolutionPropertiesParserTest` pass, and so do the tests of the 
starters: HashiCorp Vault 13, AWS Secrets Manager 2, Google Secret Manager 3, 
CyberArk 2, Azure Key Vault 2, IBM Secrets Manager 2 and Spring Cloud Config 3. 
The `EarlyResolvedPropertiesTest` of AWS, Google, CyberArk, Azure and IBM is 
skipped without cloud credentials, as on main.
   - With the previous no-op default, the two new tests fail, and 
`EarlyResolvedPropertiesAppRoleTest` fails on the revocation of the token.
   
   Suggested by Croway in the review of #2091.
   
   _Claude Code on behalf of oscerd_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to