You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/06/27 10:12:26 UTC

[camel] 01/04: CAMEL-18171: camel-kubernetes - Add secret/configmap property placeholder function.

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit d1604ed830000ccec9f464153aa4b9da69d73b03
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jun 27 08:21:57 2022 +0200

    CAMEL-18171: camel-kubernetes - Add secret/configmap property placeholder function.
---
 .../kubernetes/properties/BasePropertiesFunction.java       | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/properties/BasePropertiesFunction.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/properties/BasePropertiesFunction.java
index 882b25a161a..f4224e92a34 100644
--- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/properties/BasePropertiesFunction.java
+++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/properties/BasePropertiesFunction.java
@@ -49,9 +49,10 @@ import org.slf4j.LoggerFactory;
  */
 abstract class BasePropertiesFunction extends ServiceSupport implements PropertiesFunction, CamelContextAware {
 
-    // keys in application.properties for mount paths
-    public static final String MOUNT_PATH_CONFIGMAPS = "org.apache.camel.component.kubernetes.properties.mount-path-configmaps";
-    public static final String MOUNT_PATH_SECRETS = "org.apache.camel.component.kubernetes.properties.mount-path-secrets";
+    // keys in application.properties
+    public static final String CLIENT_ENABLED = "camel.kubernetes.client-enabled";
+    public static final String MOUNT_PATH_CONFIGMAPS = "camel.kubernetes.mount-path-configmaps";
+    public static final String MOUNT_PATH_SECRETS = "camel.kubernetes.mount-path-secrets";
 
     // use camel-k ENV for mount paths
     public static final String ENV_MOUNT_PATH_CONFIGMAPS = "camel.k.mount-path.configmaps";
@@ -62,7 +63,7 @@ abstract class BasePropertiesFunction extends ServiceSupport implements Properti
 
     private CamelContext camelContext;
     private KubernetesClient client;
-    private boolean clientEnabled = true;
+    private Boolean clientEnabled;
     private String mountPathConfigMaps;
     private String mountPathSecrets;
 
@@ -70,6 +71,10 @@ abstract class BasePropertiesFunction extends ServiceSupport implements Properti
     @SuppressWarnings("unchecked")
     protected void doInit() throws Exception {
         ObjectHelper.notNull(camelContext, "CamelContext");
+        if (clientEnabled == null) {
+            clientEnabled = "true"
+                    .equalsIgnoreCase(camelContext.getPropertiesComponent().resolveProperty(CLIENT_ENABLED).orElse("true"));
+        }
         if (mountPathConfigMaps == null) {
             mountPathConfigMaps = camelContext.getPropertiesComponent().resolveProperty(MOUNT_PATH_CONFIGMAPS)
                     .orElseGet(() -> System.getProperty(ENV_MOUNT_PATH_CONFIGMAPS, System.getenv(ENV_MOUNT_PATH_CONFIGMAPS)));