diff --git a/setup.py b/setup.py index 7b6aa72..db7eacd 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ INSTALL_DEPS = ['kubernetes==9.0.0', 'requests>=2.20.0', - 'urllib3==1.26.18', + 'urllib3==1.26.19', 'boto3==1.16.18', ] TEST_DEPS = [ 'pytest', diff --git a/src/tesk_core/taskmaster.py b/src/tesk_core/taskmaster.py index 4fd506d..c7a7ee6 100755 --- a/src/tesk_core/taskmaster.py +++ b/src/tesk_core/taskmaster.py @@ -25,6 +25,18 @@ def run_executor(executor, namespace, pvc=None): if os.environ.get('EXECUTOR_BACKOFF_LIMIT') is not None: executor['spec'].update({'backoffLimit': int(os.environ['EXECUTOR_BACKOFF_LIMIT'])}) + if 'restartPolicy' not in spec.keys() and \ + 'restart_policy' in spec.keys(): + spec['restartPolicy'] = spec['restart_policy'] + + for container in spec['containers']: + if 'limits' not in container['resources'].keys(): + container['resources']['limits'] = None + if container['resources']['limits'] is None and \ + ('requests' in container['resources'].keys() and \ + container['resources']['requests'] is not None): + container['resources']['limits'] = container['resources']['requests'] + if pvc is not None: mounts = spec['containers'][0].setdefault('volumeMounts', []) mounts.extend(pvc.volume_mounts)