Skip to content

Commit

Permalink
fix: when volumes exists and it is null, it does not fail anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
lvarin committed Aug 22, 2024
1 parent 822e46c commit d85ad37
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tesk_core/taskmaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def run_executor(executor, namespace, pvc=None):
mounts = spec['containers'][0].setdefault('volumeMounts', [])
mounts.extend(pvc.volume_mounts)
volumes = spec.setdefault('volumes', [])
if volumes is None:
spec['volumes'] = []
# volumes is a refence to spec['volumes']
# This makes sure the next line does not fail if volumes was originaly "null"
volumes.extend([{'name': task_volume_basename, 'persistentVolumeClaim': {
'readonly': False, 'claimName': pvc.name}}])
logger.debug('Created job: ' + jobname)
Expand Down

0 comments on commit d85ad37

Please sign in to comment.