Skip to content

Commit

Permalink
Merge pull request #4161 from testwill/pkg-import
Browse files Browse the repository at this point in the history
chore: pkg imported more than once
  • Loading branch information
k8s-ci-robot authored Jun 25, 2023
2 parents 89d7bc2 + 17f51c0 commit 9c8cb6d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
3 changes: 1 addition & 2 deletions pkg/nodeipam/ipam/cloud_cidr_allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"time"

v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -423,7 +422,7 @@ func (ca *cloudCIDRAllocator) updateCIDRsAllocation(data nodeReservedCIDRs) erro
cidrsString := cidrsAsString(data.allocatedCIDRs)
node, err = ca.nodeLister.Get(data.nodeName)
if err != nil {
if errors.IsNotFound(err) {
if apierrors.IsNotFound(err) {
return nil // node no longer available, skip processing
}
klog.Errorf("Failed while getting node %v for updating Node.Spec.PodCIDR: %w", data.nodeName, err)
Expand Down
15 changes: 7 additions & 8 deletions tests/e2e/network/ensureloadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2022-07-01/network"
aznetwork "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2022-07-01/network"

appsv1 "k8s.io/api/apps/v1"
Expand Down Expand Up @@ -834,7 +833,7 @@ var _ = Describe("EnsureLoadBalancer should not update any resources when servic
consts.ServiceAnnotationLoadBalancerHealthProbeNumOfProbe: "8",
}

if strings.EqualFold(os.Getenv(utils.LoadBalancerSkuEnv), string(network.PublicIPAddressSkuNameStandard)) &&
if strings.EqualFold(os.Getenv(utils.LoadBalancerSkuEnv), string(aznetwork.PublicIPAddressSkuNameStandard)) &&
tc.IPFamily == utils.IPv4 {
// Routing preference is only supported in standard public IPs
annotation[consts.ServiceAnnotationIPTagsForPublicIP] = "RoutingPreference=Internet"
Expand Down Expand Up @@ -921,7 +920,7 @@ var _ = Describe("EnsureLoadBalancer should not update any resources when servic
})

It("should respect service with BYO public IP prefix with various configurations", func() {
if !strings.EqualFold(os.Getenv(utils.LoadBalancerSkuEnv), string(network.PublicIPAddressSkuNameStandard)) {
if !strings.EqualFold(os.Getenv(utils.LoadBalancerSkuEnv), string(aznetwork.PublicIPAddressSkuNameStandard)) {
Skip("pip-prefix-id only work with Standard Load Balancer")
}

Expand Down Expand Up @@ -1044,11 +1043,11 @@ func updateServiceAndCompareEtags(tc *utils.AzureTestClient, cs clientset.Interf
Expect(pipEtag).To(Equal(newPipEtag), "pip etag")
}

func createNewSubnet(tc *utils.AzureTestClient, subnetName string) (*network.Subnet, bool) {
func createNewSubnet(tc *utils.AzureTestClient, subnetName string) (*aznetwork.Subnet, bool) {
vNet, err := tc.GetClusterVirtualNetwork()
Expect(err).NotTo(HaveOccurred())

var subnetToReturn *network.Subnet
var subnetToReturn *aznetwork.Subnet
isNew := false
for i := range *vNet.Subnets {
existingSubnet := (*vNet.Subnets)[i]
Expand Down Expand Up @@ -1107,15 +1106,15 @@ func getResourceEtags(tc *utils.AzureTestClient, ip, nsgRulePrefix string, inter
return
}

func getAzureInternalLoadBalancerFromPrivateIP(tc *utils.AzureTestClient, ip, lbResourceGroup string) *network.LoadBalancer {
func getAzureInternalLoadBalancerFromPrivateIP(tc *utils.AzureTestClient, ip, lbResourceGroup string) *aznetwork.LoadBalancer {
if lbResourceGroup == "" {
lbResourceGroup = tc.GetResourceGroup()
}
utils.Logf("Listing all LBs in the resourceGroup " + lbResourceGroup)
lbList, err := tc.ListLoadBalancers(lbResourceGroup)
Expect(err).NotTo(HaveOccurred())

var ilb *network.LoadBalancer
var ilb *aznetwork.LoadBalancer
utils.Logf("Looking for internal load balancer frontend config ID with private ip as frontend")
for i := range lbList {
lb := lbList[i]
Expand Down Expand Up @@ -1213,7 +1212,7 @@ func defaultPublicIPAddress(ipName string, isIPv6 bool) aznetwork.PublicIPAddres
},
}
if isIPv6 {
pip.PublicIPAddressPropertiesFormat.PublicIPAddressVersion = network.IPv6
pip.PublicIPAddressPropertiesFormat.PublicIPAddressVersion = aznetwork.IPv6
}
return pip
}
Expand Down
9 changes: 4 additions & 5 deletions tests/e2e/utils/network_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2022-07-01/network"
aznetwork "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2022-07-01/network"

v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -87,7 +86,7 @@ func (azureTestClient *AzureTestClient) GetClusterVirtualNetwork() (virtualNetwo
}

// CreateSubnet creates a new subnet in the specified virtual network.
func (azureTestClient *AzureTestClient) CreateSubnet(vnet aznetwork.VirtualNetwork, subnetName *string, prefixes *[]string, waitUntilComplete bool) (network.Subnet, error) {
func (azureTestClient *AzureTestClient) CreateSubnet(vnet aznetwork.VirtualNetwork, subnetName *string, prefixes *[]string, waitUntilComplete bool) (aznetwork.Subnet, error) {
Logf("creating a new subnet %s, %v", *subnetName, *prefixes)
subnetParameter := (*vnet.Subnets)[0]
subnetParameter.Name = subnetName
Expand All @@ -98,7 +97,7 @@ func (azureTestClient *AzureTestClient) CreateSubnet(vnet aznetwork.VirtualNetwo
}
subnetsClient := azureTestClient.createSubnetsClient()
_, err := subnetsClient.CreateOrUpdate(context.Background(), azureTestClient.GetResourceGroup(), *vnet.Name, *subnetName, subnetParameter)
var subnet network.Subnet
var subnet aznetwork.Subnet
if err != nil || !waitUntilComplete {
return subnet, err
}
Expand Down Expand Up @@ -345,9 +344,9 @@ func WaitGetPIPByPrefix(
cli *AzureTestClient,
prefixName string,
untilPIPCreated bool,
) (network.PublicIPAddress, error) {
) (aznetwork.PublicIPAddress, error) {

var pip network.PublicIPAddress
var pip aznetwork.PublicIPAddress

err := wait.Poll(10*time.Second, 5*time.Minute, func() (bool, error) {
prefix, err := WaitGetPIPPrefix(cli, prefixName)
Expand Down

0 comments on commit 9c8cb6d

Please sign in to comment.