This repository has been archived by the owner on Jul 16, 2021. It is now read-only.
Support FoundationDB Document-Layer store, as an optional alternative to MongoDB #656
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.
The purpose of this feature is to provide an alternative document-based DB option to the current MongoDB backend.
We're replacing MongoDB with FoundationDB in one of our own projects where we leverage the chart-repo and chartsvc components from Monocular - so decided to offer to contribute this feature back to the Monocular project as a configurable option.
FoundationDB combined with its Document Layer https://foundationdb.github.io/fdb-document-layer/ provides a similar DB backend to MongoDB, and is compatible with the official MongoDB drivers. FoundationDB was released under the Apache2 OSL, and offers an alternative to MongoDB, which is now under the SSPL.
Major Changes:
Additional packages have been added to accommodate both foundationdb document-layer and mongodb backend implementations under both cmd/chart-repo and cmd/chartsvc. Code that is common to both implementations has been factored out into separate packages. All pre-existing unit tests for chart-repo and chartsvc have been replicated and ported over to the foundationdb packages to enable consistency in testing of both backends.
The Delete and Sync commands have been modified to accept a "db-type" parameter that is used at run-time to direct handling to the appropriate package. MongoDB is always the default handler if this parameter is not specified.
A local Helm sub-chart has been added to provision the FoundationDB backend deployment and service, if configured through values.yaml. Running the FoundationDB document layer in this way, requires a FoundationDB server container, with a secondary Document-Layer container that acts as a client to it. The application then communicates with the Document Layer only. Both of these containers are configured and coupled appropriately in the subchart. The official FoundationDB Docker images for both the FoundationDB server and the Document Layer did not function correctly on Kubernetes, as the way the components test connectivity between them at runtime was not compatible with Kubernetes networking. We have therefore modified the official foundationDB images for Kubernetes compatibility. The new Helm chart currently pulls these images in from Docker Hub. For now, the chart-repo and chartsvc images as customised by this feature, are also hosted on Docker Hub, and the main Helm chart has been modified to pull from there. A current limitation of the modified images is that at present, the foundationDB instance cannot be internally scaled into a larger cluster. However, we do not currently see this as an immediately limiting factor for Monocular.
The FoundationDB document Layer backend is configured by setting fdbserver=true in values.yaml, (or passing at deployment time). By default, current behavour is preserved and MongoDB is used.
Since we were already developing this for our own purposes, we did not open a feature request in advance. Happy to do so if required. We welcome your thoughts, comments and suggestions, in the PR discussion. Many thanks!
Signed-off-by: Kate E. Reinecke [email protected]