Skip to content

Commit

Permalink
Added ssl support to mongodb kamelets.
Browse files Browse the repository at this point in the history
  • Loading branch information
valdar committed Jan 23, 2023
1 parent 48ad553 commit db7d072
Show file tree
Hide file tree
Showing 8 changed files with 390 additions and 18 deletions.
26 changes: 23 additions & 3 deletions kamelets/mongodb-changes-stream-source.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@ spec:
type: string
x-descriptors:
- urn:camel:group:credentials
ssl:
title: Enable Ssl for Mongodb Connection
description: whether to enable ssl connection to mongodb
type: boolean
default: true
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
sslValidationEnabled:
title: Enables Ssl Certificates Validation and Host name checks.
description: IMPORTANT this should be disabled only in test environment since can pose security issues.
type: boolean
default: true
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
database:
title: MongoDB Database
description: Sets the name of the MongoDB database to target.
Expand All @@ -76,16 +90,22 @@ spec:
beans:
- name: local-mongodb
type: "#class:org.apache.camel.component.mongodb.MongoDbComponent"
- name: mongo-client
type: "#class:org.bf2.cos.connector.camel.mongodb.SslAwareMongoClient"
properties:
password: "{{?password}}"
username: "{{?username}}"
hosts: "{{hosts}}"
ssl: "{{ssl}}"
sslValidationEnabled: "{{sslValidationEnabled}}"
from:
uri: "{{local-mongodb}}:test"
parameters:
hosts: "{{hosts}}"
collection: "{{collection}}"
password: "{{?password}}"
username: "{{?username}}"
database: "{{database}}"
consumerType: "changeStreams"
streamFilter: "{{?streamFilter}}"
mongoConnection: "#{{mongo-client}}"
steps:
- marshal:
json: {}
Expand Down
26 changes: 23 additions & 3 deletions kamelets/mongodb-sink.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ spec:
type: string
x-descriptors:
- urn:camel:group:credentials
ssl:
title: Enable Ssl for Mongodb Connection
description: whether to enable ssl connection to mongodb
type: boolean
default: true
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
sslValidationEnabled:
title: Enables Ssl Certificates Validation and Host name checks.
description: IMPORTANT this should be disabled only in test environment since can pose security issues.
type: boolean
default: true
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
database:
title: MongoDB Database
description: The name of the MongoDB database.
Expand Down Expand Up @@ -90,6 +104,14 @@ spec:
beans:
- name: local-mongodb
type: "#class:org.apache.camel.component.mongodb.MongoDbComponent"
- name: mongo-client
type: "#class:org.bf2.cos.connector.camel.mongodb.SslAwareMongoClient"
properties:
password: "{{?password}}"
username: "{{?username}}"
hosts: "{{hosts}}"
ssl: "{{ssl}}"
sslValidationEnabled: "{{sslValidationEnabled}}"
from:
uri: kamelet:source
steps:
Expand All @@ -110,9 +132,7 @@ spec:
parameters:
createCollection: "{{?createCollection}}"
writeConcern: "{{?writeConcern}}"
hosts: "{{hosts}}"
collection: "{{collection}}"
password: "{{?password}}"
username: "{{?username}}"
database: "{{database}}"
operation: "insert"
mongoConnection: "#{{mongo-client}}"
26 changes: 23 additions & 3 deletions kamelets/mongodb-source.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@ spec:
type: string
x-descriptors:
- urn:camel:group:credentials
ssl:
title: Enable Ssl for Mongodb Connection
description: whether to enable ssl connection to mongodb
type: boolean
default: true
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
sslValidationEnabled:
title: Enables Ssl Certificates Validation and Host name checks.
description: IMPORTANT this should be disabled only in test environment since can pose security issues.
type: boolean
default: true
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
database:
title: MongoDB Database
description: The name of the MongoDB database.
Expand All @@ -88,16 +102,22 @@ spec:
beans:
- name: local-mongodb
type: "#class:org.apache.camel.component.mongodb.MongoDbComponent"
- name: mongo-client
type: "#class:org.bf2.cos.connector.camel.mongodb.SslAwareMongoClient"
properties:
password: "{{?password}}"
username: "{{?username}}"
hosts: "{{hosts}}"
ssl: "{{ssl}}"
sslValidationEnabled: "{{sslValidationEnabled}}"
from:
uri: "{{local-mongodb}}:test"
parameters:
hosts: "{{hosts}}"
collection: "{{collection}}"
password: "{{?password}}"
username: "{{?username}}"
database: "{{database}}"
persistentTailTracking: "{{persistentTailTracking}}"
tailTrackIncreasingField: "{{?tailTrackIncreasingField}}"
mongoConnection: "#{{mongo-client}}"
steps:
- marshal:
json: {}
Expand Down
7 changes: 7 additions & 0 deletions library/camel-kamelets-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@
<scope>provided</scope>
</dependency>

<!-- Dependencies for mongodb connection configuration -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-mongodb</artifactId>
<scope>provided</scope>
</dependency>

<!-- Test scoped dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
Loading

0 comments on commit db7d072

Please sign in to comment.