Skip to content

Commit

Permalink
Merge ad7d17b into ca7c6f4
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego committed Feb 28, 2020
2 parents ca7c6f4 + ad7d17b commit d53740b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions reana_job_controller/config.py
Expand Up @@ -89,3 +89,6 @@
"""Kerberos configMap name. Must be the same as in
reana_cluster/backends/kubernetes/templates/configmaps/kerberos.yaml.
"""

IMAGE_PULL_SECRETS = os.getenv('IMAGE_PULL_SECRETS', '').split(',')
"""Docker image pull secrets which allow the usage of private images."""
11 changes: 11 additions & 0 deletions reana_job_controller/kubernetes_job_manager.py
Expand Up @@ -144,6 +144,7 @@ def execute(self):
self.add_hostpath_volumes()
self.add_shared_volume()
self.add_eos_volume()
self.add_image_pull_secrets()

if self.cvmfs_mounts != 'false':
cvmfs_map = {}
Expand Down Expand Up @@ -225,6 +226,16 @@ def add_eos_volume(self):
K8S_CERN_EOS_MOUNT_CONFIGURATION['volumeMounts'],
K8S_CERN_EOS_MOUNT_CONFIGURATION['volume'])])

def add_image_pull_secrets(self):
"""Attach to the container the configured image pull secrets."""
image_pull_secrets = []
for secret_name in current_app.config['IMAGE_PULL_SECRETS']:
if secret_name:
image_pull_secrets.append({'name': secret_name})

self.job['spec']['template']['spec']['imagePullSecrets'] = \
image_pull_secrets

def add_hostpath_volumes(self):
"""Add hostPath mounts from configuration to job."""
volumes_to_mount = []
Expand Down

0 comments on commit d53740b

Please sign in to comment.