Make it Possible to Connect to DocumentDB From a Service running in EKS #84
+205
−28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Jira ticket: https://officefornationalstatistics.atlassian.net/jira/software/c/projects/DIS/boards/1824?selectedIssue=DIS-4424
The task was originally to make it possible to connect using IAM. However, after much investigation and testing, it was discovered that it's not possible to connect using IAM if the DocumentDB version is below v5. And currently we use v4.
Therefore this PR uses the existing username and password (e.g. for the migrations database) to connect from EKS (e.g from the migration service). But changes have been made to the connection string (see details added to the readme) and an AWS CA file is also used now. These changes were necessary in order to connect successfully from EKS.
Finally, for backwards compatibility, the new way of connecting requires an environment variable named CONNECT_EKS to be set to true. By default it's set to false, which means that the current (legacy) way of connecting will be used.
How to review
This can be tested locally using the following branch of the dis-test-eks-app:
https://github.com/ONSdigital/dis-test-eks-app/tree/feature/test-mongodb-connection
But it would probably be easiest if I give you a demo, which I'm happy to do.
Who can review
Anyone.