Skip to content

Commit

Permalink
Working allowed_clouds
Browse files Browse the repository at this point in the history
  • Loading branch information
romilbhardwaj committed May 17, 2024
1 parent 1f78982 commit fd44999
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
13 changes: 13 additions & 0 deletions docs/source/reference/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ Available fields and semantics:
cpus: 4+ # number of vCPUs, max concurrent spot jobs = 2 * cpus
disk_size: 100
# Allow list for clouds to be used in `sky check`
#
# This field is used to restrict the clouds that SkyPilot will check and use
# when running `sky check`. Any cloud already enabled but not specified here
# will be disabled on the next `sky check` run.
# If this field is not set, SkyPilot will check and use all supported clouds.
#
# Default: null (use all supported clouds).
allowed_clouds:
- aws
- gcp
- kubernetes
# Advanced AWS configurations (optional).
# Apply to all new instances but not existing ones.
aws:
Expand Down
16 changes: 12 additions & 4 deletions sky/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,22 @@ def get_all_clouds():
disabled_clouds_set = {
cloud for cloud in disabled_clouds if not cloud.startswith('Cloudflare')
}
config_allowed_clouds_set = {
cloud for cloud in config_allowed_clouds
if not cloud.startswith('Cloudflare')
}
previously_enabled_clouds_set = {
repr(cloud) for cloud in global_user_state.get_cached_enabled_clouds()
}

# Determine the set of enabled clouds: previously enabled clouds + newly
# enabled clouds - newly disabled clouds.
all_enabled_clouds = ((previously_enabled_clouds_set | enabled_clouds_set) -
disabled_clouds_set)
# Determine the set of enabled clouds: (previously enabled clouds + newly
# enabled clouds - newly disabled clouds) intersected with
# config_allowed_clouds, if specified in config.yaml.
# This means that if a cloud is already enabled and is not included in
# allowed_clouds in config.yaml, it will be disabled.
all_enabled_clouds = (config_allowed_clouds_set & (
(previously_enabled_clouds_set | enabled_clouds_set) -
disabled_clouds_set))
global_user_state.set_enabled_clouds(list(all_enabled_clouds))

skipped_clouds_hint = None
Expand Down

0 comments on commit fd44999

Please sign in to comment.