You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2021/08/19 08:07:21 UTC

[camel-k] branch main updated (b3108a4 -> 4d085fa)

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

pcongiusti pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git.


    from b3108a4  Updated CHANGELOG.md
     new 1f0431e  doc(kamelets): trait annotation
     new 4d085fa  doc(kamelets): env variables usage

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../modules/ROOT/pages/kamelets/kamelets-user.adoc | 28 ++++++++++++++++++++++
 examples/kamelets/kameletbindings/README.md        |  3 +++
 .../kb-env-vars.yaml}                              | 19 +++++++--------
 .../kb-trait-annotation.yaml}                      | 15 +++++-------
 4 files changed, 46 insertions(+), 19 deletions(-)
 create mode 100644 examples/kamelets/kameletbindings/README.md
 copy examples/kamelets/{timer-source-log-sink/log-sink.binding.yaml => kameletbindings/kb-env-vars.yaml} (82%)
 copy examples/kamelets/{timer-source-log-sink/log-sink.binding.yaml => kameletbindings/kb-trait-annotation.yaml} (82%)

[camel-k] 02/02: doc(kamelets): env variables usage

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 4d085fa735fe5a5f6e88f414024a02db1c51f602
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Wed Aug 18 12:46:12 2021 +0200

    doc(kamelets): env variables usage
    
    Ref #2512
---
 examples/kamelets/kameletbindings/kb-env-vars.yaml | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/examples/kamelets/kameletbindings/kb-env-vars.yaml b/examples/kamelets/kameletbindings/kb-env-vars.yaml
new file mode 100644
index 0000000..7e42760
--- /dev/null
+++ b/examples/kamelets/kameletbindings/kb-env-vars.yaml
@@ -0,0 +1,31 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+apiVersion: camel.apache.org/v1alpha1
+kind: KameletBinding
+metadata:
+  name: timer-to-log
+  namespace: default
+spec:
+  integration:
+    configuration:
+    - type: env
+      value: X=hello world!
+  sink:
+    uri: log:bar
+  source:
+    uri: timer:foo
\ No newline at end of file

[camel-k] 01/02: doc(kamelets): trait annotation

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 1f0431ec9c6ebfad58ac532cb34986802f62bf2e
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Wed Aug 18 12:45:27 2021 +0200

    doc(kamelets): trait annotation
    
    Closes #2500
---
 .../modules/ROOT/pages/kamelets/kamelets-user.adoc | 28 +++++++++++++++++++++
 examples/kamelets/kameletbindings/README.md        |  3 +++
 .../kameletbindings/kb-trait-annotation.yaml       | 29 ++++++++++++++++++++++
 3 files changed, 60 insertions(+)

diff --git a/docs/modules/ROOT/pages/kamelets/kamelets-user.adoc b/docs/modules/ROOT/pages/kamelets/kamelets-user.adoc
index 6e42174..500b039 100644
--- a/docs/modules/ROOT/pages/kamelets/kamelets-user.adoc
+++ b/docs/modules/ROOT/pages/kamelets/kamelets-user.adoc
@@ -360,6 +360,29 @@ To comply with the Knative specifications, in case an "http" or "https" URI is u
 
 You can configure an error handler in order to specify what to do when some event ends up with failure. See xref:kamelets/kameletbindings-error-handler.adoc[Kamelet Bindings Error Handler User Guide] for more detail.
 
+=== Trait via annotations
+
+You can easily tune your `KameletBinding` with xref:traits:traits.adoc[traits] configuration adding `.metadata.annotations`. Let's have a look at the following example:
+
+[source,yaml]
+----
+apiVersion: camel.apache.org/v1alpha1
+kind: KameletBinding
+metadata:
+  name: timer-2-log-annotation
+  annotations: # <1>
+    trait.camel.apache.org/logging.level: DEBUG
+    trait.camel.apache.org/logging.color: "false"
+spec:
+  source:
+    uri: timer:foo
+  sink:
+    uri: log:bar
+----
+<1> Include `.metadata.annotations` to specify the list of traits we want to configure
+
+In this example, we've set the `logging` trait to specify certain configuration we want to apply. You can do the same with all the traits available, just by setting `trait.camel.apache.org/trait-name.trait-property` with the expected value.
+
 [[kamelets-troubleshooting]]
 == Troubleshooting
 
@@ -400,6 +423,11 @@ The following annotations and labels are also defined on the resource:
 |An optional icon for the Kamelet in URI data format
 |`string`
 |E.g. `data:image/svg+xml;base64,PD94bW...`
+
+|`trait.camel.apache.org/trait-name.trait-property`
+|An optional configuration setting for a trait
+|`string`
+|E.g. `trait.camel.apache.org/logging.level: DEBUG`
 |===
 
 .Labels
diff --git a/examples/kamelets/kameletbindings/README.md b/examples/kamelets/kameletbindings/README.md
new file mode 100644
index 0000000..9e2ba04
--- /dev/null
+++ b/examples/kamelets/kameletbindings/README.md
@@ -0,0 +1,3 @@
+# KameletBindings examples
+
+Find useful examples about how to use KameletBindings.
diff --git a/examples/kamelets/kameletbindings/kb-trait-annotation.yaml b/examples/kamelets/kameletbindings/kb-trait-annotation.yaml
new file mode 100644
index 0000000..73a5d6a
--- /dev/null
+++ b/examples/kamelets/kameletbindings/kb-trait-annotation.yaml
@@ -0,0 +1,29 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+apiVersion: camel.apache.org/v1alpha1
+kind: KameletBinding
+metadata:
+  name: timer-2-log-annotation
+  annotations:
+    trait.camel.apache.org/logging.level: DEBUG
+    trait.camel.apache.org/logging.color: "false"
+spec:
+  source:
+    uri: timer:foo
+  sink:
+    uri: log:bar
\ No newline at end of file