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

Externalize the Kamelet binding template in the Kafka Source #456

Merged
merged 2 commits into from
Aug 4, 2021
Merged
Show file tree
Hide file tree
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
43 changes: 43 additions & 0 deletions docs/modules/ROOT/kamelet-binding-sink-source.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: {{ .Kamelet.ObjectMeta.Name }}-binding
spec:
{{ if eq (index .Kamelet.ObjectMeta.Labels "camel.apache.org/kamelet.type") "sink" }}source:
ref:
kind: {{ .GetVal "RefKind" }}
apiVersion: {{ .GetVal "RefApiVersion" }}
name: {{ .GetVal "RefName" }}
sink:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: {{ .Kamelet.ObjectMeta.Name }}{{ template "properties-list.tmpl" . }}
{{ else if eq (index .Kamelet.ObjectMeta.Labels "camel.apache.org/kamelet.type") "source" }}source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: {{ .Kamelet.ObjectMeta.Name }}{{ template "properties-list.tmpl" . }}
sink:
ref:
kind: {{ .GetVal "RefKind" }}
apiVersion: {{ .GetVal "RefApiVersion" }}
name: {{ .GetVal "RefName" }}
{{ else if eq (index .Kamelet.ObjectMeta.Labels "camel.apache.org/kamelet.type") "action" }}source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: timer-source
properties:
message: "Hello"
steps:
- ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: {{ .Kamelet.ObjectMeta.Name }}{{ template "properties-list.tmpl" . }}
sink:
ref:
kind: {{ .GetVal "RefKind" }}
apiVersion: {{ .GetVal "RefApiVersion" }}
name: {{ .GetVal "RefName" }}
{{ end }}
16 changes: 13 additions & 3 deletions docs/modules/ROOT/kamelet.adoc.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ The `{{ .Kamelet.ObjectMeta.Name }}` Kamelet can be used as intermediate step in
{{ 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.
{{ end }}
{{ .ExampleBinding "messaging.knative.dev/v1" "InMemoryChannel" "mychannel" }}
{{- .SetVal "RefApiVersion" "messaging.knative.dev/v1" -}}{{- .SetVal "RefKind" "InMemoryChannel" -}}{{- .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.
Expand Down Expand Up @@ -55,8 +60,13 @@ This will create the KameletBinding under the hood and apply it to the current n
The `{{ .Kamelet.ObjectMeta.Name }}` Kamelet can be used as 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.
{{ end }}
{{ .ExampleBinding "kafka.strimzi.io/v1beta1" "KafkaTopic" "my-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.

Expand Down
1 change: 0 additions & 1 deletion docs/modules/ROOT/pages/avro-deserialize-action.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ spec:
name: mychannel

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `avro-deserialize-action-binding.yaml` file into your hard drive, then configure it according to your needs.
Expand Down
1 change: 0 additions & 1 deletion docs/modules/ROOT/pages/avro-serialize-action.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ spec:
name: mychannel

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `avro-serialize-action-binding.yaml` file into your hard drive, then configure it according to your needs.
Expand Down
5 changes: 2 additions & 3 deletions docs/modules/ROOT/pages/aws-cloudwatch-sink.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ spec:
cw_namespace: "The Cloud Watch Namespace"
region: "eu-west-1"
secretKey: "The Secret Key"

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `aws-cloudwatch-sink-binding.yaml` file into your hard drive, then configure it according to your needs.
Expand Down Expand Up @@ -113,7 +112,7 @@ spec:
cw_namespace: "The Cloud Watch Namespace"
region: "eu-west-1"
secretKey: "The Secret Key"

----

Ensure that you've installed https://strimzi.io/[Strimzi] and created a topic named `my-topic` in the current namespace.
Expand Down
5 changes: 2 additions & 3 deletions docs/modules/ROOT/pages/aws-ddb-streams-source.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ spec:
kind: InMemoryChannel
apiVersion: messaging.knative.dev/v1
name: mychannel

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `aws-ddb-streams-source-binding.yaml` file into your hard drive, then configure it according to your needs.
Expand Down Expand Up @@ -106,7 +105,7 @@ spec:
kind: KafkaTopic
apiVersion: kafka.strimzi.io/v1beta1
name: my-topic

----

Ensure that you've installed https://strimzi.io/[Strimzi] and created a topic named `my-topic` in the current namespace.
Expand Down
5 changes: 2 additions & 3 deletions docs/modules/ROOT/pages/aws-ec2-sink.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ spec:
accessKey: "The Access Key"
region: "eu-west-1"
secretKey: "The Secret Key"

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `aws-ec2-sink-binding.yaml` file into your hard drive, then configure it according to your needs.
Expand Down Expand Up @@ -105,7 +104,7 @@ spec:
accessKey: "The Access Key"
region: "eu-west-1"
secretKey: "The Secret Key"

----

Ensure that you've installed https://strimzi.io/[Strimzi] and created a topic named `my-topic` in the current namespace.
Expand Down
5 changes: 2 additions & 3 deletions docs/modules/ROOT/pages/aws-kinesis-firehose-sink.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ spec:
region: "eu-west-1"
secretKey: "The Secret Key"
streamName: "The Stream Name"

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `aws-kinesis-firehose-sink-binding.yaml` file into your hard drive, then configure it according to your needs.
Expand Down Expand Up @@ -104,7 +103,7 @@ spec:
region: "eu-west-1"
secretKey: "The Secret Key"
streamName: "The Stream Name"

----

Ensure that you've installed https://strimzi.io/[Strimzi] and created a topic named `my-topic` in the current namespace.
Expand Down
5 changes: 2 additions & 3 deletions docs/modules/ROOT/pages/aws-kinesis-sink.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ spec:
region: "eu-west-1"
secretKey: "The Secret Key"
stream: "The Stream Name"

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `aws-kinesis-sink-binding.yaml` file into your hard drive, then configure it according to your needs.
Expand Down Expand Up @@ -116,7 +115,7 @@ spec:
region: "eu-west-1"
secretKey: "The Secret Key"
stream: "The Stream Name"

----

Ensure that you've installed https://strimzi.io/[Strimzi] and created a topic named `my-topic` in the current namespace.
Expand Down
5 changes: 2 additions & 3 deletions docs/modules/ROOT/pages/aws-kinesis-source.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ spec:
kind: InMemoryChannel
apiVersion: messaging.knative.dev/v1
name: mychannel

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `aws-kinesis-source-binding.yaml` file into your hard drive, then configure it according to your needs.
Expand Down Expand Up @@ -104,7 +103,7 @@ spec:
kind: KafkaTopic
apiVersion: kafka.strimzi.io/v1beta1
name: my-topic

----

Ensure that you've installed https://strimzi.io/[Strimzi] and created a topic named `my-topic` in the current namespace.
Expand Down
5 changes: 2 additions & 3 deletions docs/modules/ROOT/pages/aws-lambda-sink.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ spec:
function: "The Function Name"
region: "eu-west-1"
secretKey: "The Secret Key"

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `aws-lambda-sink-binding.yaml` file into your hard drive, then configure it according to your needs.
Expand Down Expand Up @@ -104,7 +103,7 @@ spec:
function: "The Function Name"
region: "eu-west-1"
secretKey: "The Secret Key"

----

Ensure that you've installed https://strimzi.io/[Strimzi] and created a topic named `my-topic` in the current namespace.
Expand Down
5 changes: 2 additions & 3 deletions docs/modules/ROOT/pages/aws-s3-sink.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ spec:
bucketNameOrArn: "The Bucket Name"
region: "eu-west-1"
secretKey: "The Secret Key"

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `aws-s3-sink-binding.yaml` file into your hard drive, then configure it according to your needs.
Expand Down Expand Up @@ -111,7 +110,7 @@ spec:
bucketNameOrArn: "The Bucket Name"
region: "eu-west-1"
secretKey: "The Secret Key"

----

Ensure that you've installed https://strimzi.io/[Strimzi] and created a topic named `my-topic` in the current namespace.
Expand Down
5 changes: 2 additions & 3 deletions docs/modules/ROOT/pages/aws-s3-source.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ spec:
kind: InMemoryChannel
apiVersion: messaging.knative.dev/v1
name: mychannel

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `aws-s3-source-binding.yaml` file into your hard drive, then configure it according to your needs.
Expand Down Expand Up @@ -109,7 +108,7 @@ spec:
kind: KafkaTopic
apiVersion: kafka.strimzi.io/v1beta1
name: my-topic

----

Ensure that you've installed https://strimzi.io/[Strimzi] and created a topic named `my-topic` in the current namespace.
Expand Down
5 changes: 2 additions & 3 deletions docs/modules/ROOT/pages/aws-s3-streaming-upload-sink.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ spec:
keyName: "The Key Name"
region: "eu-west-1"
secretKey: "The Secret Key"

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `aws-s3-streaming-upload-sink-binding.yaml` file into your hard drive, then configure it according to your needs.
Expand Down Expand Up @@ -113,7 +112,7 @@ spec:
keyName: "The Key Name"
region: "eu-west-1"
secretKey: "The Secret Key"

----

Ensure that you've installed https://strimzi.io/[Strimzi] and created a topic named `my-topic` in the current namespace.
Expand Down
5 changes: 2 additions & 3 deletions docs/modules/ROOT/pages/aws-sns-fifo-sink.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ spec:
region: "eu-west-1"
secretKey: "The Secret Key"
topicNameOrArn: "The Topic Name"

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `aws-sns-fifo-sink-binding.yaml` file into your hard drive, then configure it according to your needs.
Expand Down Expand Up @@ -106,7 +105,7 @@ spec:
region: "eu-west-1"
secretKey: "The Secret Key"
topicNameOrArn: "The Topic Name"

----

Ensure that you've installed https://strimzi.io/[Strimzi] and created a topic named `my-topic` in the current namespace.
Expand Down
5 changes: 2 additions & 3 deletions docs/modules/ROOT/pages/aws-sns-sink.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ spec:
region: "eu-west-1"
secretKey: "The Secret Key"
topicNameOrArn: "The Topic Name"

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `aws-sns-sink-binding.yaml` file into your hard drive, then configure it according to your needs.
Expand Down Expand Up @@ -105,7 +104,7 @@ spec:
region: "eu-west-1"
secretKey: "The Secret Key"
topicNameOrArn: "The Topic Name"

----

Ensure that you've installed https://strimzi.io/[Strimzi] and created a topic named `my-topic` in the current namespace.
Expand Down
5 changes: 2 additions & 3 deletions docs/modules/ROOT/pages/aws-sqs-batch-sink.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ spec:
queueNameOrArn: "The Queue Name"
region: "eu-west-1"
secretKey: "The Secret Key"

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `aws-sqs-batch-sink-binding.yaml` file into your hard drive, then configure it according to your needs.
Expand Down Expand Up @@ -108,7 +107,7 @@ spec:
queueNameOrArn: "The Queue Name"
region: "eu-west-1"
secretKey: "The Secret Key"

----

Ensure that you've installed https://strimzi.io/[Strimzi] and created a topic named `my-topic` in the current namespace.
Expand Down
5 changes: 2 additions & 3 deletions docs/modules/ROOT/pages/aws-sqs-fifo-sink.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ spec:
queueNameOrArn: "The Queue Name"
region: "eu-west-1"
secretKey: "The Secret Key"

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `aws-sqs-fifo-sink-binding.yaml` file into your hard drive, then configure it according to your needs.
Expand Down Expand Up @@ -106,7 +105,7 @@ spec:
queueNameOrArn: "The Queue Name"
region: "eu-west-1"
secretKey: "The Secret Key"

----

Ensure that you've installed https://strimzi.io/[Strimzi] and created a topic named `my-topic` in the current namespace.
Expand Down
5 changes: 2 additions & 3 deletions docs/modules/ROOT/pages/aws-sqs-sink.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ spec:
queueNameOrArn: "The Queue Name"
region: "eu-west-1"
secretKey: "The Secret Key"

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `aws-sqs-sink-binding.yaml` file into your hard drive, then configure it according to your needs.
Expand Down Expand Up @@ -105,7 +104,7 @@ spec:
queueNameOrArn: "The Queue Name"
region: "eu-west-1"
secretKey: "The Secret Key"

----

Ensure that you've installed https://strimzi.io/[Strimzi] and created a topic named `my-topic` in the current namespace.
Expand Down
Loading