Skip to content

Commit 7191b87

Browse files
committed
add mem limit for deployments
1 parent ce11790 commit 7191b87

File tree

2 files changed

+60
-3
lines changed

2 files changed

+60
-3
lines changed

openshift/templates/django-postgresql.json

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,12 @@
193193
"name": "DJANGO_SECRET_KEY",
194194
"value": "${DJANGO_SECRET_KEY}"
195195
}
196-
]
196+
],
197+
"resources": {
198+
"limits": {
199+
"memory": "${MEMORY_LIMIT}"
200+
}
201+
}
197202
}
198203
]
199204
}
@@ -288,7 +293,12 @@
288293
"name": "POSTGRESQL_DATABASE",
289294
"value": "${DATABASE_NAME}"
290295
}
291-
]
296+
],
297+
"resources": {
298+
"limits": {
299+
"memory": "${MEMORY_POSTGRESQL_LIMIT}"
300+
}
301+
}
292302
}
293303
]
294304
}
@@ -297,62 +307,86 @@
297307
}
298308
],
299309
"parameters": [
310+
{
311+
"name": "MEMORY_LIMIT",
312+
"displayName": "Memory limit",
313+
"description": "Maximum amount of memory the Django container can use",
314+
"value": "128Mi"
315+
},
316+
{
317+
"name": "MEMORY_POSTGRESQL_LIMIT",
318+
"displayName": "Memory limit",
319+
"description": "Maximum amount of memory the PostgreSQL container can use",
320+
"value": "128Mi"
321+
},
300322
{
301323
"name": "SOURCE_REPOSITORY_URL",
324+
"displayName": "Source repository URL",
302325
"description": "The URL of the repository with your application source code",
303326
"value": "https://github.com/openshift/django-ex.git"
304327
},
305328
{
306329
"name": "SOURCE_REPOSITORY_REF",
330+
"displayName": "Source repository reference",
307331
"description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch"
308332
},
309333
{
310334
"name": "CONTEXT_DIR",
335+
"displayName": "Context directory",
311336
"description": "Set this to the relative path to your project if it is not in the root of your repository"
312337
},
313338
{
314339
"name": "APPLICATION_DOMAIN",
340+
"displayName": "Application hostname",
315341
"description": "The exposed hostname that will route to the Django service, if left blank a value will be defaulted.",
316342
"value": ""
317343
},
318344
{
319345
"name": "GITHUB_WEBHOOK_SECRET",
346+
"displayName": "GitHub webhook secret",
320347
"description": "A secret string used to configure the GitHub webhook",
321348
"generate": "expression",
322349
"from": "[a-zA-Z0-9]{40}"
323350
},
324351
{
325352
"name": "DATABASE_SERVICE_NAME",
353+
"displayName": "Database service name",
326354
"description": "Database service name",
327355
"value": "postgresql"
328356
},
329357
{
330358
"name": "DATABASE_ENGINE",
359+
"displayName": "Database engine",
331360
"description": "Database engine: postgresql, mysql or sqlite (default)",
332361
"value": "postgresql"
333362
},
334363
{
335364
"name": "DATABASE_NAME",
365+
"displayName": "Database name",
336366
"description": "Database name",
337367
"value": "default"
338368
},
339369
{
340370
"name": "DATABASE_USER",
371+
"displayName": "Database user name",
341372
"description": "Database user name",
342373
"value": "django"
343374
},
344375
{
345376
"name": "DATABASE_PASSWORD",
377+
"displayName": "Database user password",
346378
"description": "Database user password",
347379
"generate": "expression",
348380
"from": "[a-zA-Z0-9]{16}"
349381
},
350382
{
351383
"name": "APP_CONFIG",
384+
"displayName": "Application configuration file path",
352385
"description": "Relative path to Gunicorn configuration file (optional)"
353386
},
354387
{
355388
"name": "DJANGO_SECRET_KEY",
389+
"displayName": "Djange secret key",
356390
"description": "Set this to a long random string",
357391
"generate": "expression",
358392
"from": "[\\w]{50}"

openshift/templates/django.json

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,12 @@
193193
"name": "DJANGO_SECRET_KEY",
194194
"value": "${DJANGO_SECRET_KEY}"
195195
}
196-
]
196+
],
197+
"resources": {
198+
"limits": {
199+
"memory": "${MEMORY_LIMIT}"
200+
}
201+
}
197202
}
198203
]
199204
}
@@ -202,56 +207,74 @@
202207
}
203208
],
204209
"parameters": [
210+
{
211+
"name": "MEMORY_LIMIT",
212+
"displayName": "Memory limit",
213+
"description": "Maximum amount of memory the container can use",
214+
"value": "128Mi"
215+
},
205216
{
206217
"name": "SOURCE_REPOSITORY_URL",
218+
"displayName": "Source repository URL",
207219
"description": "The URL of the repository with your application source code",
208220
"value": "https://github.com/openshift/django-ex.git"
209221
},
210222
{
211223
"name": "SOURCE_REPOSITORY_REF",
224+
"displayName": "Source repository reference",
212225
"description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch"
213226
},
214227
{
215228
"name": "CONTEXT_DIR",
229+
"displayName": "Context directory",
216230
"description": "Set this to the relative path to your project if it is not in the root of your repository"
217231
},
218232
{
219233
"name": "APPLICATION_DOMAIN",
234+
"displayName": "Application hostname",
220235
"description": "The exposed hostname that will route to the Django service, if left blank a value will be defaulted.",
221236
"value": ""
222237
},
223238
{
224239
"name": "GITHUB_WEBHOOK_SECRET",
240+
"displayName": "GitHub webhook secret",
225241
"description": "A secret string used to configure the GitHub webhook",
226242
"generate": "expression",
227243
"from": "[a-zA-Z0-9]{40}"
228244
},
229245
{
230246
"name": "DATABASE_SERVICE_NAME",
247+
"displayName": "Database service name",
231248
"description": "Database service name"
232249
},
233250
{
234251
"name": "DATABASE_ENGINE",
252+
"displayName": "Database engine",
235253
"description": "Database engine: postgresql, mysql or sqlite (default)"
236254
},
237255
{
238256
"name": "DATABASE_NAME",
257+
"displayName": "Database name",
239258
"description": "Database name"
240259
},
241260
{
242261
"name": "DATABASE_USER",
262+
"displayName": "Database user name",
243263
"description": "Database user name"
244264
},
245265
{
246266
"name": "DATABASE_PASSWORD",
267+
"displayName": "Database user password",
247268
"description": "Database user password"
248269
},
249270
{
250271
"name": "APP_CONFIG",
272+
"displayName": "Application configuration file path",
251273
"description": "Relative path to Gunicorn configuration file (optional)"
252274
},
253275
{
254276
"name": "DJANGO_SECRET_KEY",
277+
"displayName": "Djange secret key",
255278
"description": "Set this to a long random string",
256279
"generate": "expression",
257280
"from": "[\\w]{50}"

0 commit comments

Comments
 (0)