-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb-init
More file actions
executable file
·25 lines (24 loc) · 835 Bytes
/
db-init
File metadata and controls
executable file
·25 lines (24 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
######################################################
# retrieves a set of key-value-pairs for namespace,
# application, user and password and then creates a
# kubernetes configmap under the name
#
# {application}-db-credentials
#
# in given namespace for holding the postgresql
# credentials
######################################################
echo FSCL: initializing postgres data base credentials
read -p "namespace: " -r namespace
read -p "application: " -r application
read -p "user: " -r user
read -p "password: " -s -r password
echo
dbName=${application}-db
usr=$(base64 <<< "$user")
pw=$(base64 <<< "$password")
kubectl create -n "$namespace" secret generic "${dbName}-credentials" \
--from-literal=db-username="$usr" \
--from-literal=db-password="$pw"
kubectl apply -f src/main/kubernetes/process-db.yaml