This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector-examples.git
The following commit(s) were added to refs/heads/master by this push: new be2005f AWS2 SNS Sink Example: Added steps for Openshift secret creds be2005f is described below commit be2005fdc6268e58eead493985d96461671e9648 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Tue Sep 22 07:49:33 2020 +0200 AWS2 SNS Sink Example: Added steps for Openshift secret creds --- aws2-sns/aws2-sns-sink/README.adoc | 28 ++++++++++++++++++++++ .../config/openshift/aws2-sns-cred.properties | 3 +++ .../config/openshift/aws2-sns-sink-connector.yaml | 18 ++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/aws2-sns/aws2-sns-sink/README.adoc b/aws2-sns/aws2-sns-sink/README.adoc index b73d41b..59a2ee3 100644 --- a/aws2-sns/aws2-sns-sink/README.adoc +++ b/aws2-sns/aws2-sns-sink/README.adoc @@ -169,6 +169,34 @@ You should see something like this: [{"class":"org.apache.camel.kafkaconnector.CamelSinkConnector","type":"sink","version":"0.5.0"},{"class":"org.apache.camel.kafkaconnector.CamelSourceConnector","type":"source","version":"0.5.0"},{"class":"org.apache.camel.kafkaconnector.aws2sns.CamelAws2snsSinkConnector","type":"sink","version":"0.5.0"},{"class":"org.apache.camel.kafkaconnector.aws2sns.CamelAws2snsSourceConnector","type":"source","version":"0.5.0"},{"class":"org.apache.kafka.connect.file.FileStreamSinkConnector","type":" [...] ---- +### Set the AWS credential as secret (optional) + +You can also set the aws creds option as secret, you'll need to edit the file config/aws-s3-cred.properties with the correct credentials and then execute the following command + +[source,bash,options="nowrap"] +---- +oc create secret generic aws2-sns --from-file=config/openshift/aws2-sns-cred.properties +---- + +Now we need to edit KafkaConnectS2I custom resource to reference the secret. For example: + +[source,bash,options="nowrap"] +---- +spec: + # ... + config: + config.providers: file + config.providers.file.class: org.apache.kafka.common.config.provider.FileConfigProvider + #... + externalConfiguration: + volumes: + - name: aws-credentials + secret: + secretName: aws2-sns +---- + +In this way the secret aws2-sns will be mounted as volume with path /opt/kafka/external-configuration/aws-credentials/ + ### Create connector instance Now we can create some instance of a AWS2-SNS sink connector: diff --git a/aws2-sns/aws2-sns-sink/config/openshift/aws2-sns-cred.properties b/aws2-sns/aws2-sns-sink/config/openshift/aws2-sns-cred.properties new file mode 100644 index 0000000..d1596a1 --- /dev/null +++ b/aws2-sns/aws2-sns-sink/config/openshift/aws2-sns-cred.properties @@ -0,0 +1,3 @@ +accessKey=xxxx +secretKey=yyyy +region=region diff --git a/aws2-sns/aws2-sns-sink/config/openshift/aws2-sns-sink-connector.yaml b/aws2-sns/aws2-sns-sink/config/openshift/aws2-sns-sink-connector.yaml new file mode 100644 index 0000000..c9696f2 --- /dev/null +++ b/aws2-sns/aws2-sns-sink/config/openshift/aws2-sns-sink-connector.yaml @@ -0,0 +1,18 @@ +apiVersion: kafka.strimzi.io/v1alpha1 +kind: KafkaConnector +metadata: + name: sns-sink-connector + namespace: myproject + labels: + strimzi.io/cluster: my-connect-cluster +spec: + class: org.apache.camel.kafkaconnector.aws2sns.CamelAws2snsSinkConnector + tasksMax: 1 + config: + key.converter: org.apache.kafka.connect.storage.StringConverter + value.converter: org.apache.kafka.connect.storage.StringConverter + topics: sns-topic + camel.sink.path.topicNameOrArn: camel-connector-test + camel.component.aws2-s3.accessKey: ${file:/opt/kafka/external-configuration/aws-credentials/aws2-sqs-cred.properties:accessKey} + camel.component.aws2-s3.secretKey: ${file:/opt/kafka/external-configuration/aws-credentials/aws2-sqs-cred.properties:secretKey} + camel.component.aws2-s3.region: ${file:/opt/kafka/external-configuration/aws-credentials/aws2-sqs-cred.properties:region}