From 137f4ca417dd424ffd719247fb8b3858ce5f7354 Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Tue, 30 Apr 2024 11:56:52 +0200 Subject: [PATCH] Kamelet Options: Remove the Camel K specific part and try to make the documentation agnostic Signed-off-by: Andrea Cosentino --- .../examples/template/kamelet-options.adoc | 112 +++--------------- 1 file changed, 17 insertions(+), 95 deletions(-) diff --git a/docs/modules/ROOT/examples/template/kamelet-options.adoc b/docs/modules/ROOT/examples/template/kamelet-options.adoc index 7980ab183..5eefc71e2 100644 --- a/docs/modules/ROOT/examples/template/kamelet-options.adoc +++ b/docs/modules/ROOT/examples/template/kamelet-options.adoc @@ -44,122 +44,44 @@ jbang app install camel@apache/camel Supposing you have a file named route.yaml with this content: +ifeval::['{type}' == 'source'] [source,yaml,subs='+attributes,macros'] ---- - route: from: - uri: "kamelet:timer-source" + uri: "kamelet:\`{name}\`" parameters: - period: 10000 - message: 'test' + . + . + . steps: - to: uri: "kamelet:log-sink" ---- - -You can now run it directly through the following command - -[source,shell,subs=+attributes] ----- -camel run route.yaml ----- - -== Camel K Environment Usage - -This section describes how you can use the \`{name}\`. - -=== Knative {type} - -ifeval::['{type}' == 'action'] -You can use the \`{name}\` Kamelet as an intermediate step in a Knative binding. -endif::[] -ifeval::['{type}' != 'action'] -You can use the \`{name}\` Kamelet as a Knative {type} by binding it to a Knative object. endif::[] -:ref-api-version: messaging.knative.dev/v1 -:ref-kind: Channel -:ref-name: mychannel - -.{name}-pipe.yaml +ifeval::['{type}' == 'sink'] [source,yaml,subs='+attributes,macros'] ---- -jsonpathExpression::example$yaml/${basename}.kamelet.yaml[query='$', format='kamelets.pipe("{type}", apiVersion, kind, metadata, spec, "{ref-kind}", "{ref-api-version}", "{ref-name}")', outputFormat=yml, requires={requires}] ----- - -==== *Prerequisite* - -You have xref:{camel-k-docs-version}@camel-k::installation/installation.adoc[Camel K installed] on the cluster. - -==== *Procedure for using the cluster CLI* - -. Save the \`{name}-pipe.yaml\` file to your local drive, and then edit it as needed for your configuration. - -. Run the {type} by using the following command: -+ -[source,shell,subs=+attributes] ----- -kubectl apply -f {name}-pipe.yaml ----- - -==== *Procedure for using the Kamel CLI* - -Configure and run the {type} by using the following command: - -[source,shell,subs='+attributes,macros'] ----- -jsonpathExpression:example$yaml/${basename}.kamelet.yaml[query='$.spec', format='kamelets.pipeCommand("{type}", "{name}", definition, "channel:mychannel")', requires={requires}] +- route: + from: + uri: "kamelet:timer-source" + parameters: + period: 10000 + message: 'test' + steps: + - to: + uri: "kamelet:\`{name}\`" ---- - -This command creates the Kamelet Pipe in the current namespace on the cluster. - -=== Kafka {type} - -ifeval::['{type}' == 'action'] -You can use the \`{name}\` Kamelet as an intermediate step in a Kafka binding. endif::[] -ifeval::['{type}' != 'action'] -You can use the \`{name}\` Kamelet as a Kafka {type} by binding it to a Kafka topic. -endif::[] - -:ref-api-version: kafka.strimzi.io/v1beta1 -:ref-kind: KafkaTopic -:ref-name: my-topic - -.{name}-pipe.yaml -[source,yaml,subs='+attributes,macros'] ----- -jsonpathExpression::example$yaml/${basename}.kamelet.yaml[query='$', format='kamelets.pipe("{type}", apiVersion, kind, metadata, spec, "{ref-kind}", "{ref-api-version}", "{ref-name}")', outputFormat=yml, requires={requires}] ----- - -==== *Prerequisites* -* You've installed https://strimzi.io/[Strimzi]. -* You've created a topic named \`my-topic\` in the current namespace. -* You have xref:{camel-k-docs-version}@camel-k::installation/installation.adoc[Camel K installed] on the cluster. - -==== *Procedure for using the cluster CLI* - -. Save the \`{name}-pipe.yaml\` file to your local drive, and then edit it as needed for your configuration. +You can now run it directly through the following command -. Run the {type} by using the following command: -+ [source,shell,subs=+attributes] ---- -kubectl apply -f {name}-pipe.yaml ----- - -==== *Procedure for using the Kamel CLI* - -Configure and run the {type} by using the following command: - -[source,shell,subs='+attributes,macros'] ----- -jsonpathExpression::example$yaml/${basename}.kamelet.yaml[query='$.spec', format='kamelets.pipeCommand("{type}", "{name}", definition, "kafka.strimzi.io/v1beta1:KafkaTopic:my-topic")', requires={requires}] +camel run route.yaml ---- -This command creates the Kamelet Pipe in the current namespace on the cluster. - == Kamelet source file https://github.com/apache/camel-kamelets/blob/main/kamelets/{name}.kamelet.yaml