forked from OpenBankProject/OBP-Kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
obpapi_k8s.yaml
140 lines (140 loc) · 3.68 KB
/
obpapi_k8s.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
apiVersion: v1
kind: Secret
metadata:
name: postgres-credentials
type: Opaque
data:
postgres_user: cG9zdGdyZXM= #postgres
postgres_password: cGFzc3dvcmQ= #password
postgres_db_name: cG9zdGdyZXM= #postgres
postgres_data: L3Zhci9saWIvcG9zdGdyZXNxbC9kYXRhL3BnZGF0YQ== # /var/lib/postgresql/data/pgdata
jdbc_driver: b3JnLnBvc3RncmVzcWwuRHJpdmVy # org.postgresql.Driver
jdbc_url: amRiYzpwb3N0Z3Jlc3FsOi8vcG9zdGdyZXMtc2VydmljZTo1NDMyL3Bvc3RncmVzP3VzZXI9cG9zdGdyZXMmcGFzc3dvcmQ9cGFzc3dvcmQ= # jdbc:postgresql://postgres-service:5432/postgres?user=postgres&password=password
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: postgres-volume-claim
spec:
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: 5Gi
---
apiVersion: v1
kind: Service
metadata:
name: obpapi-service
spec:
selector:
app: obpapi
ports:
- name: http
protocol: TCP
port: 80
targetPort: 8080
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: obp-deployment
labels:
app: obpapi
spec:
replicas: 1
selector:
matchLabels:
app: obpapi
template:
metadata:
labels:
app: obpapi
spec:
containers:
- name: obpapi
image: openbankproject/obp-api # docker build -t obpapi-kube .
resources:
requests:
memory: "1200Mi"
env:
- name: OBP_DB_DRIVER
valueFrom:
secretKeyRef:
name: postgres-credentials
key: jdbc_driver
- name: OBP_DB_URL
valueFrom:
secretKeyRef:
name: postgres-credentials
key: jdbc_url
ports:
- containerPort: 8080
name: http
---
apiVersion: v1
kind: Service
metadata:
name: postgres-service
spec:
selector:
app: postgres
ports:
- protocol: TCP
port: 5432
targetPort: 5432
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
labels:
app: postgres
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:11.1-alpine
resources:
requests:
memory: "200Mi"
env:
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: postgres-credentials
key: postgres_user
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-credentials
key: postgres_password
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: postgres-credentials
key: postgres_db_name
- name: PGDATA
valueFrom:
secretKeyRef:
name: postgres-credentials
key: postgres_data
volumeMounts:
- name: postgres-volume
mountPath: "/var/lib/postgresql/data"
ports:
- containerPort: 5432
volumes:
- name: postgres-volume
persistentVolumeClaim:
claimName: postgres-volume-claim