forked from cloudnative-pg/charts
-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
24fb8cc
commit 251345e
Showing
21 changed files
with
498 additions
and
0 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
charts/cluster/test/paradedb-minio-backup-restore/00-minio_cleanup-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: minio-cleanup | ||
status: | ||
succeeded: 1 |
16 changes: 16 additions & 0 deletions
16
charts/cluster/test/paradedb-minio-backup-restore/00-minio_cleanup.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,16 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: minio-cleanup | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
containers: | ||
- name: minio-cleanup | ||
image: minio/mc | ||
command: ['sh', '-c'] | ||
args: | ||
- | | ||
mc alias set myminio https://minio.minio.svc.cluster.local minio minio123 | ||
mc rm --recursive --force myminio/mybucket/paradedb |
6 changes: 6 additions & 0 deletions
6
charts/cluster/test/paradedb-minio-backup-restore/01-paradedb_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: paradedb-cluster | ||
status: | ||
readyInstances: 2 |
26 changes: 26 additions & 0 deletions
26
charts/cluster/test/paradedb-minio-backup-restore/01-paradedb_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,26 @@ | ||
type: paradedb | ||
mode: standalone | ||
cluster: | ||
instances: 2 | ||
storage: | ||
size: 256Mi | ||
|
||
backups: | ||
enabled: true | ||
provider: s3 | ||
endpointURL: "https://minio.minio.svc.cluster.local" | ||
endpointCA: | ||
name: kube-root-ca.crt | ||
key: ca.crt | ||
wal: | ||
encryption: "" | ||
data: | ||
encryption: "" | ||
s3: | ||
bucket: "mybucket" | ||
path: "/paradedb/v1" | ||
accessKey: "minio" | ||
secretKey: "minio123" | ||
region: "local" | ||
scheduledBackups: [] | ||
retentionPolicy: "30d" |
6 changes: 6 additions & 0 deletions
6
charts/cluster/test/paradedb-minio-backup-restore/02-paradedb_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: paradedb-write | ||
status: | ||
succeeded: 1 |
35 changes: 35 additions & 0 deletions
35
charts/cluster/test/paradedb-minio-backup-restore/02-paradedb_write.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,35 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: paradedb-write | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
containers: | ||
- name: data-write | ||
env: | ||
- name: DB_URI | ||
valueFrom: | ||
secretKeyRef: | ||
name: paradedb-cluster-app | ||
key: uri | ||
image: alpine:3.19 | ||
command: ['sh', '-c'] | ||
args: | ||
- | | ||
apk --no-cache add postgresql-client | ||
psql "$DB_URI" <<-EOSQL | ||
CALL paradedb.create_bm25_test_table( schema_name => 'public', table_name => 'mock_items' ); | ||
CALL paradedb.create_bm25( | ||
index_name => 'search_idx', | ||
schema_name => 'public', | ||
table_name => 'mock_items', | ||
key_field => 'id', | ||
text_fields => paradedb.field('description', tokenizer => paradedb.tokenizer('en_stem')) || | ||
paradedb.field('category'), | ||
numeric_fields => paradedb.field('rating') | ||
); | ||
EOSQL | ||
6 changes: 6 additions & 0 deletions
6
charts/cluster/test/paradedb-minio-backup-restore/03-paradedb_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: paradedb-test | ||
status: | ||
succeeded: 1 |
27 changes: 27 additions & 0 deletions
27
charts/cluster/test/paradedb-minio-backup-restore/03-paradedb_test.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,27 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: paradedb-test | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
containers: | ||
- name: data-test | ||
env: | ||
- name: DB_URI | ||
valueFrom: | ||
secretKeyRef: | ||
name: paradedb-cluster-app | ||
key: uri | ||
image: alpine:3.19 | ||
command: ['sh', '-c'] | ||
args: | ||
- | | ||
apk --no-cache add postgresql-client | ||
RESULT=$(psql "$DB_URI" -t) <<-EOSQL | ||
SELECT description | ||
FROM search_idx.search('description:"bluetooth speaker"~1'); | ||
EOSQL | ||
echo -$RESULT- | ||
test "$RESULT" = " Bluetooth-enabled speaker" |
6 changes: 6 additions & 0 deletions
6
charts/cluster/test/paradedb-minio-backup-restore/04-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 |
23 changes: 23 additions & 0 deletions
23
charts/cluster/test/paradedb-minio-backup-restore/04-data_write.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,23 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: data-write | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
containers: | ||
- name: data-write | ||
env: | ||
- name: DB_URI | ||
valueFrom: | ||
secretKeyRef: | ||
name: paradedb-cluster-superuser | ||
key: uri | ||
image: alpine:3.19 | ||
command: ['sh', '-c'] | ||
args: | ||
- | | ||
apk --no-cache add postgresql-client kubectl | ||
DB_URI=$(echo $DB_URI | sed "s|/\*|/|" ) | ||
psql "$DB_URI" -c "CREATE TABLE mygoodtable (id serial PRIMARY KEY);" |
8 changes: 8 additions & 0 deletions
8
charts/cluster/test/paradedb-minio-backup-restore/05-backup.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: postgresql.cnpg.io/v1 | ||
kind: Backup | ||
metadata: | ||
name: post-init-backup | ||
spec: | ||
method: barmanObjectStore | ||
cluster: | ||
name: paradedb-cluster |
10 changes: 10 additions & 0 deletions
10
charts/cluster/test/paradedb-minio-backup-restore/05-backup_completed-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,10 @@ | ||
apiVersion: postgresql.cnpg.io/v1 | ||
kind: Backup | ||
metadata: | ||
name: post-init-backup | ||
spec: | ||
cluster: | ||
name: paradedb-cluster | ||
method: barmanObjectStore | ||
status: | ||
phase: completed |
10 changes: 10 additions & 0 deletions
10
charts/cluster/test/paradedb-minio-backup-restore/05-backup_running-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,10 @@ | ||
apiVersion: postgresql.cnpg.io/v1 | ||
kind: Backup | ||
metadata: | ||
name: post-init-backup | ||
spec: | ||
cluster: | ||
name: paradedb-cluster | ||
method: barmanObjectStore | ||
status: | ||
phase: running |
27 changes: 27 additions & 0 deletions
27
charts/cluster/test/paradedb-minio-backup-restore/05-checkpoint.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,27 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: backup-checkpoint | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
containers: | ||
- name: create-checkpoint | ||
env: | ||
- name: DB_URI | ||
valueFrom: | ||
secretKeyRef: | ||
name: paradedb-cluster-superuser | ||
key: uri | ||
image: alpine:3.19 | ||
command: ['sh', '-c'] | ||
args: | ||
- | | ||
apk --no-cache add postgresql-client | ||
DB_URI=$(echo $DB_URI | sed "s|/\*|/|" ) | ||
END_TIME=$(( $(date +%s) + 30 )) | ||
while [ $(date +%s) -lt $END_TIME ]; do | ||
psql "$DB_URI" -c "SELECT pg_switch_wal();CHECKPOINT;" | ||
sleep 5 | ||
done |
6 changes: 6 additions & 0 deletions
6
charts/cluster/test/paradedb-minio-backup-restore/06-post_backup_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-post-backup | ||
status: | ||
succeeded: 1 |
57 changes: 57 additions & 0 deletions
57
charts/cluster/test/paradedb-minio-backup-restore/06-post_backup_data_write.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,57 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: configmap-creator-sa | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: configmap-creator | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["configmaps"] | ||
verbs: ["create"] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: configmap-creator-binding | ||
subjects: | ||
- kind: ServiceAccount | ||
name: configmap-creator-sa | ||
roleRef: | ||
kind: Role | ||
name: configmap-creator | ||
apiGroup: rbac.authorization.k8s.io | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: data-write-post-backup | ||
spec: | ||
template: | ||
spec: | ||
serviceAccountName: configmap-creator-sa | ||
restartPolicy: OnFailure | ||
containers: | ||
- name: data-write | ||
env: | ||
- name: DB_URI | ||
valueFrom: | ||
secretKeyRef: | ||
name: paradedb-cluster-superuser | ||
key: uri | ||
- name: NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
image: alpine:3.19 | ||
command: ['sh', '-c'] | ||
args: | ||
- | | ||
apk --no-cache add postgresql-client kubectl coreutils | ||
DB_URI=$(echo $DB_URI | sed "s|/\*|/|" ) | ||
DATE_NO_BAD_TABLE=$(date --rfc-3339=ns) | ||
sleep 30 | ||
psql "$DB_URI" -c "CREATE TABLE mybadtable (id serial PRIMARY KEY);" | ||
kubectl create configmap date-no-bad-table --from-literal=date="$DATE_NO_BAD_TABLE" |
6 changes: 6 additions & 0 deletions
6
...ts/cluster/test/paradedb-minio-backup-restore/07-recovery_backup_pitr_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: recovery-backup-pitr-cluster | ||
status: | ||
readyInstances: 2 |
48 changes: 48 additions & 0 deletions
48
charts/cluster/test/paradedb-minio-backup-restore/07-recovery_backup_pitr_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,48 @@ | ||
type: paradedb | ||
mode: recovery | ||
|
||
cluster: | ||
instances: 2 | ||
storage: | ||
size: 256Mi | ||
|
||
recovery: | ||
method: backup | ||
backupName: "post-init-backup" | ||
provider: s3 | ||
endpointURL: "https://minio.minio.svc.cluster.local" | ||
endpointCA: | ||
name: kube-root-ca.crt | ||
key: ca.crt | ||
wal: | ||
encryption: "" | ||
data: | ||
encryption: "" | ||
s3: | ||
bucket: "mybucket" | ||
path: "/paradedb/v1" | ||
accessKey: "minio" | ||
secretKey: "minio123" | ||
region: "local" | ||
scheduledBackups: [] | ||
retentionPolicy: "30d" | ||
|
||
backups: | ||
enabled: true | ||
provider: s3 | ||
endpointURL: "https://minio.minio.svc.cluster.local" | ||
endpointCA: | ||
name: kube-root-ca.crt | ||
key: ca.crt | ||
wal: | ||
encryption: "" | ||
data: | ||
encryption: "" | ||
s3: | ||
bucket: "mybucket" | ||
path: "/paradedb/v2" | ||
accessKey: "minio" | ||
secretKey: "minio123" | ||
region: "local" | ||
scheduledBackups: [] | ||
retentionPolicy: "30d" |
6 changes: 6 additions & 0 deletions
6
charts/cluster/test/paradedb-minio-backup-restore/08-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-backup-pitr | ||
status: | ||
succeeded: 1 |
27 changes: 27 additions & 0 deletions
27
charts/cluster/test/paradedb-minio-backup-restore/08-data_test.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,27 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: data-test-backup-pitr | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
containers: | ||
- name: data-test | ||
env: | ||
- name: DB_URI | ||
valueFrom: | ||
secretKeyRef: | ||
name: recovery-backup-pitr-cluster-superuser | ||
key: uri | ||
image: alpine:3.19 | ||
command: ['sh', '-c'] | ||
args: | ||
- | | ||
apk --no-cache add postgresql-client | ||
DB_URI=$(echo $DB_URI | sed "s|/\*|/|" ) | ||
set -e | ||
test "$(psql $DB_URI -t -c 'SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_name = $$mygoodtable$$)' --csv -q 2>/dev/null)" = "t" | ||
echo "Good table exists" | ||
test "$(psql $DB_URI -t -c 'SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_name = $$mybadtable$$)' --csv -q 2>/dev/null)" = "f" | ||
echo "Bad table does not exist" |
Oops, something went wrong.