mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 02:41:25 +00:00
Merge pull request #87555 from feiskyer/client-cleanup
Cleanup unused Azure client interfaces
This commit is contained in:
commit
d1dd6cb0ef
@ -13,7 +13,6 @@ go_library(
|
||||
"azure_backoff.go",
|
||||
"azure_blobDiskController.go",
|
||||
"azure_cache.go",
|
||||
"azure_client.go",
|
||||
"azure_config.go",
|
||||
"azure_controller_common.go",
|
||||
"azure_controller_standard.go",
|
||||
|
@ -227,21 +227,21 @@ type Cloud struct {
|
||||
Config
|
||||
Environment azure.Environment
|
||||
|
||||
RoutesClient RoutesClient
|
||||
SubnetsClient SubnetsClient
|
||||
InterfacesClient InterfacesClient
|
||||
RouteTablesClient RouteTablesClient
|
||||
LoadBalancerClient LoadBalancersClient
|
||||
PublicIPAddressesClient PublicIPAddressesClient
|
||||
SecurityGroupsClient SecurityGroupsClient
|
||||
VirtualMachinesClient VirtualMachinesClient
|
||||
StorageAccountClient StorageAccountClient
|
||||
DisksClient DisksClient
|
||||
SnapshotsClient SnapshotsClient
|
||||
RoutesClient routeclient.Interface
|
||||
SubnetsClient subnetclient.Interface
|
||||
InterfacesClient interfaceclient.Interface
|
||||
RouteTablesClient routetableclient.Interface
|
||||
LoadBalancerClient loadbalancerclient.Interface
|
||||
PublicIPAddressesClient publicipclient.Interface
|
||||
SecurityGroupsClient securitygroupclient.Interface
|
||||
VirtualMachinesClient vmclient.Interface
|
||||
StorageAccountClient storageaccountclient.Interface
|
||||
DisksClient diskclient.Interface
|
||||
SnapshotsClient snapshotclient.Interface
|
||||
FileClient FileClient
|
||||
VirtualMachineScaleSetsClient VirtualMachineScaleSetsClient
|
||||
VirtualMachineScaleSetVMsClient VirtualMachineScaleSetVMsClient
|
||||
VirtualMachineSizesClient VirtualMachineSizesClient
|
||||
VirtualMachineScaleSetsClient vmssclient.Interface
|
||||
VirtualMachineScaleSetVMsClient vmssvmclient.Interface
|
||||
VirtualMachineSizesClient vmsizeclient.Interface
|
||||
|
||||
ResourceRequestBackoff wait.Backoff
|
||||
metadata *InstanceMetadataService
|
||||
|
@ -1,142 +0,0 @@
|
||||
// +build !providerless
|
||||
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package azure
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
|
||||
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-06-01/network"
|
||||
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage"
|
||||
|
||||
"k8s.io/legacy-cloud-providers/azure/retry"
|
||||
)
|
||||
|
||||
const (
|
||||
// The version number is taken from "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-06-01/network".
|
||||
azureNetworkAPIVersion = "2019-06-01"
|
||||
virtualMachineScaleSetsDeallocating = "Deallocating"
|
||||
)
|
||||
|
||||
// VirtualMachinesClient defines needed functions for azure compute.VirtualMachinesClient
|
||||
type VirtualMachinesClient interface {
|
||||
CreateOrUpdate(ctx context.Context, resourceGroupName string, VMName string, parameters compute.VirtualMachine, source string) *retry.Error
|
||||
Update(ctx context.Context, resourceGroupName string, VMName string, parameters compute.VirtualMachineUpdate, source string) *retry.Error
|
||||
Get(ctx context.Context, resourceGroupName string, VMName string, expand compute.InstanceViewTypes) (result compute.VirtualMachine, rerr *retry.Error)
|
||||
List(ctx context.Context, resourceGroupName string) (result []compute.VirtualMachine, rerr *retry.Error)
|
||||
}
|
||||
|
||||
// InterfacesClient defines needed functions for azure network.InterfacesClient
|
||||
type InterfacesClient interface {
|
||||
CreateOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters network.Interface) *retry.Error
|
||||
Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, expand string) (result network.Interface, rerr *retry.Error)
|
||||
GetVirtualMachineScaleSetNetworkInterface(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result network.Interface, rerr *retry.Error)
|
||||
}
|
||||
|
||||
// LoadBalancersClient defines needed functions for azure network.LoadBalancersClient
|
||||
type LoadBalancersClient interface {
|
||||
CreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters network.LoadBalancer, etag string) *retry.Error
|
||||
Delete(ctx context.Context, resourceGroupName string, loadBalancerName string) *retry.Error
|
||||
Get(ctx context.Context, resourceGroupName string, loadBalancerName string, expand string) (result network.LoadBalancer, rerr *retry.Error)
|
||||
List(ctx context.Context, resourceGroupName string) (result []network.LoadBalancer, rerr *retry.Error)
|
||||
}
|
||||
|
||||
// PublicIPAddressesClient defines needed functions for azure network.PublicIPAddressesClient
|
||||
type PublicIPAddressesClient interface {
|
||||
CreateOrUpdate(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters network.PublicIPAddress) *retry.Error
|
||||
Delete(ctx context.Context, resourceGroupName string, publicIPAddressName string) *retry.Error
|
||||
Get(ctx context.Context, resourceGroupName string, publicIPAddressName string, expand string) (result network.PublicIPAddress, rerr *retry.Error)
|
||||
GetVirtualMachineScaleSetPublicIPAddress(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, publicIPAddressName string, expand string) (result network.PublicIPAddress, rerr *retry.Error)
|
||||
List(ctx context.Context, resourceGroupName string) (result []network.PublicIPAddress, rerr *retry.Error)
|
||||
}
|
||||
|
||||
// SubnetsClient defines needed functions for azure network.SubnetsClient
|
||||
type SubnetsClient interface {
|
||||
CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters network.Subnet) *retry.Error
|
||||
Delete(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string) *retry.Error
|
||||
Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (result network.Subnet, rerr *retry.Error)
|
||||
List(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result []network.Subnet, rerr *retry.Error)
|
||||
}
|
||||
|
||||
// SecurityGroupsClient defines needed functions for azure network.SecurityGroupsClient
|
||||
type SecurityGroupsClient interface {
|
||||
CreateOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters network.SecurityGroup, etag string) *retry.Error
|
||||
Delete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) *retry.Error
|
||||
Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, expand string) (result network.SecurityGroup, rerr *retry.Error)
|
||||
List(ctx context.Context, resourceGroupName string) (result []network.SecurityGroup, rerr *retry.Error)
|
||||
}
|
||||
|
||||
// VirtualMachineScaleSetsClient defines needed functions for azure compute.VirtualMachineScaleSetsClient
|
||||
type VirtualMachineScaleSetsClient interface {
|
||||
Get(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result compute.VirtualMachineScaleSet, rerr *retry.Error)
|
||||
List(ctx context.Context, resourceGroupName string) (result []compute.VirtualMachineScaleSet, rerr *retry.Error)
|
||||
CreateOrUpdate(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters compute.VirtualMachineScaleSet) *retry.Error
|
||||
}
|
||||
|
||||
// VirtualMachineScaleSetVMsClient defines needed functions for azure compute.VirtualMachineScaleSetVMsClient
|
||||
type VirtualMachineScaleSetVMsClient interface {
|
||||
Get(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, expand compute.InstanceViewTypes) (result compute.VirtualMachineScaleSetVM, rerr *retry.Error)
|
||||
List(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, expand string) (result []compute.VirtualMachineScaleSetVM, rerr *retry.Error)
|
||||
Update(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, parameters compute.VirtualMachineScaleSetVM, source string) *retry.Error
|
||||
}
|
||||
|
||||
// RoutesClient defines needed functions for azure network.RoutesClient
|
||||
type RoutesClient interface {
|
||||
CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, routeParameters network.Route, etag string) *retry.Error
|
||||
Delete(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) *retry.Error
|
||||
}
|
||||
|
||||
// RouteTablesClient defines needed functions for azure network.RouteTablesClient
|
||||
type RouteTablesClient interface {
|
||||
CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, parameters network.RouteTable, etag string) *retry.Error
|
||||
Get(ctx context.Context, resourceGroupName string, routeTableName string, expand string) (result network.RouteTable, rerr *retry.Error)
|
||||
}
|
||||
|
||||
// StorageAccountClient defines needed functions for azure storage.AccountsClient
|
||||
type StorageAccountClient interface {
|
||||
Create(ctx context.Context, resourceGroupName string, accountName string, parameters storage.AccountCreateParameters) *retry.Error
|
||||
Delete(ctx context.Context, resourceGroupName string, accountName string) *retry.Error
|
||||
ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result storage.AccountListKeysResult, rerr *retry.Error)
|
||||
ListByResourceGroup(ctx context.Context, resourceGroupName string) (result []storage.Account, rerr *retry.Error)
|
||||
GetProperties(ctx context.Context, resourceGroupName string, accountName string) (result storage.Account, rerr *retry.Error)
|
||||
}
|
||||
|
||||
// SnapshotsClient defines needed functions for azure compute.SnapshotsClient
|
||||
type SnapshotsClient interface {
|
||||
Get(ctx context.Context, resourceGroupName string, snapshotName string) (compute.Snapshot, *retry.Error)
|
||||
Delete(ctx context.Context, resourceGroupName string, snapshotName string) *retry.Error
|
||||
ListByResourceGroup(ctx context.Context, resourceGroupName string) ([]compute.Snapshot, *retry.Error)
|
||||
CreateOrUpdate(ctx context.Context, resourceGroupName string, snapshotName string, snapshot compute.Snapshot) *retry.Error
|
||||
}
|
||||
|
||||
// DisksClient defines needed functions for azure compute.DisksClient
|
||||
type DisksClient interface {
|
||||
CreateOrUpdate(ctx context.Context, resourceGroupName string, diskName string, diskParameter compute.Disk) *retry.Error
|
||||
Delete(ctx context.Context, resourceGroupName string, diskName string) *retry.Error
|
||||
Get(ctx context.Context, resourceGroupName string, diskName string) (result compute.Disk, rerr *retry.Error)
|
||||
}
|
||||
|
||||
// VirtualMachineSizesClient defines needed functions for azure compute.VirtualMachineSizesClient
|
||||
type VirtualMachineSizesClient interface {
|
||||
List(ctx context.Context, location string) (result compute.VirtualMachineSizeListResult, rerr *retry.Error)
|
||||
}
|
||||
|
||||
func getContextWithCancel() (context.Context, context.CancelFunc) {
|
||||
return context.WithCancel(context.Background())
|
||||
}
|
@ -19,6 +19,7 @@ limitations under the License.
|
||||
package azure
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
)
|
||||
|
||||
@ -69,3 +70,7 @@ func (lm *lockMap) lockEntry(entry string) {
|
||||
func (lm *lockMap) unlockEntry(entry string) {
|
||||
lm.mutexMap[entry].Unlock()
|
||||
}
|
||||
|
||||
func getContextWithCancel() (context.Context, context.CancelFunc) {
|
||||
return context.WithCancel(context.Background())
|
||||
}
|
||||
|
@ -40,6 +40,9 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// virtualMachineScaleSetsDeallocating indicates VMSS instances are in Deallocating state.
|
||||
virtualMachineScaleSetsDeallocating = "Deallocating"
|
||||
|
||||
// ErrorNotVmssInstance indicates an instance is not belongint to any vmss.
|
||||
ErrorNotVmssInstance = errors.New("not a vmss instance")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user