Skip to content

Commit

Permalink
Add ipv6 ipconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
CecileRobertMichon committed Feb 18, 2023
1 parent 1e3b186 commit ccac24e
Showing 3 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions azure/scope/machinepool.go
Original file line number Diff line number Diff line change
@@ -138,6 +138,7 @@ func (m *MachinePoolScope) ScaleSetSpec() azure.ScaleSetSpec {
FailureDomains: m.MachinePool.Spec.FailureDomains,
TerminateNotificationTimeout: m.AzureMachinePool.Spec.Template.TerminateNotificationTimeout,
NetworkInterfaces: m.AzureMachinePool.Spec.Template.NetworkInterfaces,
IPv6Enabled: m.IsIPv6Enabled(),
OrchestrationMode: m.AzureMachinePool.Spec.OrchestrationMode,
}
}
16 changes: 13 additions & 3 deletions azure/services/scalesets/scalesets.go
Original file line number Diff line number Diff line change
@@ -602,15 +602,25 @@ func (s *Service) getVirtualMachineScaleSetNetworkConfiguration(vmssSpec azure.S
},
}

ipconfig.Subnet = &compute.APIEntityReference{
ID: pointer.String(azure.SubnetID(s.Scope.SubscriptionID(), vmssSpec.VNetResourceGroup, vmssSpec.VNetName, n.SubnetName)),
}
if j == 0 {
// Always use the first IPConfig as the Primary
ipconfig.Primary = pointer.Bool(true)
}
ipconfigs = append(ipconfigs, ipconfig)
}
if vmssSpec.IPv6Enabled {
ipv6Config := compute.VirtualMachineScaleSetIPConfiguration{
Name: pointer.String("ipConfigv6"),
VirtualMachineScaleSetIPConfigurationProperties: &compute.VirtualMachineScaleSetIPConfigurationProperties{
PrivateIPAddressVersion: "IPv6",
Primary: pointer.Bool(false),
Subnet: &compute.APIEntityReference{
ID: pointer.String(azure.SubnetID(s.Scope.SubscriptionID(), vmssSpec.VNetResourceGroup, vmssSpec.VNetName, n.SubnetName)),
},
},
}
ipconfigs = append(ipconfigs, ipv6Config)
}
if i == 0 {
ipconfigs[0].LoadBalancerBackendAddressPools = &backendAddressPools
nicConfig.VirtualMachineScaleSetNetworkConfigurationProperties.Primary = pointer.Bool(true)
1 change: 1 addition & 0 deletions azure/types.go
Original file line number Diff line number Diff line change
@@ -68,6 +68,7 @@ type ScaleSetSpec struct {
FailureDomains []string
VMExtensions []infrav1.VMExtension
NetworkInterfaces []infrav1.NetworkInterface
IPv6Enabled bool
OrchestrationMode infrav1.OrchestrationModeType
}

0 comments on commit ccac24e

Please sign in to comment.