[ 
https://issues.apache.org/jira/browse/CAMEL-21924?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claudio Miranda closed CAMEL-21924.
-----------------------------------
    Resolution: Not A Bug

Closing, following Claus description as this is hardly to be resolved in camel 
for beans created in quarkus or spring-boot.

> context reload fails to reload the kubernetes property placeholder functions
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-21924
>                 URL: https://issues.apache.org/jira/browse/CAMEL-21924
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-kubernetes
>            Reporter: Claudio Miranda
>            Priority: Major
>
> When use the kubernetes property placeholder function 
> "{{{{secret:secret-basic-auth/username}}}}" in a "DataSource" object to set 
> the authentication credentials, then update the kubernetes secret, the camel 
> context is reloaded but the datasource object is not updated with the new 
> values from the secret.
> An example route:
> {code}
> public class JdbcLog extends RouteBuilder {
>     @Inject
>     DataSource datasource() {
>         org.apache.commons.dbcp2.BasicDataSource ds = new 
> org.apache.commons.dbcp2.BasicDataSource();
>         ds.setUsername("{{secret:secret-basic-auth/username}}");
>         ds.setPassword("{{secret:secret-basic-auth/password}}");
>         
> ds.setUrl("jdbc:postgresql://{{secret:secret-basic-auth/host}}:{{secret:secret-basic-auth/port:5432}}/testdb");
>         ds.setDriverClassName("org.postgresql.Driver");
>         return ds;
>     }
>     @Override
>     public void configure() throws Exception {
>         from("timer:JAVA?period=30s")
>             .setBody(simple("SELECT * FROM foo"))
>             .to("jdbc:datasource")
>             .process(e -> 
> e.getContext().getRegistry().findByType(DataSource.class).forEach(b -> {
>                 org.apache.commons.dbcp2.BasicDataSource ds = 
> (BasicDataSource) b;
>                 log.info(">> datasource user: " + ds.getUserName());
>             }))
>             .log("db username: {{secret:secret-basic-auth/username}} - body: 
> ${body}");
>     }
> }
> {code}
> The log shows the secret is reloaded and triggers a camel context reload
> {code}
> [org.apa.cam.com.kub.sec.vau.SecretsReloadTriggerTask] Matching secret id: 
> secret-basic-auth=secret-basic-auth -> true
> [org.apa.cam.com.kub.sec.vau.SecretsReloadTriggerTask] Update for Kubernetes 
> Secret: secret-basic-auth detected, triggering CamelContext reload
> [org.apa.cam.sup.DefaultContextReloadStrategy] Reloading CamelContext 
> (camel-2) triggered by: 
> org.apache.camel.component.kubernetes.secrets.vault.SecretsReloadTriggerTask$1@7e53b383
> {code}
> But the datasource object still uses the previous value:
> {code}
> [sam.JdbcLog] (Camel thread #9 - timer://JAVA) >> datasource user: user1
> {code}
> The [full reproducer and detailed 
> explanation|https://github.com/claudio4j/apache-camel-on-ocp-best-practices/tree/add_hotreload_ceq/examples/ocp/hot-reload/camel-quarkus].



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to