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

nil chk for ipv6 on azure instance create #1606

Merged
merged 3 commits into from
Apr 10, 2024
Merged
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
10 changes: 7 additions & 3 deletions provider/azure/azure_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ func (a *Azure) CreateInstance(ctx *lepton.Context) error {
vmName := ctx.Config().RunConfig.InstanceName
ctx.Logger().Logf("spinning up:\t%s", vmName)

// if ctx.Config().CloudConfig.EnableIPv6 {

// create virtual network
var vnet *network.VirtualNetwork
configVPC := ctx.Config().CloudConfig.VPC
Expand Down Expand Up @@ -150,7 +148,13 @@ func (a *Azure) CreateInstance(ctx *lepton.Context) error {
// pass vnet, subnet, ip, nicname
enableIPForwarding := c.RunConfig.CanIPForward
ctx.Logger().Infof("creating network interface controller with id %s", vmName)
nic, err := a.CreateNIC(context.TODO(), location, *vnet.Name, *subnet.Name, *nsg.Name, *ip.Name, *ipv6Name.Name, vmName, enableIPForwarding, c)

v6name := ""
if ipv6Name.Name != nil {
v6name = *ipv6Name.Name
}

nic, err := a.CreateNIC(context.TODO(), location, *vnet.Name, *subnet.Name, *nsg.Name, *ip.Name, v6name, vmName, enableIPForwarding, c)
if err != nil {
ctx.Logger().Error(err)
return errors.New("error creating network interface controller")
Expand Down