Skip to content

Commit

Permalink
Fix: restartPolicy and limits
Browse files Browse the repository at this point in the history
- If restart_policy but restartPolicy does not, uses the former to populate the later
- If limits is empty, uses requests so limits == requests
  • Loading branch information
lvarin committed Aug 28, 2024
1 parent d1fc869 commit 688bd01
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/tesk_core/taskmaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ 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 container['resources']['limits'] is None 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)
Expand Down

0 comments on commit 688bd01

Please sign in to comment.