Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kamelets-doc-template-edit #538

Merged
merged 2 commits into from
Oct 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 39 additions & 29 deletions docs/modules/ROOT/kamelet.adoc.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT

= {{ .Image }} {{ .Kamelet.Spec.Definition.Title }}

*Provided by: "{{ index .Kamelet.ObjectMeta.Annotations "camel.apache.org/provider" }}"*
Expand All @@ -11,94 +12,103 @@
{{ if .HasProperties }}
The following table summarizes the configuration options available for the `{{ .Kamelet.ObjectMeta.Name }}` Kamelet:
{{ .Properties }}
NOTE: Fields marked with ({empty}*) are mandatory.
NOTE: Fields marked with an asterisk ({empty}*) are mandatory.
{{ else }}
The Kamelet does not specify any configuration option.
The `{{ .Kamelet.ObjectMeta.Name }}` Kamelet does not specify any configuration option.
{{ end }}

== Dependencies

At runtime, the `{{ .Kamelet.ObjectMeta.Name }} Kamelet relies upon the presence of the following dependencies:
{{range .Kamelet.Spec.Dependencies}}
- {{ . }}{{end}}

== Usage

This section summarizes how the `{{ .Kamelet.ObjectMeta.Name }}` can be used in various contexts.
This section describes how you can use the `{{ .Kamelet.ObjectMeta.Name }}`.

=== Knative {{ index .Kamelet.ObjectMeta.Labels "camel.apache.org/kamelet.type" | ToCamel }}

{{ if eq (index .Kamelet.ObjectMeta.Labels "camel.apache.org/kamelet.type") "action" -}}
The `{{ .Kamelet.ObjectMeta.Name }}` Kamelet can be used as intermediate step in a Knative binding.
You can use the `{{ .Kamelet.ObjectMeta.Name }}` Kamelet as an intermediate step in a Knative binding.
{{ else -}}
The `{{ .Kamelet.ObjectMeta.Name }}` Kamelet can be used as Knative {{ index .Kamelet.ObjectMeta.Labels "camel.apache.org/kamelet.type" }} by binding it to a Knative object.
You can use the `{{ .Kamelet.ObjectMeta.Name }}` Kamelet as a Knative {{ index .Kamelet.ObjectMeta.Labels "camel.apache.org/kamelet.type" }} by binding it to a Knative object.
{{ end }}
{{- .SetVal "RefApiVersion" "messaging.knative.dev/v1" -}}{{- .SetVal "RefKind" "Channel" -}}{{- .SetVal "RefName" "mychannel" }}
.{{ .Kamelet.ObjectMeta.Name }}-binding.yaml
[source,yaml]
----
{{ template "kamelet-binding-sink-source.tmpl" . }}
----
Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `{{ .Kamelet.ObjectMeta.Name }}-binding.yaml` file into your hard drive, then configure it according to your needs.
==== *Prerequisite*

You have xref:latest@camel-k::installation/installation.adoc[Camel K installed] on the cluster.

You can run the {{ index .Kamelet.ObjectMeta.Labels "camel.apache.org/kamelet.type" }} using the following command:
==== *Procedure for using the cluster CLI*

. Save the `{{ .Kamelet.ObjectMeta.Name }}-binding.yaml` file to your local drive, and then edit it as needed for your configuration.

. Run the {{ index .Kamelet.ObjectMeta.Labels "camel.apache.org/kamelet.type" }} by using the following command:
+
[source,shell]
----
kubectl apply -f {{ .Kamelet.ObjectMeta.Name }}-binding.yaml
----

==== *Dependencies*

The Kamelet needs the following dependencies:
{{range .Kamelet.Spec.Dependencies}}
- {{ . }}{{end}}
==== *Procedure for using the Kamel CLI*

==== *Binding to Knative using the Kamel CLI:*

The procedure described above can be simplified into a single execution of the `kamel bind` command:
Configure and run the {{ index .Kamelet.ObjectMeta.Labels "camel.apache.org/kamelet.type" }} by using the following command:

[source,shell]
----
{{ .ExampleKamelBindCommand "channel:mychannel" }}
----

This will create the KameletBinding under the hood and apply it to the current namespace in the cluster.
This command creates the KameletBinding in the current namespace on the cluster.

=== Kafka {{ index .Kamelet.ObjectMeta.Labels "camel.apache.org/kamelet.type" | ToCamel }}

{{ if eq (index .Kamelet.ObjectMeta.Labels "camel.apache.org/kamelet.type") "action" -}}
The `{{ .Kamelet.ObjectMeta.Name }}` Kamelet can be used as intermediate step in a Kafka binding.
You can use the `{{ .Kamelet.ObjectMeta.Name }}` Kamelet as an intermediate step in a Kafka binding.
{{ else -}}
The `{{ .Kamelet.ObjectMeta.Name }}` Kamelet can be used as Kafka {{ index .Kamelet.ObjectMeta.Labels "camel.apache.org/kamelet.type" }} by binding it to a Kafka topic.
You can use the `{{ .Kamelet.ObjectMeta.Name }}` Kamelet as a Kafka {{ index .Kamelet.ObjectMeta.Labels "camel.apache.org/kamelet.type" }} by binding it to a Kafka topic.
{{ end }} {{- .SetVal "RefApiVersion" "kafka.strimzi.io/v1beta1" -}}{{- .SetVal "RefKind" "KafkaTopic" -}}{{- .SetVal "RefName" "my-topic" }}
.{{ .Kamelet.ObjectMeta.Name }}-binding.yaml
[source,yaml]
----
{{ template "kamelet-binding-sink-source.tmpl" . }}
----

Ensure that you've installed https://strimzi.io/[Strimzi] and created a topic named `my-topic` in the current namespace.
Make also sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.
==== *Prerequisites*

* You've installed https://strimzi.io/[Strimzi].
* You've created a topic named `my-topic` in the current namespace.
* You have xref:latest@camel-k::installation/installation.adoc[Camel K installed] on the cluster.

Save the `{{ .Kamelet.ObjectMeta.Name }}-binding.yaml` file into your hard drive, then configure it according to your needs.
==== *Procedure for using the cluster CLI*

You can run the {{ index .Kamelet.ObjectMeta.Labels "camel.apache.org/kamelet.type" }} using the following command:
. Save the `{{ .Kamelet.ObjectMeta.Name }}-binding.yaml` file to your local drive, and then edit it as needed for your configuration.

. Run the {{ index .Kamelet.ObjectMeta.Labels "camel.apache.org/kamelet.type" }} by using the following command:
+
[source,shell]
----
kubectl apply -f {{ .Kamelet.ObjectMeta.Name }}-binding.yaml
----

==== *Binding to Kafka using the Kamel CLI:*
==== *Procedure for using the Kamel CLI*

The procedure described above can be simplified into a single execution of the `kamel bind` command:
Configure and run the {{ index .Kamelet.ObjectMeta.Labels "camel.apache.org/kamelet.type" }} by using the following command:

[source,shell]
----
{{ .ExampleKamelBindCommand "kafka.strimzi.io/v1beta1:KafkaTopic:my-topic" }}
----

This will create the KameletBinding under the hood and apply it to the current namespace in the cluster.

==== Kamelet source file
This command creates the KameletBinding in the current namespace on the cluster.

Have a look at the following link:
== Kamelet source file

https://github.com/apache/camel-kamelets/blob/main/{{ .Kamelet.ObjectMeta.Name }}.kamelet.yaml

Expand Down