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

[GCP/Provisioner] Assign VMs launched on GCP with service account #2972

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion sky/provision/gcp/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def bootstrap_instances(

_configure_project(config.provider_config, crm)
iam_role = _configure_iam_role(config, crm, iam)
config.provider_config['iam_role'] = iam_role # temporary store
config.node_config.update(iam_role)
config = _configure_subnet(region, cluster_name, config, compute)

return config
Expand Down
4 changes: 3 additions & 1 deletion tests/test_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,16 @@ def test_aws_region():


@pytest.mark.gcp
def test_gcp_region():
def test_gcp_region_and_service_account():
name = _get_cluster_name()
test = Test(
'gcp_region',
[
f'sky launch -y -c {name} --region us-central1 --cloud gcp tests/test_yamls/minimal.yaml',
f'sky exec {name} tests/test_yamls/minimal.yaml',
f'sky logs {name} 1 --status', # Ensure the job succeeded.
f'sky exec {name} \'curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/identity?format=standard&audience=gcp"\'',
f'sky logs {name} 2 --status', # Ensure the job succeeded.
f'sky status --all | grep {name} | grep us-central1', # Ensure the region is correct.
],
f'sky down -y {name}',
Expand Down