aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/gce
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-02-27 11:58:41 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-02-27 11:58:41 +0100
commit64482eb94884b3d18789276e1fc7b4776a2e7c74 (patch)
treef0256bafe10dfad361fec88b64010c71aeabfa7a /pkg/gce
parent6d41d29ecdde31f770663992e7d3948618f62434 (diff)
pkg/gce: use current instance network
The current instance is not necessary in the default network.
Diffstat (limited to 'pkg/gce')
-rw-r--r--pkg/gce/gce.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/gce/gce.go b/pkg/gce/gce.go
index d449d87ba..93dc65557 100644
--- a/pkg/gce/gce.go
+++ b/pkg/gce/gce.go
@@ -31,6 +31,8 @@ type Context struct {
Instance string
InternalIP string
ExternalIP string
+ Network string
+ Subnetwork string
computeService *compute.Service
@@ -80,6 +82,8 @@ func NewContext() (*Context, error) {
ctx.ExternalIP = ac.NatIP
}
}
+ ctx.Network = iface.Network
+ ctx.Subnetwork = iface.Network
}
if ctx.InternalIP == "" {
return nil, fmt.Errorf("failed to get current instance internal IP")
@@ -121,7 +125,8 @@ func (ctx *Context) CreateInstance(name, machineType, image, sshkey string) (str
},
NetworkInterfaces: []*compute.NetworkInterface{
&compute.NetworkInterface{
- Network: "global/networks/default",
+ Network: ctx.Network,
+ Subnetwork: ctx.Subnetwork,
},
},
Scheduling: &compute.Scheduling{