首次提交:初始化项目
This commit is contained in:
19
009-基础设施/001-pg16/k8s/configmap.yaml
Normal file
19
009-基础设施/001-pg16/k8s/configmap.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: pg16-init-script
|
||||
namespace: infrastructure
|
||||
data:
|
||||
01-init.sh: |
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# 创建超级用户 fei
|
||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
|
||||
CREATE USER fei WITH SUPERUSER PASSWORD 'feiks..';
|
||||
EOSQL
|
||||
|
||||
# 创建 300 个数据库
|
||||
for i in $(seq -w 1 300); do
|
||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -c "CREATE DATABASE pg${i} OWNER fei;"
|
||||
done
|
||||
Reference in New Issue
Block a user