Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dthorsen committed Jun 7, 2022
1 parent c19ddea commit 3800b8b
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 23 deletions.
6 changes: 3 additions & 3 deletions api/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,12 +547,12 @@ type SubnetSpec struct {
// +optional
type AzureNetworkInterface struct {
SubnetName string `json:"subnetName,omitempty"`
IpConfigs []AzureIPConfig `json:"ipConfigs,omitempty"`
IPConfigs []AzureIPConfig `json:"ipConfigs,omitempty"`
AcceleratedNetworking *bool `json:"acceleratedNetworking,omitempty"`
Id string `json:"id,omitempty"`
ID string `json:"id,omitempty"`
}

// IP Configuration defines options to confiure a network interface
// IP Configuration defines options to confiure a network interface.
type AzureIPConfig struct {
PrivateIP string `json:"privateIP,omitempty"`
PublicIP bool `json:"publicIP,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions azure/scope/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ func (m *MachineScope) InboundNatSpecs(portsInUse map[int32]struct{}) []azure.Re

// NICSpecs returns the network interface specs.
func (m *MachineScope) NICSpecs() []azure.ResourceSpecGetter {

nicSpecs := []azure.ResourceSpecGetter{}

if len(m.AzureMachine.Spec.NetworkInterfaces) < 1 {
Expand Down Expand Up @@ -267,7 +266,7 @@ func (m *MachineScope) NICSpecs() []azure.ResourceSpecGetter {
}

for i, n := range m.AzureMachine.Spec.NetworkInterfaces {
if n.Id != "" {
if n.ID != "" {
continue
}
spec := &networkinterfaces.NICSpec{
Expand Down Expand Up @@ -318,7 +317,7 @@ func (m *MachineScope) NICSpecs() []azure.ResourceSpecGetter {
spec.SKU = &m.cache.VMSKU
}

for _, c := range n.IpConfigs {
for _, c := range n.IPConfigs {
config := networkinterfaces.IPConfig{
PublicIP: c.PublicIP,
PrivateIP: c.PrivateIP,
Expand All @@ -339,8 +338,8 @@ func (m *MachineScope) NICIDs() []string {
nicIDs[i] = azure.NetworkInterfaceID(m.SubscriptionID(), nic.ResourceGroupName(), nic.ResourceName())
}
for _, n := range m.AzureMachine.Spec.NetworkInterfaces {
if n.Id != "" {
nicIDs = append(nicIDs, n.Id)
if n.ID != "" {
nicIDs = append(nicIDs, n.ID)
}
}
return nicIDs
Expand Down
6 changes: 3 additions & 3 deletions azure/services/networkinterfaces/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ func (s *NICSpec) Parameters(existing interface{}) (parameters interface{}, err
}

for i, c := range s.IPConfigs {
newIpConfigPropertiesFormat := &network.InterfaceIPConfigurationPropertiesFormat{}
newIpConfigPropertiesFormat.Subnet = subnet
newIPConfigPropertiesFormat := &network.InterfaceIPConfigurationPropertiesFormat{}
newIPConfigPropertiesFormat.Subnet = subnet
config := network.InterfaceIPConfiguration{
Name: to.StringPtr(s.Name + "-" + strconv.Itoa(i)),
InterfaceIPConfigurationPropertiesFormat: newIpConfigPropertiesFormat,
InterfaceIPConfigurationPropertiesFormat: newIPConfigPropertiesFormat,
}
if c.PrivateIP == "" {
config.InterfaceIPConfigurationPropertiesFormat.PrivateIPAllocationMethod = network.IPAllocationMethodDynamic
Expand Down
8 changes: 4 additions & 4 deletions azure/services/scalesets/scalesets.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,15 +459,15 @@ func (s *Service) buildVMSSFromSpec(ctx context.Context, vmssSpec azure.ScaleSet
nicConfig := compute.VirtualMachineScaleSetNetworkConfiguration{}
nicConfig.VirtualMachineScaleSetNetworkConfigurationProperties = &compute.VirtualMachineScaleSetNetworkConfigurationProperties{}
nicConfig.Name = to.StringPtr(vmssSpec.Name + "-" + strconv.Itoa(i))
if n.Id != "" {
nicConfig.ID = &n.Id
if n.ID != "" {
nicConfig.ID = &n.ID
} else {
if to.Bool(n.AcceleratedNetworking) {
nicConfig.VirtualMachineScaleSetNetworkConfigurationProperties.EnableAcceleratedNetworking = to.BoolPtr(true)
} else {
nicConfig.VirtualMachineScaleSetNetworkConfigurationProperties.EnableAcceleratedNetworking = to.BoolPtr(false)
}
if len(n.IpConfigs) == 0 {
if len(n.IPConfigs) == 0 {
nicConfig.VirtualMachineScaleSetNetworkConfigurationProperties.IPConfigurations = &[]compute.VirtualMachineScaleSetIPConfiguration{
{
Name: to.StringPtr(vmssSpec.Name + "-" + strconv.Itoa(i)),
Expand All @@ -483,7 +483,7 @@ func (s *Service) buildVMSSFromSpec(ctx context.Context, vmssSpec azure.ScaleSet
}
} else {
ipconfigs := []compute.VirtualMachineScaleSetIPConfiguration{}
for j, _ := range n.IpConfigs {
for j := range n.IPConfigs {
ipconfig := compute.VirtualMachineScaleSetIPConfiguration{
VirtualMachineScaleSetIPConfigurationProperties: &compute.VirtualMachineScaleSetIPConfigurationProperties{},
}
Expand Down
3 changes: 1 addition & 2 deletions azure/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"reflect"

"github.com/google/go-cmp/cmp"
"sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
)

Expand Down Expand Up @@ -128,7 +127,7 @@ type ScaleSetSpec struct {
SecurityProfile *infrav1.SecurityProfile
SpotVMOptions *infrav1.SpotVMOptions
FailureDomains []string
NetworkInterfaces []v1beta1.AzureNetworkInterface
NetworkInterfaces []infrav1.AzureNetworkInterface
}

// TagsSpec defines the specification for a set of tags.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1647,11 +1647,16 @@ spec:
description: Network Interfaces to attach to the to a virtual
machine
items:
description: Network Interfaces to attach to each VM
properties:
acceleratedNetworking:
type: boolean
id:
type: string
ipConfigs:
items:
description: IP Configuration defines options to confiure
a network interface.
properties:
privateIP:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,7 @@ spec:
ipConfigs:
items:
description: IP Configuration defines options to confiure
a network interface
a network interface.
properties:
privateIP:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ spec:
ipConfigs:
items:
description: IP Configuration defines options to confiure
a network interface
a network interface.
properties:
privateIP:
type: string
Expand Down
3 changes: 1 addition & 2 deletions exp/api/v1beta1/azuremachinepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/errors"
Expand Down Expand Up @@ -91,7 +90,7 @@ type (

// Network Interfaces to attach to the to a virtual machine
// +optional
NetworkInterfaces []v1beta1.AzureNetworkInterface `json:"networkInterfaces,omitempty"`
NetworkInterfaces []infrav1.AzureNetworkInterface `json:"networkInterfaces,omitempty"`
}

// AzureMachinePoolSpec defines the desired state of AzureMachinePool.
Expand Down

0 comments on commit 3800b8b

Please sign in to comment.