-
Notifications
You must be signed in to change notification settings - Fork 101
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
Create external-postgres.md #1181
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
[NooBaa Operator](../README.md) / | ||
|
||
# External Postgresql DB support | ||
|
||
As part of a growing demand on supporting external Postgresql DB, we are now supporting a new basic option to use noobaa with an externally provided Postgresql DB. First, you will need to create a new empty DB with the needed collation by noobaa: | ||
1. Validate you have a working Postgres that can be accessed from external pods. | ||
2. Create a new DB that will be used by noobaa to save its metadata. Using the following SQL command: | ||
```sql | ||
CREATE DATABASE nbcore WITH LC_COLLATE = ‘C’ TEMPLATE template0; | ||
``` | ||
3. Validate that you have the correct user and password in order to create new tables in this DB. Save the needed credentials and connection details in a URL format: | ||
``` | ||
potgres://<user>:<password>@<full DNS name of external server>:<port>/<db-name> | ||
``` | ||
for example: | ||
``` | ||
postgres://user1:[email protected]:5432/nbcore" | ||
``` | ||
Now you have one of two options, depending on the way you are installing noobaa on your cluster: | ||
1. Using Noobaa CLI: It will create a secret for you, where it will save the given URL (It will be called noobaa-external-pg-db) | ||
This secret will be attached to the NooBaa system CRD when created during the installation. Run the following: | ||
```bash | ||
noobaa install --postgres-url="postgres://postgres:[email protected]:5432/nbcore" | ||
``` | ||
2. You want to create your own noobaa instance by using yamls: | ||
- Create a new secret saving the above URL: | ||
```yaml | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: my-secret | ||
namespace: my-namespace | ||
type: Opaque | ||
stringData: | ||
db_url: postgres://postgres:[email protected]:5432/nbcore | ||
``` | ||
|
||
- Create a new noobaa system, using the noobaa CRD. Add this to the spec: | ||
```yaml | ||
apiVersion: noobaa.io/v1alpha1 | ||
kind: NooBaa | ||
metadata: | ||
name: noobaa | ||
namespace: my-namespace | ||
spec: | ||
# ... | ||
externalPgSecret: | ||
name: my-secret | ||
namespace: my-namespace | ||
#... | ||
``` | ||
|
||
Gaps: | ||
1. We currently support only MD5 encryption in order to connect to the DB. So no Support for SSL/TLS. | ||
2. We currently support only URL format for the connection details, we found it to be faster and easier. If demand will rise we will think of adding support for splitting the secret db_url key to host, port, db-name, user, and password keys. | ||
|
||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this step really necessary?
https://github.com/noobaa/noobaa-core/blob/6281591bd5b7bc6142446666f570f01b3bcbf61c/src/util/postgres_client.js#L1371-L1383
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We currently not creating a database on our own (the DB image creates the DB at first run), and the user probably won't give us admin credentials that can create new databases (I think). So I think it's kind of a must.
@dannyzaken WDYT?