This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch 2.13.x in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 8b0a8f089a8d8e9b1d46c70b06ee5ceea682df91 Author: aldettinger <aldettin...@gmail.com> AuthorDate: Thu Sep 29 10:49:25 2022 +0200 kubernetes: add documentation related to cluster service #4086 --- .../pages/reference/extensions/kubernetes.adoc | 31 ++++++++++++++++++++++ .../ROOT/pages/reference/extensions/master.adoc | 8 ++++++ .../runtime/src/main/doc/configuration.adoc | 29 ++++++++++++++++++++ .../master/runtime/src/main/doc/configuration.adoc | 3 +++ 4 files changed, 71 insertions(+) diff --git a/docs/modules/ROOT/pages/reference/extensions/kubernetes.adoc b/docs/modules/ROOT/pages/reference/extensions/kubernetes.adoc index 0610850405..a8a56dc796 100644 --- a/docs/modules/ROOT/pages/reference/extensions/kubernetes.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/kubernetes.adoc @@ -65,6 +65,13 @@ endif::[] [id="extensions-kubernetes-additional-camel-quarkus-configuration"] == Additional Camel Quarkus configuration +ifeval::[{doc-show-extra-content} == true] +include::extra-content.adoc[] +endif::[] + +[id="extensions-kubernetes-configuration-automatic-registration-of-a-kubernetes-client-instance"] +=== Automatic registration of a Kubernetes Client instance + The extension automatically registers a Kubernetes Client bean named `kubernetesClient`. You can reference the bean in your routes like this: from("direct:pods") @@ -80,6 +87,30 @@ quarkus.kubernetes-client.namespace=my-namespace The full set of configuration options are documented in the https://quarkus.io/guides/kubernetes-client#quarkus-kubernetes-client_configuration[Quarkus Kubernetes Client guide]. +[id="extensions-kubernetes-configuration-having-only-a-single-consumer-in-a-cluster-consuming-from-a-given-endpoint"] +=== Having only a single consumer in a cluster consuming from a given endpoint + +When the same route is deployed on multiple pods, it could be interesting to use this extension in conjunction with the xref:reference/extensions/master.adoc[Master one]. +In such a setup, a single consumer will be active at a time across the whole camel master namespace. + +For instance, having the route below deployed on multiple pods: + +``` +from("master:ns:timer:test?period=100").log("Timer invoked on a single pod at a time"); +``` + +It's possible to enable the kubernetes cluster service with a property like below: + +``` +quarkus.camel.cluster.kubernetes.enabled = true +``` + +As a result, a single consumer will be active across the `ns` camel master namespace. +It means that, at a given time, only a single timer will generate exchanges across the whole cluster. +In other words, messages will be logged every 100ms on a single pod at a time. + +The kubernetes cluster service could further be tuned by tweaking `quarkus.camel.cluster.kubernetes.*` properties. + [width="100%",cols="80,5,15",options="header"] |=== diff --git a/docs/modules/ROOT/pages/reference/extensions/master.adoc b/docs/modules/ROOT/pages/reference/extensions/master.adoc index cf89ab82f8..09c2ce58bc 100644 --- a/docs/modules/ROOT/pages/reference/extensions/master.adoc +++ b/docs/modules/ROOT/pages/reference/extensions/master.adoc @@ -44,3 +44,11 @@ Or add the coordinates to your existing project: ifeval::[{doc-show-user-guide-link} == true] Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications. endif::[] + +[id="extensions-master-additional-camel-quarkus-configuration"] +== Additional Camel Quarkus configuration + +This extension can be used in conjunction with extensions below: + +* xref:reference/extensions/kubernetes.adoc[Camel Quarkus Kubernetes] + diff --git a/extensions/kubernetes/runtime/src/main/doc/configuration.adoc b/extensions/kubernetes/runtime/src/main/doc/configuration.adoc index 2bcc9fd811..8acafeb39f 100644 --- a/extensions/kubernetes/runtime/src/main/doc/configuration.adoc +++ b/extensions/kubernetes/runtime/src/main/doc/configuration.adoc @@ -1,3 +1,9 @@ +ifeval::[{doc-show-extra-content} == true] +include::extra-content.adoc[] +endif::[] + +=== Automatic registration of a Kubernetes Client instance + The extension automatically registers a Kubernetes Client bean named `kubernetesClient`. You can reference the bean in your routes like this: from("direct:pods") @@ -12,3 +18,26 @@ quarkus.kubernetes-client.namespace=my-namespace ---- The full set of configuration options are documented in the https://quarkus.io/guides/kubernetes-client#quarkus-kubernetes-client_configuration[Quarkus Kubernetes Client guide]. + +=== Having only a single consumer in a cluster consuming from a given endpoint + +When the same route is deployed on multiple pods, it could be interesting to use this extension in conjunction with the xref:reference/extensions/master.adoc[Master one]. +In such a setup, a single consumer will be active at a time across the whole camel master namespace. + +For instance, having the route below deployed on multiple pods: + +``` +from("master:ns:timer:test?period=100").log("Timer invoked on a single pod at a time"); +``` + +It's possible to enable the kubernetes cluster service with a property like below: + +``` +quarkus.camel.cluster.kubernetes.enabled = true +``` + +As a result, a single consumer will be active across the `ns` camel master namespace. +It means that, at a given time, only a single timer will generate exchanges across the whole cluster. +In other words, messages will be logged every 100ms on a single pod at a time. + +The kubernetes cluster service could further be tuned by tweaking `quarkus.camel.cluster.kubernetes.*` properties. diff --git a/extensions/master/runtime/src/main/doc/configuration.adoc b/extensions/master/runtime/src/main/doc/configuration.adoc new file mode 100644 index 0000000000..8fa5657956 --- /dev/null +++ b/extensions/master/runtime/src/main/doc/configuration.adoc @@ -0,0 +1,3 @@ +This extension can be used in conjunction with extensions below: + +* xref:reference/extensions/kubernetes.adoc[Camel Quarkus Kubernetes] \ No newline at end of file