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

Invalid cluster name is generated if username has uppercase or invalid characters #1161

Closed
romilbhardwaj opened this issue Sep 9, 2022 · 5 comments · Fixed by #1526
Closed
Assignees
Labels
good first issue Good for newcomers

Comments

@romilbhardwaj
Copy link
Collaborator

If the user does not specify a cluster name, we randomly generate a name appended with the username appended to it. E.g.,

$ sky launch example.yaml
...
Launching a new cluster 'sky-7ccb-romilb'. Proceed? [Y/n]:

If the username has underscores or capital letters then it generates an invalid cluster name which fails our regex check:

def check_cluster_name_is_valid(cluster_name: str,
cloud: Optional[clouds.Cloud] = None) -> None:
"""Errors out on invalid cluster names not supported by cloud providers.
Bans (including but not limited to) names that:
- are digits-only
- contain underscore (_)
"""
if cluster_name is None:
return
# GCP errors return this exact regex. An informal description is at:
# https://cloud.google.com/compute/docs/naming-resources#resource-name-format
valid_regex = '[a-z]([-a-z0-9]{0,61}[a-z0-9])?'
if re.fullmatch(valid_regex, cluster_name) is None:
with ux_utils.print_exception_no_traceback():
raise ValueError(
f'Cluster name "{cluster_name}" is invalid; '
f'ensure it is fully matched by regex: {valid_regex}')

ValueError: Cluster name "sky-6948-rOmILB" is invalid; ensure it is fully matched by regex: [a-z]([-a-z0-9]{0,61}[a-z0-9])?

We should maybe run .lower() on the username and remove any invalid characters from it when generating cluster name.

@romilbhardwaj romilbhardwaj added the good first issue Good for newcomers label Sep 9, 2022
@Akshat977
Copy link

Hi @romilbhardwaj ,
This issue seems to be a good initiation of my journey towards contribution to FOSS projects.
Can you please assign this to me?

@romilbhardwaj
Copy link
Collaborator Author

Thanks for taking this up @Akshat977!

@michaelzhiluo
Copy link
Collaborator

Any updates on this Git issue @Akshat977 ?

@Michaelvll
Copy link
Collaborator

Hey @Akshat977, since we did not hear back from you for a long time, we will reassign the issue soon. Please tell us your progress, if you are working on it. : )

@Akshat977
Copy link

Hey @Michaelvll , can you please review my pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
4 participants