Skip to content

Commit 8c4cc21

Browse files
authored
Merge pull request #92 from jianxiaoguo/main
add KUBERNETES_LIMITS env config and fix /bin/sh -c no arg err
2 parents 3ddb593 + ab4f7a5 commit 8c4cc21

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

rootfs/api/models/app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,11 @@ def _get_entrypoint(self, container_type):
153153
"""
154154
Return the kubernetes "container command" to be sent off to the scheduler.
155155
"""
156-
entrypoint = ['/bin/sh', '-c']
156+
entrypoint = []
157157
release = self.release_set.filter(failed=False).latest()
158+
if release is not None and release.build is not None:
159+
if release.build.procfile and container_type in release.build.procfile:
160+
entrypoint = ['/bin/sh', '-c']
158161
if self._get_stack(release) == "buildpack":
159162
if container_type in release.build.procfile:
160163
entrypoint = [container_type]

rootfs/api/settings/production.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,17 +350,17 @@
350350
KUBERNETES_REQUEST_MEMORY_RATIO = int(os.environ.get('KUBERNETES_REQUEST_MEMORY_RATIO', '2'))
351351

352352
# Minimum CPU limit, units are represented in the millicpu of CPUs
353-
KUBERNETES_LIMITS_MIN_CPU = 125
353+
KUBERNETES_LIMITS_MIN_CPU = int(os.environ.get('KUBERNETES_LIMITS_MIN_CPU', '125'))
354354
# Max CPU limit, units are represented in the millicpu of CPUs
355-
KUBERNETES_LIMITS_MAX_CPU = 32 * 1000
355+
KUBERNETES_LIMITS_MAX_CPU = int(os.environ.get('KUBERNETES_LIMITS_MAX_CPU', 32 * 1000))
356356
# Minimum Memory limit, units are represented in Megabytes(M)
357-
KUBERNETES_LIMITS_MIN_MEMORY = 128
357+
KUBERNETES_LIMITS_MIN_MEMORY = int(os.environ.get('KUBERNETES_LIMITS_MIN_MEMORY', '128'))
358358
# Max Memory limit, units are represented in Megabytes(M)
359-
KUBERNETES_LIMITS_MAX_MEMORY = 128 * 1024
359+
KUBERNETES_LIMITS_MAX_MEMORY = int(os.environ.get('KUBERNETES_LIMITS_MAX_MEMORY', 128 * 1024))
360360
# Minimum Stroage Volume limit, units are represented in Gigabytes(G)
361-
KUBERNETES_LIMITS_MIN_VOLUME = 1
361+
KUBERNETES_LIMITS_MIN_VOLUME = int(os.environ.get('KUBERNETES_LIMITS_MIN_VOLUME', 1))
362362
# Max Stroage Volume limit, units are represented in Gigabytes(G)
363-
KUBERNETES_LIMITS_MAX_VOLUME = 1024 * 16
363+
KUBERNETES_LIMITS_MAX_VOLUME = int(os.environ.get('KUBERNETES_LIMITS_MAX_VOLUME', 1024 * 16))
364364

365365
# Default pod spec for application.
366366
KUBERNETES_POD_DEFAULT_RESOURCES = os.environ.get(

rootfs/api/tests/test_pods.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ def test_run_command_good(self, mock_requests):
589589
response = self.client.post(url, body)
590590
self.assertEqual(response.status_code, 200, response.data)
591591
app = App.objects.get(id=app_id)
592-
self.assertEqual(app._get_entrypoint('cmd'), ['/bin/sh', '-c'])
592+
self.assertEqual(app._get_entrypoint('cmd'), [])
593593

594594
# procfile workflow
595595
build.sha = 'somereallylongsha'

0 commit comments

Comments
 (0)