-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d103e8b
commit 9849711
Showing
22 changed files
with
496 additions
and
31 deletions.
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
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,33 @@ | ||
{{- define "cluster.externalSourceCluster" -}} | ||
{{- $name := first . -}} | ||
{{- $config := last . -}} | ||
- name: {{ first . }} | ||
connectionParameters: | ||
host: {{ $config.host | quote }} | ||
port: {{ $config.port | quote }} | ||
user: {{ $config.username | quote }} | ||
{{- with $config.database }} | ||
dbname: {{ . | quote }} | ||
{{- end }} | ||
sslmode: {{ $config.sslMode | quote }} | ||
{{- if $config.passwordSecret.name }} | ||
password: | ||
name: {{ $config.passwordSecret.name }} | ||
key: {{ $config.passwordSecret.key }} | ||
{{- end }} | ||
{{- if $config.sslKeySecret.name }} | ||
sslKey: | ||
name: {{ $config.sslKeySecret.name }} | ||
key: {{ $config.sslKeySecret.key }} | ||
{{- end }} | ||
{{- if $config.sslCertSecret.name }} | ||
sslCert: | ||
name: {{ $config.sslCertSecret.name }} | ||
key: {{ $config.sslCertSecret.key }} | ||
{{- end }} | ||
{{- if $config.sslRootCertSecret.name }} | ||
sslRootCert: | ||
name: {{ $config.sslRootCertSecret.name }} | ||
key: {{ $config.sslRootCertSecret.key }} | ||
{{- end }} | ||
{{- end }} |
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
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
6 changes: 6 additions & 0 deletions
6
charts/paradedb/test/postgresql-import/00-source-cluster-assert.yaml
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,6 @@ | ||
apiVersion: postgresql.cnpg.io/v1 | ||
kind: Cluster | ||
metadata: | ||
name: source-paradedb | ||
status: | ||
readyInstances: 1 |
9 changes: 9 additions & 0 deletions
9
charts/paradedb/test/postgresql-import/00-source-cluster.yaml
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,9 @@ | ||
type: postgresql | ||
mode: "standalone" | ||
cluster: | ||
instances: 1 | ||
superuserSecret: source-paradedb-superuser | ||
storage: | ||
size: 256Mi | ||
backups: | ||
enabled: false |
8 changes: 8 additions & 0 deletions
8
charts/paradedb/test/postgresql-import/00-source-superuser-password.yaml
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,8 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: source-paradedb-superuser | ||
type: Opaque | ||
data: | ||
username: "cG9zdGdyZXM=" | ||
password: "cG9zdGdyZXM=" |
6 changes: 6 additions & 0 deletions
6
charts/paradedb/test/postgresql-import/01-data_write-assert.yaml
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,6 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: data-write | ||
status: | ||
succeeded: 1 |
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,31 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: data-write | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
containers: | ||
- name: data-write | ||
env: | ||
- name: DB_USER | ||
valueFrom: | ||
secretKeyRef: | ||
name: source-paradedb-superuser | ||
key: username | ||
- name: DB_PASS | ||
valueFrom: | ||
secretKeyRef: | ||
name: source-paradedb-superuser | ||
key: password | ||
- name: DB_URI | ||
value: postgres://$(DB_USER):$(DB_PASS)@source-paradedb-rw:5432 | ||
image: alpine:3.19 | ||
command: ['sh', '-c'] | ||
args: | ||
- | | ||
apk --no-cache add postgresql-client | ||
psql "$DB_URI" -c "CREATE DATABASE mygooddb;" | ||
psql "$DB_URI/mygooddb" -c "CREATE TABLE mygoodtable (id serial PRIMARY KEY);" | ||
psql "$DB_URI/mygooddb" -c "INSERT INTO mygoodtable VALUES (314159265);" |
6 changes: 6 additions & 0 deletions
6
charts/paradedb/test/postgresql-import/02-import-cluster-assert.yaml
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,6 @@ | ||
apiVersion: postgresql.cnpg.io/v1 | ||
kind: Cluster | ||
metadata: | ||
name: import-paradedb | ||
status: | ||
readyInstances: 2 |
30 changes: 30 additions & 0 deletions
30
charts/paradedb/test/postgresql-import/02-import-cluster.yaml
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,30 @@ | ||
type: postgresql | ||
mode: "recovery" | ||
recovery: | ||
method: "import" | ||
import: | ||
type: "microservice" | ||
databases: [ "mygooddb" ] | ||
source: | ||
host: "source-paradedb-rw" | ||
username: "postgres" | ||
passwordSecret: | ||
name: source-paradedb-superuser | ||
key: password | ||
sslMode: "require" | ||
sslKeySecret: | ||
name: source-paradedb-replication | ||
key: tls.key | ||
sslCertSecret: | ||
name: source-paradedb-replication | ||
key: tls.crt | ||
|
||
cluster: | ||
instances: 2 | ||
storage: | ||
size: 256Mi | ||
initdb: | ||
database: mygooddb | ||
|
||
backups: | ||
enabled: false |
6 changes: 6 additions & 0 deletions
6
charts/paradedb/test/postgresql-import/03-data_test-assert.yaml
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,6 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: data-test | ||
status: | ||
succeeded: 1 |
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,24 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: data-test | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
containers: | ||
- name: data-test | ||
env: | ||
- name: DB_URI | ||
valueFrom: | ||
secretKeyRef: | ||
name: import-paradedb-superuser | ||
key: uri | ||
image: alpine:3.19 | ||
command: ['sh', '-c'] | ||
args: | ||
- | | ||
apk --no-cache add postgresql-client | ||
DB_URI=$(echo $DB_URI | sed "s|/\*|/|" ) | ||
test "$(psql "${DB_URI}mygooddb" -t -c 'SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_name = $$mygoodtable$$)' --csv -q 2>/dev/null)" = "t" | ||
test "$(psql "${DB_URI}mygooddb" -t -c 'SELECT EXISTS (SELECT FROM mygoodtable WHERE id = 314159265)' --csv -q 2>/dev/null)" = "t" |
6 changes: 6 additions & 0 deletions
6
charts/paradedb/test/postgresql-import/04-import-cluster-schema_only-assert.yaml
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,6 @@ | ||
apiVersion: postgresql.cnpg.io/v1 | ||
kind: Cluster | ||
metadata: | ||
name: import-schemaonly-paradedb | ||
status: | ||
readyInstances: 2 |
31 changes: 31 additions & 0 deletions
31
charts/paradedb/test/postgresql-import/04-import-cluster-schema_only.yaml
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,31 @@ | ||
type: postgresql | ||
mode: "recovery" | ||
recovery: | ||
method: "import" | ||
import: | ||
type: "microservice" | ||
databases: [ "mygooddb" ] | ||
schemaOnly: true | ||
source: | ||
host: "source-paradedb-rw" | ||
username: "postgres" | ||
passwordSecret: | ||
name: source-paradedb-superuser | ||
key: password | ||
sslMode: "require" | ||
sslKeySecret: | ||
name: source-paradedb-replication | ||
key: tls.key | ||
sslCertSecret: | ||
name: source-paradedb-replication | ||
key: tls.crt | ||
|
||
cluster: | ||
instances: 2 | ||
storage: | ||
size: 256Mi | ||
initdb: | ||
database: mygooddb | ||
|
||
backups: | ||
enabled: false |
6 changes: 6 additions & 0 deletions
6
charts/paradedb/test/postgresql-import/05-data_test-assert.yaml
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,6 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: data-test-schemaonly | ||
status: | ||
succeeded: 1 |
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,24 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: data-test-schemaonly | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
containers: | ||
- name: data-test | ||
env: | ||
- name: DB_URI | ||
valueFrom: | ||
secretKeyRef: | ||
name: import-schemaonly-paradedb-superuser | ||
key: uri | ||
image: alpine:3.19 | ||
command: ['sh', '-c'] | ||
args: | ||
- | | ||
apk --no-cache add postgresql-client | ||
DB_URI=$(echo $DB_URI | sed "s|/\*|/|" ) | ||
test "$(psql "${DB_URI}mygooddb" -t -c 'SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_name = $$mygoodtable$$)' --csv -q 2>/dev/null)" = "t" | ||
test "$(psql "${DB_URI}mygooddb" -t -c 'SELECT EXISTS (SELECT FROM mygoodtable WHERE id = 314159265)' --csv -q 2>/dev/null)" = "f" |
Oops, something went wrong.