@@ -94,6 +94,11 @@ func (m *MachineScope) Cloud() cloud.Cloud {
9494 return m .ClusterGetter .Cloud ()
9595}
9696
97+ // NetworkCloud returns initialized network cloud.
98+ func (m * MachineScope ) NetworkCloud () cloud.Cloud {
99+ return m .ClusterGetter .NetworkCloud ()
100+ }
101+
97102// Zone returns the FailureDomain for the GCPMachine.
98103func (m * MachineScope ) Zone () string {
99104 if m .Machine .Spec .FailureDomain == nil {
@@ -319,7 +324,7 @@ func (m *MachineScope) InstanceAdditionalDiskSpec() []*compute.AttachedDisk {
319324// InstanceNetworkInterfaceSpec returns compute network interface spec.
320325func (m * MachineScope ) InstanceNetworkInterfaceSpec () * compute.NetworkInterface {
321326 networkInterface := & compute.NetworkInterface {
322- Network : path .Join ("projects" , m .ClusterGetter .Project (), "global" , "networks" , m .ClusterGetter .NetworkName ()),
327+ Network : path .Join ("projects" , m .ClusterGetter .NetworkProject (), "global" , "networks" , m .ClusterGetter .NetworkName ()),
323328 }
324329
325330 if m .GCPMachine .Spec .PublicIP != nil && * m .GCPMachine .Spec .PublicIP {
@@ -332,7 +337,7 @@ func (m *MachineScope) InstanceNetworkInterfaceSpec() *compute.NetworkInterface
332337 }
333338
334339 if m .GCPMachine .Spec .Subnet != nil {
335- networkInterface .Subnetwork = path .Join ("regions" , m .ClusterGetter .Region (), "subnetworks" , * m .GCPMachine .Spec .Subnet )
340+ networkInterface .Subnetwork = path .Join ("projects" , m . ClusterGetter . NetworkProject (), " regions" , m .ClusterGetter .Region (), "subnetworks" , * m .GCPMachine .Spec .Subnet )
336341 }
337342
338343 return networkInterface
0 commit comments