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

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

commit cc3e7c785e7eafacb3438014032db782d04b796b
Author: Antonin Stefanutti <[email protected]>
AuthorDate: Wed Jul 15 17:54:38 2020 +0200

    chore(doc): Add examples back into the affinity trait documentation
---
 docs/modules/traits/pages/affinity.adoc | 22 +++++++++++++++++++++-
 pkg/trait/affinity.go                   |  2 +-
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/docs/modules/traits/pages/affinity.adoc 
b/docs/modules/traits/pages/affinity.adoc
index e43cf92..61a8c1a 100755
--- a/docs/modules/traits/pages/affinity.adoc
+++ b/docs/modules/traits/pages/affinity.adoc
@@ -1,7 +1,7 @@
 = Affinity Trait
 
 // Start of autogenerated code - DO NOT EDIT! (description)
-Allows to constrain which nodes the integration pod(s) are eligible to be 
scheduled on, based on labels on the node,
+Allows constraining which nodes the integration pod(s) are eligible to be 
scheduled on, based on labels on the node,
 or with inter-pod affinity and anti-affinity, based on labels on pods that are 
already running on the nodes.
 
 It’s disabled by default.
@@ -52,3 +52,23 @@ integration pod(s) should not be co-located with.
 |===
 
 // End of autogenerated code - DO NOT EDIT! (configuration)
+
+== Examples
+
+* To schedule the integration pod(s) on a specific node using the 
https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#interlude-built-in-node-labels[built-in
 node label] `kubernetes.io/hostname`:
+[source,shell]
+$ kamel run -t affinity.node-affinity-labels="kubernetes.io/hostname 
in(node-66-50.hosted.k8s.tld)" ...
+
+* To schedule a single integration pod per node (using the `Exists` operator):
+[source,shell]
+$ kamel run -t 
affinity.pod-anti-affinity-labels="camel.apache.org/integration" ...
+
+* To co-locate the integration pod(s) with other integration pod(s):
+[source,shell]
+$ kamel run -t affinity.pod-affinity-labels="camel.apache.org/integration 
in(it1, it2)" ...
+
+ The labels options follow the requirements from 
https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors[Label
 selectors]. They can be multi-valuated, then the requirements list is ANDed, 
e.g., to schedule a single integration pod per node AND not co-located with the 
Camel K operator pod(s):
+ [source,shell]
+ $ kamel run -t 
affinity.pod-anti-affinity-labels="camel.apache.org/integration" -t 
affinity.pod-anti-affinity-labels="camel.apache.org/component=operator" ...
+
+ More information can be found in the official Kubernetes documentation about 
https://kubernetes.io/docs/concepts/configuration/assign-pod-node/[Assigning 
Pods to Nodes].
diff --git a/pkg/trait/affinity.go b/pkg/trait/affinity.go
index 795166f..b90a990 100644
--- a/pkg/trait/affinity.go
+++ b/pkg/trait/affinity.go
@@ -30,7 +30,7 @@ import (
        v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
 )
 
-// Allows to constrain which nodes the integration pod(s) are eligible to be 
scheduled on, based on labels on the node,
+// Allows constraining which nodes the integration pod(s) are eligible to be 
scheduled on, based on labels on the node,
 // or with inter-pod affinity and anti-affinity, based on labels on pods that 
are already running on the nodes.
 //
 //It’s disabled by default.

Reply via email to