Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Provisioner] Accept both w/ server prefix and w/o server prefix for private docker registry #2574

Merged
merged 7 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion sky/skylet/providers/command_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ def run_init(self, *, as_head: bool, file_mounts: Dict[str, str],
docker_login_config.password,
docker_login_config.server,
))
specific_image = f'{docker_login_config.server}/{specific_image}'

if self.docker_config.get('pull_before_run', True):
assert specific_image, ('Image must be included in config if ' +
Expand Down
12 changes: 10 additions & 2 deletions sky/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,22 @@ def _with_docker_login_config(
task_envs)

def _add_docker_login_config(resources: 'resources_lib.Resources'):
if resources.extract_docker_image() is None:
docker_image = resources.extract_docker_image()
if docker_image is None:
logger.warning(f'{colorama.Fore.YELLOW}Docker login configs '
f'{", ".join(constants.DOCKER_LOGIN_ENV_VARS)} '
'are provided, but no docker image is specified '
'in `image_id`. The login configs will be '
f'ignored.{colorama.Style.RESET_ALL}')
return resources
return resources.copy(_docker_login_config=docker_login_config)
# Already checked in extract_docker_image
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remind me why we do not allow multiple regions in image_id when docker is specified?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I don't remember why... And I just finished a quick review, it seems possible to add this feature, though arguably this feature is a little bit unusual. IIUC the main reason we support multiple regions is image on AWS is not cross region?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mix of image and docker image seems possible too - just using the corresponding image when we make_deploy_resources_variables will work iiuc. Let me file an issue to track on this

assert len(resources.image_id) == 1
cblmemo marked this conversation as resolved.
Show resolved Hide resolved
region = list(resources.image_id.keys())[0]
server_prefix = f'{docker_login_config.server}/'
cblmemo marked this conversation as resolved.
Show resolved Hide resolved
if not docker_image.startswith(server_prefix):
docker_image = f'{server_prefix}{docker_image}'
return resources.copy(image_id={region: 'docker:' + docker_image},
_docker_login_config=docker_login_config)

return {_add_docker_login_config(resources) for resources in resources_set}

Expand Down