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

[Core] Allow boolean-like strs in resources.labels #3646

Merged
merged 2 commits into from
Jun 10, 2024

Conversation

romilbhardwaj
Copy link
Collaborator

A yaml like this would fail:

resources:
  cloud: kubernetes
  labels:
    my-label: 'True'

Because when the cluster YAML was dumped for the provisioner in ~/.sky/generated/, it would remove the quotes and write my-label: True. This would be parsed as a bool value (instead of str) by yaml.safe_load, which would cause issues with downstream code (e.g., Kubernetes python API does not allow submitting bools as label values).

This PR adds single quotes around all dumped labels to make sure they are parsed as strings by the provisioner.

Tested:

  • YAML above on Kubernetes.

@romilbhardwaj
Copy link
Collaborator Author

Thanks @Michaelvll! Using jinja logic and tested again.

Copy link
Collaborator

@Michaelvll Michaelvll left a comment

Choose a reason for hiding this comment

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

Thanks for the update @romilbhardwaj! LGTM.

@romilbhardwaj romilbhardwaj merged commit 9a1aa5e into master Jun 10, 2024
20 checks passed
@romilbhardwaj romilbhardwaj deleted the schema_labels_boolean branch June 10, 2024 18:27
Michaelvll pushed a commit that referenced this pull request Aug 23, 2024
* Add quotes for labels dumped to cluster yaml.

* Filter in jinja
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants