From 268b4693cf1aa9e02a53079f728523a006245f25 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sat, 4 Jun 2022 17:10:05 +0200 Subject: [PATCH] Add ability to create dbs --- infrastructure/postgres/create-db.sh | 17 +++++++++++++++++ infrastructure/postgres/port-forward-db.sh | 7 +++++++ 2 files changed, 24 insertions(+) create mode 100755 infrastructure/postgres/create-db.sh create mode 100755 infrastructure/postgres/port-forward-db.sh diff --git a/infrastructure/postgres/create-db.sh b/infrastructure/postgres/create-db.sh new file mode 100755 index 0000000..da8af89 --- /dev/null +++ b/infrastructure/postgres/create-db.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -e + +SUBJECT=$1 +PGPASSWORD=$2 + +PASSWORD=$(openssl rand -hex 20) +ID=$(openssl rand -hex 5) + +kubectl run "postgres-client-$ID" --rm -i --image "bitnami/postgresql" -n postgres --env="PGPASSWORD=$PGPASSWORD" --command -- psql --host postgres-postgresql -U postgres <