Skip to content

Commit 7bf2b00

Browse files
authored
Merge pull request #721 from kvinwang/feat/dstack-cloud-no-public-ip
dstack-cloud: add no_public_ip (--no-address) for network-isolated VMs
2 parents 1a4942e + 3718829 commit 7bf2b00

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

scripts/bin/dstack-cloud

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ class GcpConfig:
209209
network: str = "default"
210210
subnet: str = ""
211211
private_ip: str = "" # static internal IP to bind (--private-network-ip)
212+
no_public_ip: bool = False # network-isolated: no external IP (--no-address); reach via IAP
212213

213214
# Identity settings
214215
service_account: str = ""
@@ -250,6 +251,7 @@ class GcpConfig:
250251
"network": "default",
251252
"subnet": "",
252253
"private_ip": "",
254+
"no_public_ip": False,
253255
"service_account": "",
254256
"scopes": [],
255257
"tags": [],
@@ -1458,6 +1460,12 @@ class CloudDeploymentManager:
14581460
if not config.subnet:
14591461
create_args.append("--subnet=default")
14601462
create_args.append(f"--private-network-ip={config.private_ip}")
1463+
if config.no_public_ip:
1464+
# Network-isolated CVM: no ephemeral external IP. With no Cloud NAT on
1465+
# the subnet, this also means no internet egress. Reaching the VM still
1466+
# works over IAP TCP forwarding (ingress via Google's edge to the
1467+
# internal IP), so SSH / the on-prem courier are unaffected.
1468+
create_args.append("--no-address")
14611469
if config.service_account:
14621470
create_args.append(f"--service-account={config.service_account}")
14631471
if config.scopes:

0 commit comments

Comments
 (0)