From 79fe26b5bc22d825ba4280f2d6aec04d65b2c550 Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Thu, 16 Dec 2021 14:09:52 +0100 Subject: [PATCH 1/5] Added Google Storage Sink Kamelet --- kamelets/google-storage-sink.kamelet.yaml | 91 +++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 kamelets/google-storage-sink.kamelet.yaml diff --git a/kamelets/google-storage-sink.kamelet.yaml b/kamelets/google-storage-sink.kamelet.yaml new file mode 100644 index 000000000..12ef2edff --- /dev/null +++ b/kamelets/google-storage-sink.kamelet.yaml @@ -0,0 +1,91 @@ +# --------------------------------------------------------------------------- +# 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: Kamelet +metadata: + name: google-storage-sink + annotations: + camel.apache.org/kamelet.support.level: "Preview" + camel.apache.org/catalog.version: "main-SNAPSHOT" + camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBoZWlnaHQ9IjgwMCIgd2lkdGg9IjEyMDAiIHZpZXdCb3g9Ii0xOS4yMDAxNSAtMjguNDgzIDE2Ni40MDEzIDE3MC44OTgiPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTcuMDM0KSI+PGxpbmVhckdyYWRpZW50IHkyPSIxM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camel.apache.org/kamelet.group: "Google Storage" + labels: + camel.apache.org/kamelet.type: "sink" +spec: + definition: + title: "Google Storage Sink" + description: |- + Upload Objects to Google Storage. + + The serviceAccountKey property needs to be encoded in base64, so when you pass it as parameter, don't forget to encode it. + + - `file` / `ce-file`: as the file name to upload + + If the header won't be set the exchange ID will be used as file name. + required: + - bucketNameOrArn + - serviceAccountKey + type: object + properties: + bucketNameOrArn: + title: Bucket Name Or ARN + description: The Bucket Name or Bucket ARN + type: string + serviceAccountKey: + title: Service Account Key + description: The Service account key that can be used as credentials for the Google Cloud Storage access. + type: binary + x-descriptors: + - urn:camel:group:credentials + autoCreateBucket: + title: Autocreate Bucket + description: Setting the autocreation of the Google Cloud Storage bucket bucketNameOrArn. + type: boolean + x-descriptors: + - 'urn:alm:descriptor:com.tectonic.ui:checkbox' + default: false + dependencies: + - "camel:kamelet" + - "camel:google-storage" + - "camel:jackson" + flow: + from: + uri: "kamelet:source" + steps: + - choice: + when: + - simple: "${header[file]}" + steps: + - set-header: + name: CamelGoogleCloudStorageObjectName + simple: "${header[file]}" + - simple: "${header[ce-file]}" + steps: + - set-header: + name: CamelGoogleCloudStorageObjectName + simple: "${header[ce-file]}" + otherwise: + steps: + - set-header: + name: CamelGoogleCloudStorageObjectName + simple: "${exchangeId}" + - to: + uri: "google-storage://{{bucketNameOrArn}}" + parameters: + autoCreateBucket: "{{autoCreateBucket}}" + serviceAccountKey: "base64:{{serviceAccountKey}}" From 9a9d8a0deeea44528a500a9353971fa86d3523c3 Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Thu, 16 Dec 2021 14:12:08 +0100 Subject: [PATCH 2/5] Added Google Storage Sink Kamelet --- .../kamelets/google-storage-sink.kamelet.yaml | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 library/camel-kamelets/src/main/resources/kamelets/google-storage-sink.kamelet.yaml diff --git a/library/camel-kamelets/src/main/resources/kamelets/google-storage-sink.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/google-storage-sink.kamelet.yaml new file mode 100644 index 000000000..12ef2edff --- /dev/null +++ b/library/camel-kamelets/src/main/resources/kamelets/google-storage-sink.kamelet.yaml @@ -0,0 +1,91 @@ +# --------------------------------------------------------------------------- +# 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: Kamelet +metadata: + name: google-storage-sink + annotations: + camel.apache.org/kamelet.support.level: "Preview" + camel.apache.org/catalog.version: "main-SNAPSHOT" + camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBoZWlnaHQ9IjgwMCIgd2lkdGg9IjEyMDAiIHZpZXdCb3g9Ii0xOS4yMDAxNSAtMjguNDgzIDE2Ni40MDEzIDE3MC44OTgiPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTcuMDM0KSI+PGxpbmVhckdyYWRpZW50IHkyPSIxMjAuNzg5IiB4Mj0iNjQiIHkxPSI3LjAzNCIgeDE9IjY0IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgaWQ9ImEiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzQzODdmZCIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzQ2ODNlYSIvPjwvbGluZWFyR3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YgMTAuODE2LjAwMkwxMTguOTM2IDg0IDg1LjQ4OSA1MC41NXoiLz48L2c+PHBhdGggZD0iTTg0LjcgNDMuMjM2SDQzLjI2NGMtLjY2NyAwLTEuMjEyLjU0Ni0xLjIxMiAxLjIxNHY4LjU2NmMwIC42NjYuNTQ2IDEuMjEyIDEuMjEyIDEuMjEySDg0LjdjLjY2NyAwIDEuMjEzLS41NDYgMS4yMTMtMS4yMTJ2LTguNTY4YzAtLjY2Ni0uNTQ1LTEuMjEzLTEuMjEyLTEuMjEzbS02LjQxNiA3Ljk3NmEyLjQ4NCAyLjQ4NCAwIDAxLTIuNDc3LTIuNDggMi40NzUgMi40NzUgMCAwMTIuNDc3LTIuNDc3YzEuMzcgMCAyLjQ4IDEuMTAzIDIuNDggMi40NzdhMi40OCAyLjQ4IDAgMDEtMi40OCAyLjQ4bTYuNDE1IDguNDkxbC00MS40MzYuMDAyYy0uNjY3IDAtMS4yMTIuNTQ2LTEuMjEyIDEuMjE0djguNTY1YzAgLjY2Ni41NDYgMS4yMTMgMS4yMTIgMS4yMTNIODQuN2MuNjY3IDAgMS4yMTMtLjU0NyAxLjIxMy0xLjIxM3YtOC41NjdjMC0uNjY2LS41NDUtMS4yMTQtMS4yMTItMS4yMTRtLTYuNDE2IDcuOTc2YTIuNDgzIDIuNDgzIDAgMDEtMi40NzctMi40OCAyLjQ3NSAyLjQ3NSAwIDAxMi40NzctMi40NzcgMi40OCAyLjQ4IDAgMTEwIDQuOTU2IiBmaWxsPSIjZmZmIi8+PC9zdmc+" + camel.apache.org/provider: "Apache Software Foundation" + camel.apache.org/kamelet.group: "Google Storage" + labels: + camel.apache.org/kamelet.type: "sink" +spec: + definition: + title: "Google Storage Sink" + description: |- + Upload Objects to Google Storage. + + The serviceAccountKey property needs to be encoded in base64, so when you pass it as parameter, don't forget to encode it. + + - `file` / `ce-file`: as the file name to upload + + If the header won't be set the exchange ID will be used as file name. + required: + - bucketNameOrArn + - serviceAccountKey + type: object + properties: + bucketNameOrArn: + title: Bucket Name Or ARN + description: The Bucket Name or Bucket ARN + type: string + serviceAccountKey: + title: Service Account Key + description: The Service account key that can be used as credentials for the Google Cloud Storage access. + type: binary + x-descriptors: + - urn:camel:group:credentials + autoCreateBucket: + title: Autocreate Bucket + description: Setting the autocreation of the Google Cloud Storage bucket bucketNameOrArn. + type: boolean + x-descriptors: + - 'urn:alm:descriptor:com.tectonic.ui:checkbox' + default: false + dependencies: + - "camel:kamelet" + - "camel:google-storage" + - "camel:jackson" + flow: + from: + uri: "kamelet:source" + steps: + - choice: + when: + - simple: "${header[file]}" + steps: + - set-header: + name: CamelGoogleCloudStorageObjectName + simple: "${header[file]}" + - simple: "${header[ce-file]}" + steps: + - set-header: + name: CamelGoogleCloudStorageObjectName + simple: "${header[ce-file]}" + otherwise: + steps: + - set-header: + name: CamelGoogleCloudStorageObjectName + simple: "${exchangeId}" + - to: + uri: "google-storage://{{bucketNameOrArn}}" + parameters: + autoCreateBucket: "{{autoCreateBucket}}" + serviceAccountKey: "base64:{{serviceAccountKey}}" From 8715f9ba5b77e67c1fab57e8550cbd22fa785cd7 Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Thu, 16 Dec 2021 14:12:53 +0100 Subject: [PATCH 3/5] Added Google Storage Sink Kamelet --- docs/modules/ROOT/nav.adoc | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc index 44e6928bd..11225af3b 100644 --- a/docs/modules/ROOT/nav.adoc +++ b/docs/modules/ROOT/nav.adoc @@ -59,6 +59,7 @@ * xref:ROOT:google-pubsub-sink.adoc[image:kamelets/google-pubsub-sink.svg[] Google Pubsub Sink] * xref:ROOT:google-pubsub-source.adoc[image:kamelets/google-pubsub-source.svg[] Google Pubsub Source] * xref:ROOT:google-sheets-source.adoc[image:kamelets/google-sheets-source.svg[] Google Sheets Source] +* xref:ROOT:google-storage-sink.adoc[image:kamelets/google-storage-sink.svg[] Google Storage Sink] * xref:ROOT:google-storage-source.adoc[image:kamelets/google-storage-source.svg[] Google Storage Source] * xref:ROOT:has-header-filter-action.adoc[image:kamelets/has-header-filter-action.svg[] Has Header Filter Action] * xref:ROOT:header-matches-filter-action.adoc[image:kamelets/header-matches-filter-action.svg[] Header Matches Filter Action] From 14967bb13c42165abe6f99f09077ae755ae0a8d5 Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Thu, 16 Dec 2021 14:13:06 +0100 Subject: [PATCH 4/5] Added Google Storage Sink Kamelet - Docs --- .../images/kamelets/google-storage-sink.svg | 1 + .../ROOT/pages/google-storage-sink.adoc | 157 ++++++++++++++++++ 2 files changed, 158 insertions(+) create mode 100644 docs/modules/ROOT/assets/images/kamelets/google-storage-sink.svg create mode 100644 docs/modules/ROOT/pages/google-storage-sink.adoc diff --git a/docs/modules/ROOT/assets/images/kamelets/google-storage-sink.svg b/docs/modules/ROOT/assets/images/kamelets/google-storage-sink.svg new file mode 100644 index 000000000..d30e00308 --- /dev/null +++ b/docs/modules/ROOT/assets/images/kamelets/google-storage-sink.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/modules/ROOT/pages/google-storage-sink.adoc b/docs/modules/ROOT/pages/google-storage-sink.adoc new file mode 100644 index 000000000..f36cd8497 --- /dev/null +++ b/docs/modules/ROOT/pages/google-storage-sink.adoc @@ -0,0 +1,157 @@ +// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT + += image:kamelets/google-storage-sink.svg[] Google Storage Sink + +*Provided by: "Apache Software Foundation"* + +*Support Level for this Kamelet is: "Preview"* + +Upload Objects to Google Storage. + +The serviceAccountKey property needs to be encoded in base64, so when you pass it as parameter, don't forget to encode it. + +- `file` / `ce-file`: as the file name to upload + +If the header won't be set the exchange ID will be used as file name. + +== Configuration Options + +The following table summarizes the configuration options available for the `google-storage-sink` Kamelet: +[width="100%",cols="2,^2,3,^2,^2,^3",options="header"] +|=== +| Property| Name| Description| Type| Default| Example +| *bucketNameOrArn {empty}* *| Bucket Name Or ARN| The Bucket Name or Bucket ARN| string| | +| *serviceAccountKey {empty}* *| Service Account Key| The Service account key that can be used as credentials for the Google Cloud Storage access.| binary| | +| autoCreateBucket| Autocreate Bucket| Setting the autocreation of the Google Cloud Storage bucket bucketNameOrArn.| boolean| `false`| +|=== + +NOTE: Fields marked with an asterisk ({empty}*) are mandatory. + + +== Dependencies + +At runtime, the `google-storage-sink` Kamelet relies upon the presence of the following dependencies: + +- camel:kamelet +- camel:google-storage +- camel:jackson + +== Usage + +This section describes how you can use the `google-storage-sink`. + +=== Knative Sink + +You can use the `google-storage-sink` Kamelet as a Knative sink by binding it to a Knative object. + +.google-storage-sink-binding.yaml +[source,yaml] +---- +apiVersion: camel.apache.org/v1alpha1 +kind: KameletBinding +metadata: + name: google-storage-sink-binding +spec: + source: + ref: + kind: Channel + apiVersion: messaging.knative.dev/v1 + name: mychannel + sink: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1alpha1 + name: google-storage-sink + properties: + bucketNameOrArn: "The Bucket Name Or ARN" + serviceAccountKey: "The Service Account Key" + +---- + +==== *Prerequisite* + +You have xref:{camel-k-version}@camel-k::installation/installation.adoc[Camel K installed] on the cluster. + +==== *Procedure for using the cluster CLI* + +. Save the `google-storage-sink-binding.yaml` file to your local drive, and then edit it as needed for your configuration. + +. Run the sink by using the following command: ++ +[source,shell] +---- +kubectl apply -f google-storage-sink-binding.yaml +---- + +==== *Procedure for using the Kamel CLI* + +Configure and run the sink by using the following command: + +[source,shell] +---- +kamel bind channel:mychannel google-storage-sink -p "sink.bucketNameOrArn=The Bucket Name Or ARN" -p "sink.serviceAccountKey=The Service Account Key" +---- + +This command creates the KameletBinding in the current namespace on the cluster. + +=== Kafka Sink + +You can use the `google-storage-sink` Kamelet as a Kafka sink by binding it to a Kafka topic. + +.google-storage-sink-binding.yaml +[source,yaml] +---- +apiVersion: camel.apache.org/v1alpha1 +kind: KameletBinding +metadata: + name: google-storage-sink-binding +spec: + source: + ref: + kind: KafkaTopic + apiVersion: kafka.strimzi.io/v1beta1 + name: my-topic + sink: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1alpha1 + name: google-storage-sink + properties: + bucketNameOrArn: "The Bucket Name Or ARN" + serviceAccountKey: "The Service Account Key" + +---- + +==== *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-version}@camel-k::installation/installation.adoc[Camel K installed] on the cluster. + +==== *Procedure for using the cluster CLI* + +. Save the `google-storage-sink-binding.yaml` file to your local drive, and then edit it as needed for your configuration. + +. Run the sink by using the following command: ++ +[source,shell] +---- +kubectl apply -f google-storage-sink-binding.yaml +---- + +==== *Procedure for using the Kamel CLI* + +Configure and run the sink by using the following command: + +[source,shell] +---- +kamel bind kafka.strimzi.io/v1beta1:KafkaTopic:my-topic google-storage-sink -p "sink.bucketNameOrArn=The Bucket Name Or ARN" -p "sink.serviceAccountKey=The Service Account Key" +---- + +This command creates the KameletBinding in the current namespace on the cluster. + +== Kamelet source file + +https://github.com/apache/camel-kamelets/blob/main/kamelets/google-storage-sink.kamelet.yaml + +// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT From ea820bd6803591108202c70645cd6556426e3c78 Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Thu, 16 Dec 2021 14:13:21 +0100 Subject: [PATCH 5/5] Added Google Storage Sink Kamelet - Templates --- .../camel-k/google-storage-sink-binding.yaml | 19 +++++++++++++++++++ .../core/google-storage-sink-binding.yaml | 13 +++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 templates/bindings/camel-k/google-storage-sink-binding.yaml create mode 100644 templates/bindings/core/google-storage-sink-binding.yaml diff --git a/templates/bindings/camel-k/google-storage-sink-binding.yaml b/templates/bindings/camel-k/google-storage-sink-binding.yaml new file mode 100644 index 000000000..cd8eb5ea3 --- /dev/null +++ b/templates/bindings/camel-k/google-storage-sink-binding.yaml @@ -0,0 +1,19 @@ +apiVersion: camel.apache.org/v1alpha1 +kind: KameletBinding +metadata: + name: google-storage-sink-binding +spec: + source: + ref: + kind: KafkaTopic + apiVersion: kafka.strimzi.io/v1beta1 + name: my-topic + sink: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1alpha1 + name: google-storage-sink + properties: + bucketNameOrArn: "The Bucket Name Or ARN" + serviceAccountKey: "The Service Account Key" + \ No newline at end of file diff --git a/templates/bindings/core/google-storage-sink-binding.yaml b/templates/bindings/core/google-storage-sink-binding.yaml new file mode 100644 index 000000000..49ffb63cc --- /dev/null +++ b/templates/bindings/core/google-storage-sink-binding.yaml @@ -0,0 +1,13 @@ +- route: + from: + uri: "kamelet:timer-source" + parameters: + period: 1000 + message: "Hello Camel JBang" + steps: + - to: + uri: "kamelet:google-storage-sink" + parameters: + bucketNameOrArn: "The Bucket Name Or ARN" + serviceAccountKey: "The Service Account Key" + \ No newline at end of file