Skip to content

Commit 691aea3

Browse files
eybergIan Eyberg
andauthored
fixing #1533 (#1536)
Co-authored-by: Ian Eyberg <[email protected]>
1 parent 303441d commit 691aea3

File tree

1 file changed

+13
-22
lines changed

1 file changed

+13
-22
lines changed

provider/gcp/gcp_network.go

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -135,39 +135,30 @@ func (p *GCloud) getNIC(ctx *lepton.Context, computeService *compute.Service) (n
135135

136136
var cnic *compute.NetworkInterface
137137

138+
cnic = &compute.NetworkInterface{
139+
Network: network.SelfLink,
140+
Subnetwork: subnet.SelfLink,
141+
}
142+
138143
if ctx.Config().CloudConfig.EnableIPv6 {
139-
cnic = &compute.NetworkInterface{
140-
Name: "eth0",
141-
Network: network.SelfLink,
142-
Subnetwork: subnet.SelfLink,
143-
StackType: "IPV4_IPV6",
144-
Ipv6AccessConfigs: []*compute.AccessConfig{
145-
{
146-
Type: "DIRECT_IPV6",
147-
NetworkTier: "PREMIUM",
148-
},
144+
cnic.StackType = "IPV4_IPV6"
145+
cnic.Ipv6AccessConfigs = []*compute.AccessConfig{
146+
{
147+
Type: "DIRECT_IPV6",
148+
NetworkTier: "PREMIUM",
149149
},
150150
}
151-
152-
} else {
153-
cnic = &compute.NetworkInterface{
154-
Name: "eth0",
155-
Network: network.SelfLink,
156-
Subnetwork: subnet.SelfLink,
157-
}
158151
}
159152

160153
nic = append(nic, cnic)
161154

162155
} else {
163156
nic = append(nic, &compute.NetworkInterface{
164-
Name: "eth0",
165157
Network: network.SelfLink,
166158
})
167159
}
168160
} else {
169-
eth0Nic := &compute.NetworkInterface{
170-
Name: "eth0",
161+
cnic := &compute.NetworkInterface{
171162
AccessConfigs: []*compute.AccessConfig{
172163
{
173164
NetworkTier: "PREMIUM",
@@ -177,9 +168,9 @@ func (p *GCloud) getNIC(ctx *lepton.Context, computeService *compute.Service) (n
177168
},
178169
}
179170
if ctx.Config().CloudConfig.StaticIP != "" {
180-
eth0Nic.AccessConfigs[0].NatIP = ctx.Config().CloudConfig.StaticIP
171+
cnic.AccessConfigs[0].NatIP = ctx.Config().CloudConfig.StaticIP
181172
}
182-
nic = append(nic, eth0Nic)
173+
nic = append(nic, cnic)
183174
}
184175

185176
if ctx.Config().RunConfig.IPAddress != "" {

0 commit comments

Comments
 (0)