Skip to content

Commit

Permalink
Add image_pull_secrets oscar property
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Sep 7, 2022
1 parent 1136698 commit f0ac749
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions IM/connectors/OSCAR.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ def _get_service_json(self, radl_system):
service["script"] = radl_system.getValue("script")
if radl_system.getValue("alpine"):
service["alpine"] = True
if radl_system.getValue("image_pull_secrets"):
secrets = radl_system.getValue("image_pull_secrets")
if not isinstance(secrets, list):
secrets = [secrets]
service["image_pull_secrets"] = secrets

if radl_system.getValue("disk.0.image.url"):
url_image = urlparse(radl_system.getValue("disk.0.image.url"))
Expand Down
7 changes: 6 additions & 1 deletion IM/tosca/Tosca.py
Original file line number Diff line number Diff line change
Expand Up @@ -1893,7 +1893,8 @@ def _gen_oscar_system(self, node):
'name': 'name',
'cpu': 'cpu.count',
'image': 'disk.0.image.url',
'script': 'script'
'script': 'script',
'image_pull_secrets': 'image_pull_secrets'
}

for prop in node.get_properties_objects():
Expand Down Expand Up @@ -1965,6 +1966,10 @@ def _get_oscar_service_json(self, node):
res["image"] = value
elif prop.name == 'env_variables':
res['environment'] = {'Variables': value}
elif prop.name == 'image_pull_secrets':
if not isinstance(value, list):
value = [value]
res['image_pull_secrets'] = value
else:
# this should never happen
Tosca.logger.warn("Property %s not expected. Ignoring." % prop.name)
Expand Down

0 comments on commit f0ac749

Please sign in to comment.