-
Notifications
You must be signed in to change notification settings - Fork 2
/
demo-app-inject-mariadb.yaml
54 lines (54 loc) · 1.47 KB
/
demo-app-inject-mariadb.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: demo-app-sa
---
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: demo-app-inject-mariadb
name: demo-app-inject-mariadb
spec:
replicas: 1
selector:
matchLabels:
app: demo-app-inject-mariadb
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: demo-app-inject-mariadb
annotations:
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/role: "test"
vault.hashicorp.com/agent-inject-secret-db: mariadb/creds/testdb-ro
vault.hashicorp.com/agent-inject-template-db: |
{{- with secret "mariadb/creds/testdb-ro" }}
for _ in $(seq 1 50); do echo; done
date
set -x
echo "select * from testdb;"|mysql -u{{ .Data.username }} -p{{ .Data.password }} -Dtestdb -hmariadb
echo "select user from user;"|mysql -uroot -pmypass -Dmysql -hmariadb
{{ end }}
spec:
containers:
- image: mysql
imagePullPolicy: IfNotPresent
name: app
resources: {}
command:
- sh
- -c
- |
echo "waiting for script to become available"
while true
do
test -e /vault/secrets/db && chmod +x /vault/secrets/db && /vault/secrets/db
sleep 1
done
serviceAccountName: demo-app-sa
status: {}