-
Notifications
You must be signed in to change notification settings - Fork 3
/
npdb_openshift_template.yaml
229 lines (228 loc) · 5.96 KB
/
npdb_openshift_template.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
apiVersion: template.openshift.io/v1
kind: Template
labels:
app: ${NAME}
template: ${NAME}
message: |-
The following service(s) have been created in your project: ${NAME}, ${DATABASE_SERVICE_NAME}.
metadata:
annotations:
description: |-
A Django application with a PostgreSQL database.
WARNING: Any data stored will be lost upon pod destruction. Only use this template for testing.
name: npdb
namespace: npps
objects:
- apiVersion: v1
kind: Secret
metadata:
name: ${NAME}
stringData:
database-password: ${DATABASE_PASSWORD}
database-user: ${DATABASE_USER}
django-secret-key: ${DJANGO_SECRET_KEY}
- apiVersion: v1
kind: Service
metadata:
annotations:
description: Exposes and load balances the application pods
service.alpha.openshift.io/dependencies: '[{"name": "${DATABASE_SERVICE_NAME}", "kind": "Service"}]'
name: ${NAME}
spec:
ports:
- name: ${NAME}
port: 8000
targetPort: 8000
selector:
name: ${NAME}
- apiVersion: v1
kind: Route
metadata:
name: ${NAME}
spec:
host: ${NAME}.apps.sdcc.bnl.gov
to:
kind: Service
name: ${NAME}
- apiVersion: v1
kind: ImageStream
metadata:
annotations:
description: Keeps track of changes in the application image
name: ${NAME}
- apiVersion: v1
kind: DeploymentConfig
metadata:
annotations:
description: Defines how to deploy the application server
template.alpha.openshift.io/wait-for-ready: "true"
name: ${NAME}
spec:
replicas: 1
selector:
name: ${NAME}
strategy:
type: Recreate
template:
metadata:
labels:
name: ${NAME}
name: ${NAME}
spec:
containers:
- env:
- name: POSTGRES_HOST
value: ${DATABASE_SERVICE_NAME}
- name: POSTGRES_DB
value: ${DATABASE_NAME}
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
key: database-user
name: ${NAME}
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
key: database-password
name: ${NAME}
- name: DJANGO_SECRET_KEY
valueFrom:
secretKeyRef:
key: django-secret-key
name: ${NAME}
image: ghcr.io/plexoos/${NAME}:latest
name: ${NAME}
ports:
- containerPort: 8000
resources:
limits:
memory: ${MEMORY_LIMIT}
- apiVersion: v1
kind: Service
metadata:
annotations:
description: Exposes the database server
name: ${DATABASE_SERVICE_NAME}
spec:
ports:
- name: postgresql
port: 5432
targetPort: 5432
selector:
name: ${DATABASE_SERVICE_NAME}
- apiVersion: v1
kind: DeploymentConfig
metadata:
annotations:
description: Defines how to deploy the database
template.alpha.openshift.io/wait-for-ready: "true"
name: ${DATABASE_SERVICE_NAME}
spec:
replicas: 1
selector:
name: ${DATABASE_SERVICE_NAME}
strategy:
type: Recreate
template:
metadata:
labels:
name: ${DATABASE_SERVICE_NAME}
name: ${DATABASE_SERVICE_NAME}
spec:
containers:
- env:
- name: POSTGRESQL_USER
valueFrom:
secretKeyRef:
key: database-user
name: ${NAME}
- name: POSTGRESQL_PASSWORD
valueFrom:
secretKeyRef:
key: database-password
name: ${NAME}
- name: POSTGRESQL_DATABASE
value: ${DATABASE_NAME}
image: ' '
livenessProbe:
exec:
command:
- /usr/libexec/check-container
- --live
initialDelaySeconds: 120
timeoutSeconds: 10
name: postgresql
ports:
- containerPort: 5432
readinessProbe:
exec:
command:
- /usr/libexec/check-container
initialDelaySeconds: 5
timeoutSeconds: 1
resources:
limits:
memory: ${MEMORY_POSTGRESQL_LIMIT}
volumeMounts:
- mountPath: /var/lib/pgsql/data
name: data
volumes:
- emptyDir: {}
name: data
triggers:
- imageChangeParams:
automatic: true
containerNames:
- postgresql
from:
kind: ImageStreamTag
name: postgresql:${POSTGRESQL_VERSION}
namespace: openshift
type: ImageChange
- type: ConfigChange
parameters:
- description: The name assigned to all of the frontend objects defined in this template.
displayName: Name
name: NAME
required: true
value: npdb
- description: Version of Python image to be used (3.6-ubi8, 3.8-ubi7, 3.8-ubi8, or latest).
displayName: Version of Python Image
name: PYTHON_VERSION
required: true
value: 3.8-ubi8
- description: Version of PostgreSQL image to be used (10-el8, 12-el8, or latest).
displayName: Version of PostgreSQL Image
name: POSTGRESQL_VERSION
required: true
value: 12-el8
- description: Maximum amount of memory the Django container can use.
displayName: Memory Limit
name: MEMORY_LIMIT
required: true
value: 512Mi
- description: Maximum amount of memory the PostgreSQL container can use.
displayName: Memory Limit (PostgreSQL)
name: MEMORY_POSTGRESQL_LIMIT
required: true
value: 512Mi
- displayName: Database Service Name
name: DATABASE_SERVICE_NAME
required: true
value: postgresql
- displayName: Database Name
name: DATABASE_NAME
required: true
value: dbname
- displayName: Database Username
name: DATABASE_USER
required: true
value: login
- displayName: Database User Password
name: DATABASE_PASSWORD
value: password
- description: Set this to a long random string.
displayName: Django Secret Key
from: '[\w]{50}'
generate: expression
name: DJANGO_SECRET_KEY