This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
The following commit(s) were added to refs/heads/main by this push:
new c0e9b6b7e79 CAMEL-21453 - Camel-Spring-Boot: Kubernetes Configmaps
Trigger context reloading on update (#1285)
c0e9b6b7e79 is described below
commit c0e9b6b7e79423c262fa9e5aa74fb51a63829107
Author: Andrea Cosentino <[email protected]>
AuthorDate: Mon Nov 18 12:43:46 2024 +0100
CAMEL-21453 - Camel-Spring-Boot: Kubernetes Configmaps Trigger context
reloading on update (#1285)
Signed-off-by: Andrea Cosentino <[email protected]>
---
.../src/main/docs/spring-boot.json | 18 ++++++++
.../KubernetesConfigMapVaultAutoConfiguration.java | 42 ++++++++++++++++++
...netesConfigMapVaultConfigurationProperties.java | 51 ++++++++++++++++++++++
...rk.boot.autoconfigure.AutoConfiguration.imports | 1 +
.../KubernetesConfigMapVaultConfigurationTest.java | 43 ++++++++++++++++++
tooling/camel-spring-boot-dependencies/pom.xml | 8 ++--
6 files changed, 159 insertions(+), 4 deletions(-)
diff --git a/core/camel-spring-boot/src/main/docs/spring-boot.json
b/core/camel-spring-boot/src/main/docs/spring-boot.json
index bdf9a31de12..f7d706b75e3 100644
--- a/core/camel-spring-boot/src/main/docs/spring-boot.json
+++ b/core/camel-spring-boot/src/main/docs/spring-boot.json
@@ -166,6 +166,11 @@
"type":
"org.apache.camel.spring.boot.vault.KubernetesVaultConfigurationProperties",
"sourceType":
"org.apache.camel.spring.boot.vault.KubernetesVaultConfigurationProperties"
},
+ {
+ "name": "camel.vault.kubernetescm",
+ "type":
"org.apache.camel.spring.boot.vault.KubernetesConfigMapVaultConfigurationProperties",
+ "sourceType":
"org.apache.camel.spring.boot.vault.KubernetesConfigMapVaultConfigurationProperties"
+ },
{
"name": "management.endpoint.camel",
"type":
"org.apache.camel.spring.boot.actuate.console.CamelDevConsoleEndpoint",
@@ -1929,6 +1934,19 @@
"description": "Define the secrets to look at",
"sourceType":
"org.apache.camel.spring.boot.vault.KubernetesVaultConfigurationProperties"
},
+ {
+ "name": "camel.vault.kubernetescm.configmaps",
+ "type": "java.lang.String",
+ "description": "Define the configmaps to look at",
+ "sourceType":
"org.apache.camel.spring.boot.vault.KubernetesConfigMapVaultConfigurationProperties"
+ },
+ {
+ "name": "camel.vault.kubernetescm.refresh-enabled",
+ "type": "java.lang.Boolean",
+ "description": "Define if we want to refresh the configmaps on update",
+ "sourceType":
"org.apache.camel.spring.boot.vault.KubernetesConfigMapVaultConfigurationProperties",
+ "defaultValue": false
+ },
{
"name": "management.endpoint.camel.cache.time-to-live",
"type": "java.time.Duration",
diff --git
a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/KubernetesConfigMapVaultAutoConfiguration.java
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/KubernetesConfigMapVaultAutoConfiguration.java
new file mode 100644
index 00000000000..bc02df73e4c
--- /dev/null
+++
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/KubernetesConfigMapVaultAutoConfiguration.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.vault;
+
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.vault.KubernetesConfigMapVaultConfiguration;
+import org.apache.camel.vault.KubernetesVaultConfiguration;
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import
org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration(proxyBeanMethods = false)
+@ConditionalOnBean(CamelAutoConfiguration.class)
+@EnableConfigurationProperties(KubernetesConfigMapVaultConfigurationProperties.class)
+@AutoConfigureAfter(CamelAutoConfiguration.class)
+public class KubernetesConfigMapVaultAutoConfiguration {
+
+ @Bean
+ public KubernetesConfigMapVaultConfiguration
kubernetesConfigMapVaultConfiguration(KubernetesConfigMapVaultConfigurationProperties
config) {
+ KubernetesConfigMapVaultConfiguration answer = new
KubernetesConfigMapVaultConfiguration();
+ answer.setRefreshEnabled(config.isRefreshEnabled());
+ answer.setConfigmaps(config.getConfigmaps());
+ return answer;
+ }
+
+}
diff --git
a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/KubernetesConfigMapVaultConfigurationProperties.java
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/KubernetesConfigMapVaultConfigurationProperties.java
new file mode 100644
index 00000000000..1457bc1f471
--- /dev/null
+++
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/KubernetesConfigMapVaultConfigurationProperties.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.vault;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+@ConfigurationProperties(prefix = "camel.vault.kubernetescm")
+public class KubernetesConfigMapVaultConfigurationProperties {
+
+ /**
+ * Define if we want to refresh the configmaps on update
+ */
+ private boolean refreshEnabled;
+
+ /**
+ * Define the configmaps to look at
+ */
+ private String configmaps;
+
+
+
+ public boolean isRefreshEnabled() {
+ return refreshEnabled;
+ }
+
+ public void setRefreshEnabled(boolean refreshEnabled) {
+ this.refreshEnabled = refreshEnabled;
+ }
+
+ public String getConfigmaps() {
+ return configmaps;
+ }
+
+ public void setConfigmaps(String configmaps) {
+ this.configmaps = configmaps;
+ }
+}
diff --git
a/core/camel-spring-boot/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
b/core/camel-spring-boot/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
index 2fb21e7f846..cf3819c1455 100644
---
a/core/camel-spring-boot/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
+++
b/core/camel-spring-boot/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -40,3 +40,4 @@ org.apache.camel.spring.boot.vault.GcpVaultAutoConfiguration
org.apache.camel.spring.boot.vault.AzureVaultAutoConfiguration
org.apache.camel.spring.boot.vault.HashicorpVaultAutoConfiguration
org.apache.camel.spring.boot.vault.KubernetesVaultAutoConfiguration
+org.apache.camel.spring.boot.vault.KubernetesConfigMapVaultAutoConfiguration
diff --git
a/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/vault/KubernetesConfigMapVaultConfigurationTest.java
b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/vault/KubernetesConfigMapVaultConfigurationTest.java
new file mode 100644
index 00000000000..dbcde1d34ee
--- /dev/null
+++
b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/vault/KubernetesConfigMapVaultConfigurationTest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.vault;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+
+@DirtiesContext
+@CamelSpringBootTest
+@EnableAutoConfiguration
+@SpringBootTest(classes = { KubernetesConfigMapVaultConfigurationTest.class },
properties = {
+ "camel.vault.kubernetescm.refreshEnabled=true",
"camel.vault.kubernetescm.configmaps=myconfigmap" })
+public class KubernetesConfigMapVaultConfigurationTest {
+
+ @Autowired
+ private CamelContext camelContext;
+
+ @Test
+ public void testKubernetesVault() throws Exception {
+ Assertions.assertEquals(true,
camelContext.getVaultConfiguration().kubernetesConfigmaps().isRefreshEnabled());
+ Assertions.assertEquals("myconfigmap",
camelContext.getVaultConfiguration().kubernetesConfigmaps().getConfigmaps());
+ }
+}
diff --git a/tooling/camel-spring-boot-dependencies/pom.xml
b/tooling/camel-spring-boot-dependencies/pom.xml
index 2b5faf1f876..29a8c22724e 100644
--- a/tooling/camel-spring-boot-dependencies/pom.xml
+++ b/tooling/camel-spring-boot-dependencies/pom.xml
@@ -4445,22 +4445,22 @@
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-commons</artifactId>
- <version>1.14.0</version>
+ <version>1.14.1</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-observation</artifactId>
- <version>1.14.0</version>
+ <version>1.14.1</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-jmx</artifactId>
- <version>1.14.0</version>
+ <version>1.14.1</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
- <version>1.14.0</version>
+ <version>1.14.1</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>