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

Source MongoDb: added support via TLS/SSL #6364

Merged
merged 9 commits into from
Sep 24, 2021
Merged

Conversation

irynakruk
Copy link
Contributor

@irynakruk irynakruk commented Sep 22, 2021

What

Added support of TLS encryption by default when connecting to the MongoDB source: MongoDb Atlas Cluster and Replica Set.
For Standalone MongoDb instance added possibility to select whether to encrypt, as it may require additional configuration from customer.
Provided small fix for incremental sync.

How

For MongoDb Atlas Cluster and Replica Set added ssl=true to connection param.
For Standalone MongoDb instance it is configurable.

Recommended reading order

  1. MongoDbSource.java
  2. spec.json
  3. tests

Pre-merge Checklist

Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions
  • Connector version bumped like described here

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • Credentials added to Github CI. Instructions.
  • /test connector=connectors/<name> command is passing.
  • New Connector version released on Dockerhub by running the /publish command described here

@github-actions github-actions bot added area/connectors Connector related issues area/documentation Improvements or additions to documentation labels Sep 22, 2021
@irynakruk irynakruk linked an issue Sep 22, 2021 that may be closed by this pull request
5 tasks
@irynakruk irynakruk changed the title Source MongoDB - Add support for MongoDB source via TLS/SSL Source MongoDb - added support via TLS/SSL Sep 22, 2021
@irynakruk irynakruk changed the title Source MongoDb - added support via TLS/SSL Source MongoDb: added support via TLS/SSL Sep 22, 2021
@irynakruk irynakruk temporarily deployed to more-secrets September 22, 2021 04:19 Inactive
@irynakruk irynakruk temporarily deployed to more-secrets September 22, 2021 15:32 Inactive
@irynakruk irynakruk temporarily deployed to more-secrets September 23, 2021 14:42 Inactive
@irynakruk irynakruk marked this pull request as ready for review September 23, 2021 14:49
@irynakruk
Copy link
Contributor Author

irynakruk commented Sep 23, 2021

/test connector=connectors/source-mongodb-v2

🕑 connectors/source-mongodb-v2 https://github.com/airbytehq/airbyte/actions/runs/1266351264
❌ connectors/source-mongodb-v2 https://github.com/airbytehq/airbyte/actions/runs/1266351264
🐛

@jrhizor jrhizor temporarily deployed to more-secrets September 23, 2021 15:04 Inactive
@irynakruk irynakruk temporarily deployed to more-secrets September 23, 2021 16:12 Inactive
@irynakruk
Copy link
Contributor Author

irynakruk commented Sep 23, 2021

/test connector=connectors/source-mongodb-v2

🕑 connectors/source-mongodb-v2 https://github.com/airbytehq/airbyte/actions/runs/1266699799
❌ connectors/source-mongodb-v2 https://github.com/airbytehq/airbyte/actions/runs/1266699799
🐛 https://gradle.com/s/hbdjbvm4v2kvo

@jrhizor jrhizor temporarily deployed to more-secrets September 23, 2021 16:45 Inactive
case TIMESTAMP -> new BsonTimestamp(Long.parseLong(value));
case DATE_TIME -> new BsonDateTime(new DateTime(value).getValue());
case OBJECT_ID -> new ObjectId(value);
default -> null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of default null why don't we return string?

Also I don't see a mapping from string or object, how come?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed to String, thanks! Also added String and Symbol.
This mapping needed only for cursor field, since it couldn't be object or array, it isn't present here.

@@ -26,7 +26,29 @@ the Dockerfile.
We use `JUnit` for Java tests.

### Test Configuration
No specific configuration needed for testing, MongoDb Test Container is used.

In order to test the MongoDb source, you need to have a standalone instance, a replica set or Atlas cluster.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't work with a docker image anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works, but I've also added test for Atlas Cluster with ssl, I've corrected doc.

@@ -98,13 +105,6 @@
"default": "admin",
"examples": ["admin"],
"order": 4
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you will need to make additionalProperties=true for this to be backwards compatible, and potentially handle it manually in the connector code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot, I've added.

### TLS/SSL on a Connection

It is recommended to use encrypted connection.
Connection with TLS/SSL security protocol for MongoDb Atlas Cluster and Replica Set instances is enabled by default. Encryption is based on the underlying TLS/SSL support in the JDK.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest removing since it's an implementation detail

Suggested change
Connection with TLS/SSL security protocol for MongoDb Atlas Cluster and Replica Set instances is enabled by default. Encryption is based on the underlying TLS/SSL support in the JDK.
Connection with TLS/SSL security protocol for MongoDb Atlas Cluster and Replica Set instances is enabled by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@irynakruk irynakruk temporarily deployed to more-secrets September 24, 2021 01:03 Inactive
@irynakruk irynakruk temporarily deployed to more-secrets September 24, 2021 01:09 Inactive
@irynakruk
Copy link
Contributor Author

irynakruk commented Sep 24, 2021

/test connector=connectors/source-mongodb-v2

🕑 connectors/source-mongodb-v2 https://github.com/airbytehq/airbyte/actions/runs/1268140175
✅ connectors/source-mongodb-v2 https://github.com/airbytehq/airbyte/actions/runs/1268140175
No Python unittests run

@jrhizor jrhizor temporarily deployed to more-secrets September 24, 2021 01:37 Inactive
@irynakruk
Copy link
Contributor Author

irynakruk commented Sep 24, 2021

/publish connector=connectors/source-mongodb-v2

🕑 connectors/source-mongodb-v2 https://github.com/airbytehq/airbyte/actions/runs/1268154279
✅ connectors/source-mongodb-v2 https://github.com/airbytehq/airbyte/actions/runs/1268154279

@jrhizor jrhizor temporarily deployed to more-secrets September 24, 2021 01:44 Inactive
@irynakruk irynakruk temporarily deployed to more-secrets September 24, 2021 02:08 Inactive
@irynakruk irynakruk temporarily deployed to more-secrets September 24, 2021 12:17 Inactive
@irynakruk irynakruk temporarily deployed to more-secrets September 24, 2021 13:15 Inactive
@irynakruk irynakruk merged commit 5551698 into master Sep 24, 2021
@irynakruk irynakruk deleted the irynakruk/6014-mongodb-tsl branch September 24, 2021 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for MongoDB source via TLS/SSL
5 participants