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

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

commit 065c822b6819d19b997b52e7262f61e1cd98b886
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Mon Sep 23 10:34:41 2019 +0200

    Camel-Kubernetes: Added samples code for nodes component
---
 .../src/main/docs/kubernetes-nodes-component.adoc  | 52 ++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git 
a/components/camel-kubernetes/src/main/docs/kubernetes-nodes-component.adoc 
b/components/camel-kubernetes/src/main/docs/kubernetes-nodes-component.adoc
index 6881b65..6ad9cd4 100644
--- a/components/camel-kubernetes/src/main/docs/kubernetes-nodes-component.adoc
+++ b/components/camel-kubernetes/src/main/docs/kubernetes-nodes-component.adoc
@@ -119,3 +119,55 @@ The component supports 2 options, which are listed below.
 - createNode
 - deleteNode
 
+
+== Kubernetes Nodes Producer Examples
+
+- listNodes: this operation list the nodes on a kubernetes cluster
+
+[source,java]
+--------------------------------------------------------------------------------
+from("direct:list").
+    
toF("kubernetes-nodes:///?kubernetesClient=#kubernetesClient&operation=listNodes").
+    to("mock:result");
+--------------------------------------------------------------------------------
+
+This operation return a List of Nodes from your cluster
+
+- listNodesByLabels:  this operation list the nodes by labels on a kubernetes 
cluster
+
+[source,java]
+--------------------------------------------------------------------------------
+from("direct:listByLabels").process(new Processor() {
+
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                Map<String, String> labels = new HashMap<>();
+                labels.put("key1", "value1");
+                labels.put("key2", "value2");
+                
exchange.getIn().setHeader(KubernetesConstants.KUBERNETES_NODES_LABELS, labels);
+            }
+        });
+    
toF("kubernetes-deployments:///?kubernetesClient=#kubernetesClient&operation=listNodesByLabels").
+    to("mock:result");
+--------------------------------------------------------------------------------
+
+This operation return a List of Nodes from your cluster, using a label 
selector (with key1 and key2, with value value1 and value2)
+
+== Kubernetes Nodes Consumer Example
+
+[source,java]
+--------------------------------------------------------------------------------
+fromF("kubernetes-nodes://%s?oauthToken=%s&resourceName=test", host, 
authToken).process(new KubernertesProcessor()).to("mock:result");
+
+    public class KubernertesProcessor implements Processor {
+        @Override
+        public void process(Exchange exchange) throws Exception {
+            Message in = exchange.getIn();
+            Node node = exchange.getIn().getBody(Node.class);
+            log.info("Got event with configmap name: " + 
node.getMetadata().getName() + " and action " + 
in.getHeader(KubernetesConstants.KUBERNETES_EVENT_ACTION));
+        }
+    }
+--------------------------------------------------------------------------------
+
+This consumer will return a list of events for the node test.
+

Reply via email to