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.git


The following commit(s) were added to refs/heads/main by this push:
     new ae01617ea73 Add documentation about Kubernetes Configmap Properties 
Function to Configmap Component (#15254)
ae01617ea73 is described below

commit ae01617ea735f4b5ad59dc13ebf42846bfee52d2
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Wed Aug 21 14:47:04 2024 +0200

    Add documentation about Kubernetes Configmap Properties Function to 
Configmap Component (#15254)
    
    Signed-off-by: Andrea Cosentino <anco...@gmail.com>
---
 .../docs/kubernetes-config-maps-component.adoc     | 45 ++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git 
a/components/camel-kubernetes/src/main/docs/kubernetes-config-maps-component.adoc
 
b/components/camel-kubernetes/src/main/docs/kubernetes-config-maps-component.adoc
index 008f6b75b1b..2f1fac8096a 100644
--- 
a/components/camel-kubernetes/src/main/docs/kubernetes-config-maps-component.adoc
+++ 
b/components/camel-kubernetes/src/main/docs/kubernetes-config-maps-component.adoc
@@ -103,6 +103,51 @@ fromF("kubernetes-config-maps://%s?oauthToken=%s", host, 
authToken)
 
 This consumer will return a list of events on the namespace default for the 
config map test.
 
+== Using configmap properties function with Kubernetes
 
+The `camel-kubernetes` component include the following configmap related 
functions:
+
+* `configmap` - A function to lookup the string property from Kubernetes 
ConfigMaps.
+* `configmap-binary` - A function to lookup the binary property from 
Kubernetes ConfigMaps.
+
+Camel reads Configmaps from the Kubernetes API Server. And when RBAC is 
enabled on the cluster,
+the ServiceAccount that is used to run the application needs to have the 
proper permissions for such access.
+
+Before the Kubernetes property placeholder functions can be used they need to 
be configured with either (or both)
+
+- path - A _mount path_ that must be mounted to the running pod, to load the 
configmaps or secrets from local disk.
+- kubernetes client - *Autowired* An 
`io.fabric8.kubernetes.client.KubernetesClient` instance to use for connecting 
to the Kubernetes API server.
+
+Camel will first use _mount paths_ (if configured) to lookup, and then 
fallback to use the `KubernetesClient`.
+
+==== Using configmap with Kubernetes
+
+Given a configmap named `myconfig` in Kubernetes that has two entries:
+
+[source,properties]
+----
+drink = beer
+first = Carlsberg
+----
+
+Then these values can be used in your Camel routes such as:
+
+[source,xml]
+----
+<camelContext>
+  <route>
+    <from uri="direct:start"/>
+    <log message="What {{configmap:myconfig/drink}} do you want?"/>
+    <log message="I want {{configmap:myconfig/first}}"/>
+  </route>
+</camelContext>
+----
+
+You can also provide a default value in case a key does not exist:
+
+[source,xml]
+----
+    <log message="I want {{configmap:myconfig/second:Heineken}}"/>
+----
 
 include::spring-boot:partial$starter.adoc[]

Reply via email to