provider

package
v1.25.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2022 License: Apache-2.0 Imports: 103 Imported by: 22

Documentation

Overview

Package provider is an implementation of CloudProvider Interface, LoadBalancer and Instances for Azure.

Index

Constants

View Source
const GroupIDFile = "file"
View Source
const LocationGlobal = "global"
View Source
const PrivateDNSZoneName = "privatelink.file.core.windows.net"
View Source
const SkipMatchingTag = "skip-matching"

SkipMatchingTag skip account matching tag

View Source
const (

	// WriteAcceleratorEnabled support for Azure Write Accelerator on Azure Disks
	// https://docs.microsoft.com/azure/virtual-machines/windows/how-to-enable-write-accelerator
	WriteAcceleratorEnabled = "writeacceleratorenabled"
)

Variables

View Source
var (
	// ErrorNotVmssInstance indicates an instance is not belonging to any vmss.
	ErrorNotVmssInstance = errors.New("not a vmss instance")
)
View Source
var (
	// ErrorVmssIDIsEmpty indicates the vmss id is empty.
	ErrorVmssIDIsEmpty = errors.New("VMSS ID is empty")
)

Functions

func AreVNetRulesEqual added in v1.1.0

func AreVNetRulesEqual(account storage.Account, accountOptions *AccountOptions) bool

func ConvertResourceGroupNameToLower added in v1.25.0

func ConvertResourceGroupNameToLower(resourceID string) (string, error)

ConvertResourceGroupNameToLower converts the resource group name in the resource ID to be lowered.

func InitializeCloudProviderRateLimitConfig

func InitializeCloudProviderRateLimitConfig(config *CloudProviderRateLimitConfig)

InitializeCloudProviderRateLimitConfig initializes rate limit configs.

func MakeCRC32

func MakeCRC32(str string) string

MakeCRC32 : convert string to CRC32 format

func MapRouteNameToNodeName added in v1.0.0

func MapRouteNameToNodeName(ipv6DualStackEnabled bool, routeName string) types.NodeName

MapRouteNameToNodeName is used with mapNodeNameToRouteName. See comment on mapNodeNameToRouteName for detailed usage.

func NewCloud

func NewCloud(configReader io.Reader, callFromCCM bool) (cloudprovider.Interface, error)

NewCloud returns a Cloud with initialized clients

func NewCloudFromConfigFile added in v1.0.1

func NewCloudFromConfigFile(configFilePath string, calFromCCM bool) (cloudprovider.Interface, error)

func NewCloudFromSecret added in v1.0.0

func NewCloudFromSecret(clientBuilder cloudprovider.ControllerClientBuilder, secretName, secretNamespace, cloudConfigKey string) (cloudprovider.Interface, error)

Types

type AccountOptions

type AccountOptions struct {
	SubscriptionID                            string
	Name, Type, Kind, ResourceGroup, Location string
	EnableHTTPSTrafficOnly                    bool
	// indicate whether create new account when Name is empty or when account does not exists
	CreateAccount                           bool
	EnableLargeFileShare                    bool
	CreatePrivateEndpoint                   bool
	DisableFileServiceDeleteRetentionPolicy bool
	IsHnsEnabled                            *bool
	EnableNfsV3                             *bool
	AllowBlobPublicAccess                   *bool
	RequireInfrastructureEncryption         *bool
	AllowSharedKeyAccess                    *bool
	KeyName                                 *string
	KeyVersion                              *string
	KeyVaultURI                             *string
	Tags                                    map[string]string
	VirtualNetworkResourceIDs               []string
	VNetResourceGroup                       string
	VNetName                                string
	SubnetName                              string
	MatchTags                               bool
}

AccountOptions contains the fields which are used to create storage account.

type AttachDiskOptions

type AttachDiskOptions struct {
	// contains filtered or unexported fields
}

AttachDiskOptions attach disk options

type AvailabilitySetEntry added in v1.1.27

type AvailabilitySetEntry struct {
	VMAS          *compute.AvailabilitySet
	ResourceGroup string
}

type AvailabilitySetNodeEntry added in v1.1.27

type AvailabilitySetNodeEntry struct {
	VMNames   sets.String
	NodeNames sets.String
	VMs       []compute.VirtualMachine
}

type BackendPool added in v1.23.0

type BackendPool interface {
	// EnsureHostsInPool ensures the nodes join the backend pool of the load balancer
	EnsureHostsInPool(service *v1.Service, nodes []*v1.Node, backendPoolID, vmSetName, clusterName, lbName string, backendPool network.BackendAddressPool) error

	// CleanupVMSetFromBackendPoolByCondition removes nodes of the unwanted vmSet from the lb backend pool.
	// This is needed in two scenarios:
	// 1. When migrating from single SLB to multiple SLBs, the existing
	// SLB's backend pool contains nodes from different agent pools, while we only want the
	// nodes from the primary agent pool to join the backend pool.
	// 2. When migrating from dedicated SLB to shared SLB (or vice versa), we should move the vmSet from
	// one SLB to another one.
	CleanupVMSetFromBackendPoolByCondition(slb *network.LoadBalancer, service *v1.Service, nodes []*v1.Node, clusterName string, shouldRemoveVMSetFromSLB func(string) bool) (*network.LoadBalancer, error)

	// ReconcileBackendPools creates the inbound backend pool if it is not existed, and removes nodes that are supposed to be
	// excluded from the load balancers.
	ReconcileBackendPools(clusterName string, service *v1.Service, lb *network.LoadBalancer) (bool, bool, error)

	// GetBackendPrivateIPs returns the private IPs of LoadBalancer's backend pool
	GetBackendPrivateIPs(clusterName string, service *v1.Service, lb *network.LoadBalancer) ([]string, []string)
}

type Cloud

type Cloud struct {
	Config
	InitSecretConfig
	Environment azure.Environment

	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.Interface
	BlobClient                      blobclient.Interface
	VirtualMachineScaleSetsClient   vmssclient.Interface
	VirtualMachineScaleSetVMsClient vmssvmclient.Interface
	VirtualMachineSizesClient       vmsizeclient.Interface
	AvailabilitySetsClient          vmasclient.Interface
	ZoneClient                      zoneclient.Interface

	PrivateLinkServiceClient privatelinkserviceclient.Interface

	ResourceRequestBackoff  wait.Backoff
	Metadata                *InstanceMetadataService
	VMSet                   VMSet
	LoadBalancerBackendPool BackendPool

	KubeClient clientset.Interface

	*ManagedDiskController
	// contains filtered or unexported fields
}

Cloud holds the config and clients

func GetTestCloud

func GetTestCloud(ctrl *gomock.Controller) (az *Cloud)

GetTestCloud returns a fake azure cloud for unit tests in Azure related CSI drivers

func GetTestCloudWithExtendedLocation added in v0.7.1

func GetTestCloudWithExtendedLocation(ctrl *gomock.Controller) (az *Cloud)

GetTestCloudWithExtendedLocation returns a fake azure cloud for unit tests in Azure related CSI drivers with extended location.

func NewCloudWithoutFeatureGates

func NewCloudWithoutFeatureGates(configReader io.Reader, callFromCCM bool) (*Cloud, error)

NewCloudWithoutFeatureGates returns a Cloud without trying to wire the feature gates. This is used by the unit tests that don't load the actual features being used in the cluster.

func (*Cloud) AddSSHKeyToAllInstances

func (az *Cloud) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error

AddSSHKeyToAllInstances adds an SSH public key as a legal identity for all instances expected format for the key is standard ssh-keygen format: <protocol> <blob>

func (*Cloud) AddStorageAccountTags added in v0.7.1

func (az *Cloud) AddStorageAccountTags(ctx context.Context, subsID, resourceGroup, account string, tags map[string]*string) *retry.Error

AddStorageAccountTags add tags to storage account

func (Cloud) AttachDisk

func (c Cloud) AttachDisk(ctx context.Context, async bool, diskName, diskURI string, nodeName types.NodeName,
	cachingMode compute.CachingTypes, disk *compute.Disk) (int32, error)

AttachDisk attaches a disk to vm parameter async indicates whether allow multiple batch disk attach on one node in parallel return (lun, error)

func (*Cloud) Clusters

func (az *Cloud) Clusters() (cloudprovider.Clusters, bool)

Clusters returns a clusters interface. Also returns true if the interface is supported, false otherwise.

func (*Cloud) CreateFileShare

func (az *Cloud) CreateFileShare(ctx context.Context, accountOptions *AccountOptions, shareOptions *fileclient.ShareOptions) (string, string, error)

CreateFileShare creates a file share, using a matching storage account type, account kind, etc. storage account will be created if specified account is not found

func (*Cloud) CreateOrUpdateInterface

func (az *Cloud) CreateOrUpdateInterface(service *v1.Service, nic network.Interface) error

CreateOrUpdateInterface invokes az.InterfacesClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdateLB

func (az *Cloud) CreateOrUpdateLB(service *v1.Service, lb network.LoadBalancer) error

CreateOrUpdateLB invokes az.LoadBalancerClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdateLBBackendPool added in v1.23.0

func (az *Cloud) CreateOrUpdateLBBackendPool(lbName string, backendPool network.BackendAddressPool) error

func (*Cloud) CreateOrUpdatePIP

func (az *Cloud) CreateOrUpdatePIP(service *v1.Service, pipResourceGroup string, pip network.PublicIPAddress) error

CreateOrUpdatePIP invokes az.PublicIPAddressesClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdatePLS added in v1.0.19

func (az *Cloud) CreateOrUpdatePLS(service *v1.Service, pls network.PrivateLinkService) error

func (*Cloud) CreateOrUpdateRoute

func (az *Cloud) CreateOrUpdateRoute(route network.Route) error

CreateOrUpdateRoute invokes az.RoutesClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdateRouteTable

func (az *Cloud) CreateOrUpdateRouteTable(routeTable network.RouteTable) error

CreateOrUpdateRouteTable invokes az.RouteTablesClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdateSecurityGroup

func (az *Cloud) CreateOrUpdateSecurityGroup(sg network.SecurityGroup) error

CreateOrUpdateSecurityGroup invokes az.SecurityGroupsClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdateSubnet added in v1.0.19

func (az *Cloud) CreateOrUpdateSubnet(service *v1.Service, subnet network.Subnet) error

CreateOrUpdateSubnet invokes az.SubnetClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdateVMSS

func (az *Cloud) CreateOrUpdateVMSS(resourceGroupName string, VMScaleSetName string, parameters compute.VirtualMachineScaleSet) *retry.Error

CreateOrUpdateVMSS invokes az.VirtualMachineScaleSetsClient.Update().

func (*Cloud) CreateRoute

func (az *Cloud) CreateRoute(ctx context.Context, clusterName string, nameHint string, kubeRoute *cloudprovider.Route) error

CreateRoute creates the described managed route route.Name will be ignored, although the cloud-provider may use nameHint to create a more user-meaningful name.

func (*Cloud) CurrentNodeName

func (az *Cloud) CurrentNodeName(ctx context.Context, hostname string) (types.NodeName, error)

CurrentNodeName returns the name of the node we are currently running on. On Azure this is the hostname, so we just return the hostname.

func (*Cloud) DeleteFileShare

func (az *Cloud) DeleteFileShare(subsID, resourceGroup, accountName, shareName string) error

DeleteFileShare deletes a file share using storage account name and key

func (*Cloud) DeleteLB

func (az *Cloud) DeleteLB(service *v1.Service, lbName string) *retry.Error

DeleteLB invokes az.LoadBalancerClient.Delete with exponential backoff retry

func (*Cloud) DeleteLBBackendPool added in v1.23.4

func (az *Cloud) DeleteLBBackendPool(lbName, backendPoolName string) error

func (*Cloud) DeletePEConn added in v1.0.19

func (az *Cloud) DeletePEConn(service *v1.Service, plsName string, peConnName string) *retry.Error

DeletePEConn invokes az.PrivateLinkServiceClient.DeletePEConnection with exponential backoff retry

func (*Cloud) DeletePLS added in v1.0.19

func (az *Cloud) DeletePLS(service *v1.Service, plsName string, plsLBFrontendID string) *retry.Error

DeletePLS invokes az.PrivateLinkServiceClient.Delete with exponential backoff retry

func (*Cloud) DeletePublicIP

func (az *Cloud) DeletePublicIP(service *v1.Service, pipResourceGroup string, pipName string) error

DeletePublicIP invokes az.PublicIPAddressesClient.Delete with exponential backoff retry

func (*Cloud) DeleteRoute

func (az *Cloud) DeleteRoute(ctx context.Context, clusterName string, kubeRoute *cloudprovider.Route) error

DeleteRoute deletes the specified managed route Route should be as returned by ListRoutes

func (*Cloud) DeleteRouteWithName

func (az *Cloud) DeleteRouteWithName(routeName string) error

DeleteRouteWithName invokes az.RoutesClient.CreateOrUpdate with exponential backoff retry

func (Cloud) DetachDisk

func (c Cloud) DetachDisk(ctx context.Context, diskName, diskURI string, nodeName types.NodeName) error

DetachDisk detaches a disk from VM

func (Cloud) DisksAreAttached

func (c Cloud) DisksAreAttached(diskNames []string, nodeName types.NodeName) (map[string]bool, error)

DisksAreAttached checks if a list of volumes are attached to the node with the specified NodeName.

func (*Cloud) EnsureLoadBalancer

func (az *Cloud) EnsureLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error)

EnsureLoadBalancer creates a new load balancer 'name', or updates the existing one. Returns the status of the balancer

func (*Cloud) EnsureLoadBalancerDeleted

func (az *Cloud) EnsureLoadBalancerDeleted(ctx context.Context, clusterName string, service *v1.Service) error

EnsureLoadBalancerDeleted deletes the specified load balancer if it exists, returning nil if the load balancer specified either didn't exist or was successfully deleted. This construction is useful because many cloud providers' load balancers have multiple underlying components, meaning a Get could say that the LB doesn't exist even if some part of it is still laying around.

func (*Cloud) EnsureStorageAccount

func (az *Cloud) EnsureStorageAccount(ctx context.Context, accountOptions *AccountOptions, genAccountNamePrefix string) (string, string, error)

EnsureStorageAccount search storage account, create one storage account(with genAccountNamePrefix) if not found, return accountName, accountKey

func (*Cloud) Event

func (az *Cloud) Event(obj runtime.Object, eventType, reason, message string)

Event creates a event for the specified object.

func (*Cloud) GetActiveZones

func (az *Cloud) GetActiveZones() (sets.String, error)

GetActiveZones returns all the zones in which k8s nodes are currently running.

func (*Cloud) GetAzureDiskLabels

func (c *Cloud) GetAzureDiskLabels(ctx context.Context, diskURI string) (map[string]string, error)

GetAzureDiskLabels gets availability zone labels for Azuredisk.

func (*Cloud) GetConfigFromSecret added in v1.1.1

func (az *Cloud) GetConfigFromSecret() (*Config, error)

func (Cloud) GetDiskLun

func (c Cloud) GetDiskLun(diskName, diskURI string, nodeName types.NodeName) (int32, *string, error)

GetDiskLun finds the lun on the host that the vhd is attached to, given a vhd's diskName and diskURI.

func (*Cloud) GetFileShare

func (az *Cloud) GetFileShare(subsID, resourceGroupName, accountName, name string) (storage.FileShare, error)

GetFileShare gets a file share

func (*Cloud) GetIPForMachineWithRetry

func (az *Cloud) GetIPForMachineWithRetry(name types.NodeName) (string, string, error)

GetIPForMachineWithRetry invokes az.getIPForMachine with exponential backoff retry

func (*Cloud) GetLabelsForVolume

func (c *Cloud) GetLabelsForVolume(ctx context.Context, pv *v1.PersistentVolume) (map[string]string, error)

GetLabelsForVolume implements PVLabeler.GetLabelsForVolume

func (*Cloud) GetLoadBalancer

func (az *Cloud) GetLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (status *v1.LoadBalancerStatus, exists bool, err error)

GetLoadBalancer returns whether the specified load balancer and its components exist, and if so, what its status is.

func (*Cloud) GetLoadBalancerName

func (az *Cloud) GetLoadBalancerName(ctx context.Context, clusterName string, service *v1.Service) string

GetLoadBalancerName returns the LoadBalancer name.

func (*Cloud) GetLocation

func (az *Cloud) GetLocation() string

GetLocation returns the location in which k8s cluster is currently running.

func (*Cloud) GetNodeNames added in v0.7.3

func (az *Cloud) GetNodeNames() (sets.String, error)

GetNodeNames returns a set of all node names in the k8s cluster.

func (*Cloud) GetNodeResourceGroup

func (az *Cloud) GetNodeResourceGroup(nodeName string) (string, error)

GetNodeResourceGroup gets resource group for given node.

func (*Cloud) GetPlatformSubFaultDomain added in v0.7.13

func (az *Cloud) GetPlatformSubFaultDomain() (string, error)

GetPlatformSubFaultDomain returns the PlatformSubFaultDomain from IMDS if set.

func (*Cloud) GetResourceGroups

func (az *Cloud) GetResourceGroups() (sets.String, error)

GetResourceGroups returns a set of resource groups that all nodes are running on.

func (*Cloud) GetStorageAccesskey

func (az *Cloud) GetStorageAccesskey(ctx context.Context, subsID, account, resourceGroup string) (string, error)

GetStorageAccesskey gets the storage account access key

func (*Cloud) GetUnmanagedNodes

func (az *Cloud) GetUnmanagedNodes() (sets.String, error)

GetUnmanagedNodes returns a list of nodes not managed by Azure cloud provider (e.g. on-prem nodes).

func (*Cloud) GetVirtualMachineWithRetry

func (az *Cloud) GetVirtualMachineWithRetry(name types.NodeName, crt azcache.AzureCacheReadType) (compute.VirtualMachine, error)

GetVirtualMachineWithRetry invokes az.getVirtualMachine with exponential backoff retry

func (*Cloud) GetZone

func (az *Cloud) GetZone(ctx context.Context) (cloudprovider.Zone, error)

GetZone returns the Zone containing the current availability zone and locality region that the program is running in. If the node is not running with availability zones, then it will fall back to fault domain.

func (*Cloud) GetZoneByNodeName

func (az *Cloud) GetZoneByNodeName(ctx context.Context, nodeName types.NodeName) (cloudprovider.Zone, error)

GetZoneByNodeName implements Zones.GetZoneByNodeName This is particularly useful in external cloud providers where the kubelet does not initialize node data.

func (*Cloud) GetZoneByProviderID

func (az *Cloud) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error)

GetZoneByProviderID implements Zones.GetZoneByProviderID This is particularly useful in external cloud providers where the kubelet does not initialize node data.

func (*Cloud) GetZoneID

func (az *Cloud) GetZoneID(zoneLabel string) string

GetZoneID returns the ID of zone from node's zone label.

func (*Cloud) HasClusterID

func (az *Cloud) HasClusterID() bool

HasClusterID returns true if the cluster has a clusterID

func (*Cloud) Initialize

func (az *Cloud) Initialize(clientBuilder cloudprovider.ControllerClientBuilder, stop <-chan struct{})

Initialize passes a Kubernetes clientBuilder interface to the cloud provider

func (*Cloud) InitializeCloudFromConfig

func (az *Cloud) InitializeCloudFromConfig(config *Config, fromSecret, callFromCCM bool) error

InitializeCloudFromConfig initializes the Cloud from config.

func (*Cloud) InitializeCloudFromSecret

func (az *Cloud) InitializeCloudFromSecret() error

InitializeCloudFromSecret initializes Azure cloud provider from Kubernetes secret.

func (*Cloud) InstanceExists added in v0.7.1

func (az *Cloud) InstanceExists(ctx context.Context, node *v1.Node) (bool, error)

InstanceExists returns true if the instance for the given node exists according to the cloud provider. Use the node.name or node.spec.providerID field to find the node in the cloud provider.

func (*Cloud) InstanceExistsByProviderID

func (az *Cloud) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error)

InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running. If false is returned with no error, the instance will be immediately deleted by the cloud controller manager.

func (*Cloud) InstanceID

func (az *Cloud) InstanceID(ctx context.Context, name types.NodeName) (string, error)

InstanceID returns the cloud provider ID of the specified instance. Note that if the instance does not exist or is no longer running, we must return ("", cloudprovider.InstanceNotFound)

func (*Cloud) InstanceMetadata added in v0.7.1

func (az *Cloud) InstanceMetadata(ctx context.Context, node *v1.Node) (*cloudprovider.InstanceMetadata, error)

InstanceMetadata returns the instance's metadata. The values returned in InstanceMetadata are translated into specific fields in the Node object on registration. Use the node.name or node.spec.providerID field to find the node in the cloud provider.

func (*Cloud) InstanceShutdown added in v0.7.1

func (az *Cloud) InstanceShutdown(ctx context.Context, node *v1.Node) (bool, error)

InstanceShutdown returns true if the instance is shutdown according to the cloud provider. Use the node.name or node.spec.providerID field to find the node in the cloud provider.

func (*Cloud) InstanceShutdownByProviderID

func (az *Cloud) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error)

InstanceShutdownByProviderID returns true if the instance is in safe state to detach volumes

func (*Cloud) InstanceType

func (az *Cloud) InstanceType(ctx context.Context, name types.NodeName) (string, error)

InstanceType returns the type of the specified instance. Note that if the instance does not exist or is no longer running, we must return ("", cloudprovider.InstanceNotFound) (Implementer Note): This is used by kubelet. Kubelet will label the node. Real log from kubelet: Adding node label from cloud provider: beta.kubernetes.io/instance-type=[value]

func (*Cloud) InstanceTypeByProviderID

func (az *Cloud) InstanceTypeByProviderID(ctx context.Context, providerID string) (string, error)

InstanceTypeByProviderID returns the cloudprovider instance type of the node with the specified unique providerID This method will not be called from the node that is requesting this ID. i.e. metadata service and other local methods cannot be used here

func (*Cloud) Instances

func (az *Cloud) Instances() (cloudprovider.Instances, bool)

Instances returns an instances interface. Also returns true if the interface is supported, false otherwise.

func (*Cloud) InstancesV2

func (az *Cloud) InstancesV2() (cloudprovider.InstancesV2, bool)

InstancesV2 returns an instancesV2 interface. Also returns true if the interface is supported, false otherwise.

func (*Cloud) IsNodeUnmanaged

func (az *Cloud) IsNodeUnmanaged(nodeName string) (bool, error)

IsNodeUnmanaged returns true if the node is not managed by Azure cloud provider. Those nodes includes on-prem or VMs from other clouds. They will not be added to load balancer backends. Azure routes and managed disks are also not supported for them.

func (*Cloud) IsNodeUnmanagedByProviderID

func (az *Cloud) IsNodeUnmanagedByProviderID(providerID string) bool

IsNodeUnmanagedByProviderID returns true if the node is not managed by Azure cloud provider. All managed node's providerIDs are in format 'azure:///subscriptions/<id>/resourceGroups/<rg>/providers/Microsoft.Compute/.*'

func (*Cloud) ListLB

func (az *Cloud) ListLB(service *v1.Service) ([]network.LoadBalancer, error)

ListLB invokes az.LoadBalancerClient.List with exponential backoff retry

func (*Cloud) ListManagedLBs added in v0.7.9

func (az *Cloud) ListManagedLBs(service *v1.Service, nodes []*v1.Node, clusterName string) ([]network.LoadBalancer, error)

ListManagedLBs invokes az.LoadBalancerClient.List and filter out those that are not managed by cloud provider azure or not associated to a managed VMSet.

func (*Cloud) ListPIP

func (az *Cloud) ListPIP(service *v1.Service, pipResourceGroup string) ([]network.PublicIPAddress, error)

ListPIP list the PIP resources in the given resource group

func (*Cloud) ListRoutes

func (az *Cloud) ListRoutes(ctx context.Context, clusterName string) ([]*cloudprovider.Route, error)

ListRoutes lists all managed routes that belong to the specified clusterName

func (*Cloud) ListVirtualMachines

func (az *Cloud) ListVirtualMachines(resourceGroup string) ([]compute.VirtualMachine, error)

ListVirtualMachines invokes az.VirtualMachinesClient.List with exponential backoff retry

func (*Cloud) LoadBalancer

func (az *Cloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)

LoadBalancer returns a balancer interface. Also returns true if the interface is supported, false otherwise.

func (*Cloud) NodeAddresses

func (az *Cloud) NodeAddresses(ctx context.Context, name types.NodeName) ([]v1.NodeAddress, error)

NodeAddresses returns the addresses of the specified instance.

func (*Cloud) NodeAddressesByProviderID

func (az *Cloud) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error)

NodeAddressesByProviderID returns the node addresses of an instances with the specified unique providerID This method will not be called from the node that is requesting this ID. i.e. metadata service and other local methods cannot be used here

func (*Cloud) ProviderName

func (az *Cloud) ProviderName() string

ProviderName returns the cloud provider ID.

func (*Cloud) RemoveStorageAccountTag added in v0.7.1

func (az *Cloud) RemoveStorageAccountTag(ctx context.Context, subsID, resourceGroup, account, key string) *retry.Error

RemoveStorageAccountTag remove tag from storage account

func (*Cloud) RequestBackoff

func (az *Cloud) RequestBackoff() (resourceRequestBackoff wait.Backoff)

RequestBackoff if backoff is disabled in cloud provider it returns a new Backoff object steps = 1 This is to make sure that the requested command executes at least once

func (*Cloud) ResizeFileShare

func (az *Cloud) ResizeFileShare(subsID, resourceGroup, accountName, name string, sizeGiB int) error

ResizeFileShare resizes a file share

func (*Cloud) Routes

func (az *Cloud) Routes() (cloudprovider.Routes, bool)

Routes returns a routes interface along with whether the interface is supported.

func (Cloud) SetDiskLun

func (c Cloud) SetDiskLun(nodeName types.NodeName, diskURI string, diskMap map[string]*AttachDiskOptions) (int32, error)

SetDiskLun find unused luns and allocate lun for every disk in diskMap. Return lun of diskURI, -1 if all luns are used.

func (*Cloud) SetInformers

func (az *Cloud) SetInformers(informerFactory informers.SharedInformerFactory)

SetInformers sets informers for Azure cloud provider.

func (*Cloud) ShouldNodeExcludedFromLoadBalancer

func (az *Cloud) ShouldNodeExcludedFromLoadBalancer(nodeName string) (bool, error)

ShouldNodeExcludedFromLoadBalancer returns true if node is unmanaged, in external resource group or labeled with "node.kubernetes.io/exclude-from-external-load-balancers".

func (*Cloud) UpdateLoadBalancer

func (az *Cloud) UpdateLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) error

UpdateLoadBalancer updates hosts under the specified load balancer.

func (Cloud) UpdateVM added in v0.7.3

func (c Cloud) UpdateVM(ctx context.Context, nodeName types.NodeName) error

UpdateVM updates a vm

func (*Cloud) Zones

func (az *Cloud) Zones() (cloudprovider.Zones, bool)

Zones returns a zones interface. Also returns true if the interface is supported, false otherwise.

type CloudProviderRateLimitConfig

type CloudProviderRateLimitConfig struct {
	// The default rate limit config options.
	azclients.RateLimitConfig

	// Rate limit config for each clients. Values would override default settings above.
	RouteRateLimit                  *azclients.RateLimitConfig `json:"routeRateLimit,omitempty" yaml:"routeRateLimit,omitempty"`
	SubnetsRateLimit                *azclients.RateLimitConfig `json:"subnetsRateLimit,omitempty" yaml:"subnetsRateLimit,omitempty"`
	InterfaceRateLimit              *azclients.RateLimitConfig `json:"interfaceRateLimit,omitempty" yaml:"interfaceRateLimit,omitempty"`
	RouteTableRateLimit             *azclients.RateLimitConfig `json:"routeTableRateLimit,omitempty" yaml:"routeTableRateLimit,omitempty"`
	LoadBalancerRateLimit           *azclients.RateLimitConfig `json:"loadBalancerRateLimit,omitempty" yaml:"loadBalancerRateLimit,omitempty"`
	PublicIPAddressRateLimit        *azclients.RateLimitConfig `json:"publicIPAddressRateLimit,omitempty" yaml:"publicIPAddressRateLimit,omitempty"`
	SecurityGroupRateLimit          *azclients.RateLimitConfig `json:"securityGroupRateLimit,omitempty" yaml:"securityGroupRateLimit,omitempty"`
	VirtualMachineRateLimit         *azclients.RateLimitConfig `json:"virtualMachineRateLimit,omitempty" yaml:"virtualMachineRateLimit,omitempty"`
	StorageAccountRateLimit         *azclients.RateLimitConfig `json:"storageAccountRateLimit,omitempty" yaml:"storageAccountRateLimit,omitempty"`
	DiskRateLimit                   *azclients.RateLimitConfig `json:"diskRateLimit,omitempty" yaml:"diskRateLimit,omitempty"`
	SnapshotRateLimit               *azclients.RateLimitConfig `json:"snapshotRateLimit,omitempty" yaml:"snapshotRateLimit,omitempty"`
	VirtualMachineScaleSetRateLimit *azclients.RateLimitConfig `json:"virtualMachineScaleSetRateLimit,omitempty" yaml:"virtualMachineScaleSetRateLimit,omitempty"`
	VirtualMachineSizeRateLimit     *azclients.RateLimitConfig `json:"virtualMachineSizesRateLimit,omitempty" yaml:"virtualMachineSizesRateLimit,omitempty"`
	AvailabilitySetRateLimit        *azclients.RateLimitConfig `json:"availabilitySetRateLimit,omitempty" yaml:"availabilitySetRateLimit,omitempty"`
	AttachDetachDiskRateLimit       *azclients.RateLimitConfig `json:"attachDetachDiskRateLimit,omitempty" yaml:"attachDetachDiskRateLimit,omitempty"`
	ContainerServiceRateLimit       *azclients.RateLimitConfig `json:"containerServiceRateLimit,omitempty" yaml:"containerServiceRateLimit,omitempty"`
	DeploymentRateLimit             *azclients.RateLimitConfig `json:"deploymentRateLimit,omitempty" yaml:"deploymentRateLimit,omitempty"`
	PrivateDNSRateLimit             *azclients.RateLimitConfig `json:"privateDNSRateLimit,omitempty" yaml:"privateDNSRateLimit,omitempty"`
	PrivateDNSZoneGroupRateLimit    *azclients.RateLimitConfig `json:"privateDNSZoneGroupRateLimit,omitempty" yaml:"privateDNSZoneGroupRateLimit,omitempty"`
	PrivateEndpointRateLimit        *azclients.RateLimitConfig `json:"privateEndpointRateLimit,omitempty" yaml:"privateEndpointRateLimit,omitempty"`
	PrivateLinkServiceRateLimit     *azclients.RateLimitConfig `json:"privateLinkServiceRateLimit,omitempty" yaml:"privateLinkServiceRateLimit,omitempty"`
	VirtualNetworkRateLimit         *azclients.RateLimitConfig `json:"virtualNetworkRateLimit,omitempty" yaml:"virtualNetworkRateLimit,omitempty"`
}

CloudProviderRateLimitConfig indicates the rate limit config for each clients.

type ComputeMetadata

type ComputeMetadata struct {
	Environment            string `json:"azEnvironment,omitempty"`
	SKU                    string `json:"sku,omitempty"`
	Name                   string `json:"name,omitempty"`
	Zone                   string `json:"zone,omitempty"`
	VMSize                 string `json:"vmSize,omitempty"`
	OSType                 string `json:"osType,omitempty"`
	Location               string `json:"location,omitempty"`
	FaultDomain            string `json:"platformFaultDomain,omitempty"`
	PlatformSubFaultDomain string `json:"platformSubFaultDomain,omitempty"`
	UpdateDomain           string `json:"platformUpdateDomain,omitempty"`
	ResourceGroup          string `json:"resourceGroupName,omitempty"`
	VMScaleSetName         string `json:"vmScaleSetName,omitempty"`
	SubscriptionID         string `json:"subscriptionId,omitempty"`
}

ComputeMetadata represents compute information

type Config

type Config struct {
	auth.AzureAuthConfig
	CloudProviderRateLimitConfig

	// The cloud configure type for Azure cloud provider. Supported values are file, secret and merge.
	CloudConfigType cloudConfigType `json:"cloudConfigType,omitempty" yaml:"cloudConfigType,omitempty"`

	// The name of the resource group that the cluster is deployed in
	ResourceGroup string `json:"resourceGroup,omitempty" yaml:"resourceGroup,omitempty"`
	// The location of the resource group that the cluster is deployed in
	Location string `json:"location,omitempty" yaml:"location,omitempty"`
	// The name of site where the cluster will be deployed to that is more granular than the region specified by the "location" field.
	// Currently only public ip, load balancer and managed disks support this.
	ExtendedLocationName string `json:"extendedLocationName,omitempty" yaml:"extendedLocationName,omitempty"`
	// The type of site that is being targeted.
	// Currently only public ip, load balancer and managed disks support this.
	ExtendedLocationType string `json:"extendedLocationType,omitempty" yaml:"extendedLocationType,omitempty"`
	// The name of the VNet that the cluster is deployed in
	VnetName string `json:"vnetName,omitempty" yaml:"vnetName,omitempty"`
	// The name of the resource group that the Vnet is deployed in
	VnetResourceGroup string `json:"vnetResourceGroup,omitempty" yaml:"vnetResourceGroup,omitempty"`
	// The name of the subnet that the cluster is deployed in
	SubnetName string `json:"subnetName,omitempty" yaml:"subnetName,omitempty"`
	// The name of the security group attached to the cluster's subnet
	SecurityGroupName string `json:"securityGroupName,omitempty" yaml:"securityGroupName,omitempty"`
	// The name of the resource group that the security group is deployed in
	SecurityGroupResourceGroup string `json:"securityGroupResourceGroup,omitempty" yaml:"securityGroupResourceGroup,omitempty"`
	// (Optional in 1.6) The name of the route table attached to the subnet that the cluster is deployed in
	RouteTableName string `json:"routeTableName,omitempty" yaml:"routeTableName,omitempty"`
	// The name of the resource group that the RouteTable is deployed in
	RouteTableResourceGroup string `json:"routeTableResourceGroup,omitempty" yaml:"routeTableResourceGroup,omitempty"`
	// (Optional) The name of the availability set that should be used as the load balancer backend
	// If this is set, the Azure cloudprovider will only add nodes from that availability set to the load
	// balancer backend pool. If this is not set, and multiple agent pools (availability sets) are used, then
	// the cloudprovider will try to add all nodes to a single backend pool which is forbidden.
	// In other words, if you use multiple agent pools (availability sets), you MUST set this field.
	PrimaryAvailabilitySetName string `json:"primaryAvailabilitySetName,omitempty" yaml:"primaryAvailabilitySetName,omitempty"`
	// The type of azure nodes. Candidate values are: vmss and standard.
	// If not set, it will be default to standard.
	VMType string `json:"vmType,omitempty" yaml:"vmType,omitempty"`
	// The name of the scale set that should be used as the load balancer backend.
	// If this is set, the Azure cloudprovider will only add nodes from that scale set to the load
	// balancer backend pool. If this is not set, and multiple agent pools (scale sets) are used, then
	// the cloudprovider will try to add all nodes to a single backend pool which is forbidden.
	// In other words, if you use multiple agent pools (scale sets), you MUST set this field.
	PrimaryScaleSetName string `json:"primaryScaleSetName,omitempty" yaml:"primaryScaleSetName,omitempty"`
	// Tags determines what tags shall be applied to the shared resources managed by controller manager, which
	// includes load balancer, security group and route table. The supported format is `a=b,c=d,...`. After updated
	// this config, the old tags would be replaced by the new ones.
	// Because special characters are not supported in "tags" configuration, "tags" support would be removed in a future release,
	// please consider migrating the config to "tagsMap".
	Tags string `json:"tags,omitempty" yaml:"tags,omitempty"`
	// TagsMap is similar to Tags but holds tags with special characters such as `=` and `,`.
	TagsMap map[string]string `json:"tagsMap,omitempty" yaml:"tagsMap,omitempty"`
	// SystemTags determines the tag keys managed by cloud provider. If it is not set, no tags would be deleted if
	// the `Tags` is changed. However, the old tags would be deleted if they are neither included in `Tags` nor
	// in `SystemTags` after the update of `Tags`.
	SystemTags string `json:"systemTags,omitempty" yaml:"systemTags,omitempty"`
	// Sku of Load Balancer and Public IP. Candidate values are: basic and standard.
	// If not set, it will be default to basic.
	LoadBalancerSku string `json:"loadBalancerSku,omitempty" yaml:"loadBalancerSku,omitempty"`
	// LoadBalancerName determines the specific name of the load balancer user want to use, working with
	// LoadBalancerResourceGroup
	LoadBalancerName string `json:"loadBalancerName,omitempty" yaml:"loadBalancerName,omitempty"`
	// LoadBalancerResourceGroup determines the specific resource group of the load balancer user want to use, working
	// with LoadBalancerName
	LoadBalancerResourceGroup string `json:"loadBalancerResourceGroup,omitempty" yaml:"loadBalancerResourceGroup,omitempty"`
	// PreConfiguredBackendPoolLoadBalancerTypes determines whether the LoadBalancer BackendPool has been preconfigured.
	// Candidate values are:
	//   "": exactly with today (not pre-configured for any LBs)
	//   "internal": for internal LoadBalancer
	//   "external": for external LoadBalancer
	//   "all": for both internal and external LoadBalancer
	PreConfiguredBackendPoolLoadBalancerTypes string `json:"preConfiguredBackendPoolLoadBalancerTypes,omitempty" yaml:"preConfiguredBackendPoolLoadBalancerTypes,omitempty"`

	// DisableAvailabilitySetNodes disables VMAS nodes support when "VMType" is set to "vmss".
	DisableAvailabilitySetNodes bool `json:"disableAvailabilitySetNodes,omitempty" yaml:"disableAvailabilitySetNodes,omitempty"`
	// DisableAzureStackCloud disables AzureStackCloud support. It should be used
	// when setting AzureAuthConfig.Cloud with "AZURESTACKCLOUD" to customize ARM endpoints
	// while the cluster is not running on AzureStack.
	DisableAzureStackCloud bool `json:"disableAzureStackCloud,omitempty" yaml:"disableAzureStackCloud,omitempty"`
	// Enable exponential backoff to manage resource request retries
	CloudProviderBackoff bool `json:"cloudProviderBackoff,omitempty" yaml:"cloudProviderBackoff,omitempty"`
	// Use instance metadata service where possible
	UseInstanceMetadata bool `json:"useInstanceMetadata,omitempty" yaml:"useInstanceMetadata,omitempty"`

	// EnableMultipleStandardLoadBalancers determines the behavior of the standard load balancer. If set to true
	// there would be one standard load balancer per VMAS or VMSS, which is similar with the behavior of the basic
	// load balancer. Users could select the specific standard load balancer for their service by the service
	// annotation `service.beta.kubernetes.io/azure-load-balancer-mode`, If set to false, the same standard load balancer
	// would be shared by all services in the cluster. In this case, the mode selection annotation would be ignored.
	EnableMultipleStandardLoadBalancers bool `json:"enableMultipleStandardLoadBalancers,omitempty" yaml:"enableMultipleStandardLoadBalancers,omitempty"`
	// NodePoolsWithoutDedicatedSLB stores the VMAS/VMSS names that share the primary standard load balancer instead
	// of having a dedicated one. This is useful only when EnableMultipleStandardLoadBalancers is set to true.
	NodePoolsWithoutDedicatedSLB string `json:"nodePoolsWithoutDedicatedSLB,omitempty" yaml:"nodePoolsWithoutDedicatedSLB,omitempty"`

	// Backoff exponent
	CloudProviderBackoffExponent float64 `json:"cloudProviderBackoffExponent,omitempty" yaml:"cloudProviderBackoffExponent,omitempty"`
	// Backoff jitter
	CloudProviderBackoffJitter float64 `json:"cloudProviderBackoffJitter,omitempty" yaml:"cloudProviderBackoffJitter,omitempty"`

	// ExcludeMasterFromStandardLB excludes master nodes from standard load balancer.
	// If not set, it will be default to true.
	ExcludeMasterFromStandardLB *bool `json:"excludeMasterFromStandardLB,omitempty" yaml:"excludeMasterFromStandardLB,omitempty"`
	// DisableOutboundSNAT disables the outbound SNAT for public load balancer rules.
	// It should only be set when loadBalancerSku is standard. If not set, it will be default to false.
	DisableOutboundSNAT *bool `json:"disableOutboundSNAT,omitempty" yaml:"disableOutboundSNAT,omitempty"`

	// Maximum allowed LoadBalancer Rule Count is the limit enforced by Azure Load balancer
	MaximumLoadBalancerRuleCount int `json:"maximumLoadBalancerRuleCount,omitempty" yaml:"maximumLoadBalancerRuleCount,omitempty"`
	// Backoff retry limit
	CloudProviderBackoffRetries int `json:"cloudProviderBackoffRetries,omitempty" yaml:"cloudProviderBackoffRetries,omitempty"`
	// Backoff duration
	CloudProviderBackoffDuration int `json:"cloudProviderBackoffDuration,omitempty" yaml:"cloudProviderBackoffDuration,omitempty"`
	// AvailabilitySetNodesCacheTTLInSeconds sets the Cache TTL for availabilitySetNodesCache
	// if not set, will use default value
	AvailabilitySetNodesCacheTTLInSeconds int `json:"availabilitySetNodesCacheTTLInSeconds,omitempty" yaml:"availabilitySetNodesCacheTTLInSeconds,omitempty"`
	// VmssCacheTTLInSeconds sets the cache TTL for VMSS
	VmssCacheTTLInSeconds int `json:"vmssCacheTTLInSeconds,omitempty" yaml:"vmssCacheTTLInSeconds,omitempty"`
	// VmssVirtualMachinesCacheTTLInSeconds sets the cache TTL for vmssVirtualMachines
	VmssVirtualMachinesCacheTTLInSeconds int `json:"vmssVirtualMachinesCacheTTLInSeconds,omitempty" yaml:"vmssVirtualMachinesCacheTTLInSeconds,omitempty"`

	// VmssFlexCacheTTLInSeconds sets the cache TTL for VMSS Flex
	VmssFlexCacheTTLInSeconds int `json:"vmssFlexCacheTTLInSeconds,omitempty" yaml:"vmssFlexCacheTTLInSeconds,omitempty"`
	// VmssFlexVMCacheTTLInSeconds sets the cache TTL for vmss flex vms
	VmssFlexVMCacheTTLInSeconds int `json:"vmssFlexVMCacheTTLInSeconds,omitempty" yaml:"vmssFlexVMCacheTTLInSeconds,omitempty"`

	// VmCacheTTLInSeconds sets the cache TTL for vm
	VMCacheTTLInSeconds int `json:"vmCacheTTLInSeconds,omitempty" yaml:"vmCacheTTLInSeconds,omitempty"`
	// LoadBalancerCacheTTLInSeconds sets the cache TTL for load balancer
	LoadBalancerCacheTTLInSeconds int `json:"loadBalancerCacheTTLInSeconds,omitempty" yaml:"loadBalancerCacheTTLInSeconds,omitempty"`
	// NsgCacheTTLInSeconds sets the cache TTL for network security group
	NsgCacheTTLInSeconds int `json:"nsgCacheTTLInSeconds,omitempty" yaml:"nsgCacheTTLInSeconds,omitempty"`
	// RouteTableCacheTTLInSeconds sets the cache TTL for route table
	RouteTableCacheTTLInSeconds int `json:"routeTableCacheTTLInSeconds,omitempty" yaml:"routeTableCacheTTLInSeconds,omitempty"`
	// PlsCacheTTLInSeconds sets the cache TTL for private link service resource
	PlsCacheTTLInSeconds int `json:"plsCacheTTLInSeconds,omitempty" yaml:"plsCacheTTLInSeconds,omitempty"`
	// AvailabilitySetsCacheTTLInSeconds sets the cache TTL for VMAS
	AvailabilitySetsCacheTTLInSeconds int `json:"availabilitySetsCacheTTLInSeconds,omitempty" yaml:"availabilitySetsCacheTTLInSeconds,omitempty"`
	// PublicIPCacheTTLInSeconds sets the cache TTL for public ip
	PublicIPCacheTTLInSeconds int `json:"publicIPCacheTTLInSeconds,omitempty" yaml:"publicIPCacheTTLInSeconds,omitempty"`
	// RouteUpdateWaitingInSeconds is the delay time for waiting route updates to take effect. This waiting delay is added
	// because the routes are not taken effect when the async route updating operation returns success. Default is 30 seconds.
	RouteUpdateWaitingInSeconds int `json:"routeUpdateWaitingInSeconds,omitempty" yaml:"routeUpdateWaitingInSeconds,omitempty"`
	// The user agent for Azure customer usage attribution
	UserAgent string `json:"userAgent,omitempty" yaml:"userAgent,omitempty"`
	// LoadBalancerBackendPoolConfigurationType defines how vms join the load balancer backend pools. Supported values
	// are `nodeIPConfiguration`, `nodeIP` and `podIP`.
	// `nodeIPConfiguration`: vm network interfaces will be attached to the inbound backend pool of the load balancer (default);
	// `nodeIP`: vm private IPs will be attached to the inbound backend pool of the load balancer;
	// `podIP`: pod IPs will be attached to the inbound backend pool of the load balancer (not supported yet).
	LoadBalancerBackendPoolConfigurationType string `json:"loadBalancerBackendPoolConfigurationType,omitempty" yaml:"loadBalancerBackendPoolConfigurationType,omitempty"`
	// PutVMSSVMBatchSize defines how many requests the client send concurrently when putting the VMSS VMs.
	// If it is smaller than or equal to zero, the request will be sent one by one in sequence (default).
	PutVMSSVMBatchSize int `json:"putVMSSVMBatchSize" yaml:"putVMSSVMBatchSize"`
	// PrivateLinkServiceResourceGroup determines the specific resource group of the private link services user want to use
	PrivateLinkServiceResourceGroup string `json:"privateLinkServiceResourceGroup,omitempty" yaml:"privateLinkServiceResourceGroup,omitempty"`
}

Config holds the configuration parsed from the --cloud-config flag All fields are required unless otherwise specified NOTE: Cloud config files should follow the same Kubernetes deprecation policy as flags or CLIs. Config fields should not change behavior in incompatible ways and should be deprecated for at least 2 release prior to removing. See https://kubernetes.io/docs/reference/using-api/deprecation-policy/#deprecating-a-flag-or-cli for more details.

func ParseConfig added in v1.1.1

func ParseConfig(configReader io.Reader) (*Config, error)

ParseConfig returns a parsed configuration for an Azure cloudprovider config file

func (*Config) HasExtendedLocation added in v0.7.1

func (config *Config) HasExtendedLocation() bool

HasExtendedLocation returns true if extendedlocation prop are specified.

type ExtendedLocation added in v0.7.3

type ExtendedLocation struct {
	// Name - The name of the extended location.
	Name string `json:"name,omitempty"`
	// Type - The type of the extended location.
	Type string `json:"type,omitempty"`
}

ExtendedLocation contains additional info about the location of resources.

type FlexScaleSet added in v1.25.0

type FlexScaleSet struct {
	*Cloud
	// contains filtered or unexported fields
}

FlexScaleSet implements VMSet interface for Azure Flexible VMSS.

func NewTestFlexScaleSet added in v1.25.0

func NewTestFlexScaleSet(ctrl *gomock.Controller) (*FlexScaleSet, error)

func (*FlexScaleSet) AttachDisk added in v1.25.0

func (fs *FlexScaleSet) AttachDisk(ctx context.Context, nodeName types.NodeName, diskMap map[string]*AttachDiskOptions) (*azure.Future, error)

AttachDisk attaches a disk to vm

func (*FlexScaleSet) DeleteCacheForNode added in v1.25.2

func (fs *FlexScaleSet) DeleteCacheForNode(nodeName string) error

func (*FlexScaleSet) DetachDisk added in v1.25.0

func (fs *FlexScaleSet) DetachDisk(ctx context.Context, nodeName types.NodeName, diskMap map[string]string) error

DetachDisk detaches a disk from VM

func (FlexScaleSet) DisksAreAttached added in v1.25.0

func (c FlexScaleSet) DisksAreAttached(diskNames []string, nodeName types.NodeName) (map[string]bool, error)

DisksAreAttached checks if a list of volumes are attached to the node with the specified NodeName.

func (*FlexScaleSet) EnsureBackendPoolDeleted added in v1.25.0

func (fs *FlexScaleSet) EnsureBackendPoolDeleted(service *v1.Service, backendPoolID, vmSetName string, backendAddressPools *[]network.BackendAddressPool, deleteFromVMSet bool) (bool, error)

EnsureBackendPoolDeleted ensures the loadBalancer backendAddressPools deleted from the specified nodes.

func (*FlexScaleSet) EnsureBackendPoolDeletedFromVMSets added in v1.25.0

func (fs *FlexScaleSet) EnsureBackendPoolDeletedFromVMSets(vmssNamesMap map[string]bool, backendPoolID string) error

EnsureBackendPoolDeletedFromVMSets ensures the loadBalancer backendAddressPools deleted from the specified VMSS Flex

func (*FlexScaleSet) EnsureHostInPool added in v1.25.0

func (fs *FlexScaleSet) EnsureHostInPool(service *v1.Service, nodeName types.NodeName, backendPoolID string, vmSetNameOfLB string) (string, string, string, *compute.VirtualMachineScaleSetVM, error)

EnsureHostInPool ensures the given VM's Primary NIC's Primary IP Configuration is participating in the specified LoadBalancer Backend Pool, which returns (resourceGroup, vmasName, instanceID, vmssVM, error).

func (*FlexScaleSet) EnsureHostsInPool added in v1.25.0

func (fs *FlexScaleSet) EnsureHostsInPool(service *v1.Service, nodes []*v1.Node, backendPoolID string, vmSetNameOfLB string) error

EnsureHostsInPool ensures the given Node's primary IP configurations are participating in the specified LoadBalancer Backend Pool.

func (*FlexScaleSet) GetAgentPoolVMSetNames added in v1.25.0

func (fs *FlexScaleSet) GetAgentPoolVMSetNames(nodes []*v1.Node) (*[]string, error)

GetAgentPoolVMSetNames returns all vmSet names according to the nodes

func (*FlexScaleSet) GetDataDisks added in v1.25.0

func (fs *FlexScaleSet) GetDataDisks(nodeName types.NodeName, crt azcache.AzureCacheReadType) ([]compute.DataDisk, *string, error)

GetDataDisks gets a list of data disks attached to the node.

func (FlexScaleSet) GetDiskLun added in v1.25.0

func (c FlexScaleSet) GetDiskLun(diskName, diskURI string, nodeName types.NodeName) (int32, *string, error)

GetDiskLun finds the lun on the host that the vhd is attached to, given a vhd's diskName and diskURI.

func (*FlexScaleSet) GetIPByNodeName added in v1.25.0

func (fs *FlexScaleSet) GetIPByNodeName(name string) (string, string, error)

GetIPByNodeName gets machine private IP and public IP by node name.

func (*FlexScaleSet) GetInstanceIDByNodeName added in v1.25.0

func (fs *FlexScaleSet) GetInstanceIDByNodeName(name string) (string, error)

GetInstanceIDByNodeName gets the cloud provider ID by node name. It must return ("", cloudprovider.InstanceNotFound) if the instance does not exist or is no longer running.

func (*FlexScaleSet) GetInstanceTypeByNodeName added in v1.25.0

func (fs *FlexScaleSet) GetInstanceTypeByNodeName(name string) (string, error)

GetInstanceTypeByNodeName gets the instance type by node name.

func (*FlexScaleSet) GetNodeCIDRMasksByProviderID added in v1.25.0

func (fs *FlexScaleSet) GetNodeCIDRMasksByProviderID(providerID string) (int, int, error)

GetNodeCIDRMaskByProviderID returns the node CIDR subnet mask by provider ID.

func (*FlexScaleSet) GetNodeNameByIPConfigurationID added in v1.25.0

func (fs *FlexScaleSet) GetNodeNameByIPConfigurationID(ipConfigurationID string) (string, string, error)

GetNodeNameByIPConfigurationID gets the nodeName and vmSetName by IP configuration ID.

func (*FlexScaleSet) GetNodeNameByProviderID added in v1.25.0

func (fs *FlexScaleSet) GetNodeNameByProviderID(providerID string) (types.NodeName, error)

GetNodeNameByProviderID gets the node name by provider ID. providerID example: azure:///subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/flexprofile-mp-0_df53ee36 Different from vmas where vm name is always equal to nodeName, we need to further map vmName to actual nodeName in vmssflex. Note: nodeName is always equal to strings.ToLower(*vm.OsProfile.ComputerName)

func (*FlexScaleSet) GetNodeVMSetName added in v1.25.0

func (fs *FlexScaleSet) GetNodeVMSetName(node *v1.Node) (string, error)

GetNodeVMSetName returns the availability set or vmss name by the node name. It will return empty string when using standalone vms.

func (*FlexScaleSet) GetPowerStatusByNodeName added in v1.25.0

func (fs *FlexScaleSet) GetPowerStatusByNodeName(name string) (powerState string, err error)

GetPowerStatusByNodeName returns the powerState for the specified node.

func (*FlexScaleSet) GetPrimaryInterface added in v1.25.0

func (fs *FlexScaleSet) GetPrimaryInterface(nodeName string) (network.Interface, error)

GetPrimaryInterface gets machine primary network interface by node name.

func (*FlexScaleSet) GetPrimaryVMSetName added in v1.25.0

func (fs *FlexScaleSet) GetPrimaryVMSetName() string

GetPrimaryVMSetName returns the VM set name depending on the configured vmType. It returns config.PrimaryScaleSetName for vmss and config.PrimaryAvailabilitySetName for standard vmType.

func (*FlexScaleSet) GetPrivateIPsByNodeName added in v1.25.0

func (fs *FlexScaleSet) GetPrivateIPsByNodeName(name string) ([]string, error)

GetPrivateIPsByNodeName returns a slice of all private ips assigned to node (ipv6 and ipv4) TODO (khenidak): This should read all nics, not just the primary allowing users to split ipv4/v6 on multiple nics

func (*FlexScaleSet) GetProvisioningStateByNodeName added in v1.25.0

func (fs *FlexScaleSet) GetProvisioningStateByNodeName(name string) (provisioningState string, err error)

GetProvisioningStateByNodeName returns the provisioningState for the specified node.

func (*FlexScaleSet) GetVMSetNames added in v1.25.0

func (fs *FlexScaleSet) GetVMSetNames(service *v1.Service, nodes []*v1.Node) (*[]string, error)

GetVMSetNames selects all possible availability sets or scale sets (depending vmType configured) for service load balancer, if the service has no loadbalancer mode annotation returns the primary VMSet. If service annotation for loadbalancer exists then returns the eligible VMSet. The mode selection annotation would be ignored when using one SLB per cluster.

func (*FlexScaleSet) GetZoneByNodeName added in v1.25.0

func (fs *FlexScaleSet) GetZoneByNodeName(name string) (cloudprovider.Zone, error)

GetZoneByNodeName gets availability zone for the specified node. If the node is not running with availability zone, then it returns fault domain. for details, refer to https://kubernetes-sigs.github.io/cloud-provider-azure/topics/availability-zones/#node-labels

func (FlexScaleSet) SetDiskLun added in v1.25.0

func (c FlexScaleSet) SetDiskLun(nodeName types.NodeName, diskURI string, diskMap map[string]*AttachDiskOptions) (int32, error)

SetDiskLun find unused luns and allocate lun for every disk in diskMap. Return lun of diskURI, -1 if all luns are used.

func (*FlexScaleSet) UpdateVM added in v1.25.0

func (fs *FlexScaleSet) UpdateVM(ctx context.Context, nodeName types.NodeName) error

UpdateVM updates a vm

func (*FlexScaleSet) WaitForUpdateResult added in v1.25.0

func (fs *FlexScaleSet) WaitForUpdateResult(ctx context.Context, future *azure.Future, resourceGroupName, source string) error

WaitForUpdateResult waits for the response of the update request

type IPAddress

type IPAddress struct {
	PrivateIP string `json:"privateIpAddress"`
	PublicIP  string `json:"publicIpAddress"`
}

IPAddress represents IP address information.

type InitSecretConfig added in v1.0.0

type InitSecretConfig struct {
	SecretName      string `json:"secretName,omitempty" yaml:"secretName,omitempty"`
	SecretNamespace string `json:"secretNamespace,omitempty" yaml:"secretNamespace,omitempty"`
	CloudConfigKey  string `json:"cloudConfigKey,omitempty" yaml:"cloudConfigKey,omitempty"`
}

type InstanceMetadata

type InstanceMetadata struct {
	Compute *ComputeMetadata `json:"compute,omitempty"`
	Network *NetworkMetadata `json:"network,omitempty"`
}

InstanceMetadata represents instance information.

type InstanceMetadataService

type InstanceMetadataService struct {
	// contains filtered or unexported fields
}

InstanceMetadataService knows how to query the Azure instance metadata server.

func NewInstanceMetadataService

func NewInstanceMetadataService(imdsServer string) (*InstanceMetadataService, error)

NewInstanceMetadataService creates an instance of the InstanceMetadataService accessor object.

func (*InstanceMetadataService) GetMetadata

GetMetadata gets instance metadata from cache. crt determines if we can get data from stalled cache/need fresh if cache expired.

type LoadBalancerMetadata added in v0.7.3

type LoadBalancerMetadata struct {
	LoadBalancer *LoadbalancerProfile `json:"loadbalancer,omitempty"`
}

LoadBalancerMetadata represents load balancer metadata.

type LoadbalancerProfile added in v0.7.3

type LoadbalancerProfile struct {
	PublicIPAddresses []PublicIPMetadata `json:"publicIpAddresses,omitempty"`
}

LoadbalancerProfile represents load balancer profile in IMDS.

type ManagedDiskController

type ManagedDiskController struct {
	// contains filtered or unexported fields
}

ManagedDiskController : managed disk controller struct

func (*ManagedDiskController) CreateManagedDisk

func (c *ManagedDiskController) CreateManagedDisk(ctx context.Context, options *ManagedDiskOptions) (string, error)

CreateManagedDisk: create managed disk

func (*ManagedDiskController) DeleteManagedDisk

func (c *ManagedDiskController) DeleteManagedDisk(ctx context.Context, diskURI string) error

DeleteManagedDisk : delete managed disk

func (*ManagedDiskController) GetDisk

func (c *ManagedDiskController) GetDisk(ctx context.Context, subsID, resourceGroup, diskName string) (string, string, error)

GetDisk return: disk provisionState, diskID, error

func (*ManagedDiskController) ResizeDisk

func (c *ManagedDiskController) ResizeDisk(ctx context.Context, diskURI string, oldSize resource.Quantity, newSize resource.Quantity, supportOnlineResize bool) (resource.Quantity, error)

ResizeDisk Expand the disk to new size

type ManagedDiskOptions

type ManagedDiskOptions struct {
	// The SKU of storage account.
	StorageAccountType compute.DiskStorageAccountTypes
	// The name of the disk.
	DiskName string
	// The name of PVC.
	PVCName string
	// The name of resource group.
	ResourceGroup string
	// The AvailabilityZone to create the disk.
	AvailabilityZone string
	// The tags of the disk.
	Tags map[string]string
	// IOPS Caps for UltraSSD disk
	DiskIOPSReadWrite string
	// Throughput Cap (MBps) for UltraSSD disk
	DiskMBpsReadWrite string
	// if SourceResourceID is not empty, then it's a disk copy operation(for snapshot)
	SourceResourceID string
	// The type of source
	SourceType string
	// ResourceId of the disk encryption set to use for enabling encryption at rest.
	DiskEncryptionSetID string
	// DiskEncryption type, available values: EncryptionAtRestWithCustomerKey, EncryptionAtRestWithPlatformAndCustomerKeys
	DiskEncryptionType string
	// The size in GB.
	SizeGB int
	// The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can be mounted on multiple VMs at the same time.
	MaxShares int32
	// Logical sector size in bytes for Ultra disks
	LogicalSectorSize int32
	// SkipGetDiskOperation indicates whether skip GetDisk operation(mainly due to throttling)
	SkipGetDiskOperation bool
	// NetworkAccessPolicy - Possible values include: 'AllowAll', 'AllowPrivate', 'DenyAll'
	NetworkAccessPolicy compute.NetworkAccessPolicy
	// DiskAccessID - ARM id of the DiskAccess resource for using private endpoints on disks.
	DiskAccessID *string
	// BurstingEnabled - Set to true to enable bursting beyond the provisioned performance target of the disk.
	BurstingEnabled *bool
	// SubscriptionID - specify a different SubscriptionID
	SubscriptionID string
}

ManagedDiskOptions specifies the options of managed disks.

type MockBackendPool added in v1.23.0

type MockBackendPool struct {
	// contains filtered or unexported fields
}

MockBackendPool is a mock of BackendPool interface

func NewMockBackendPool added in v1.23.0

func NewMockBackendPool(ctrl *gomock.Controller) *MockBackendPool

NewMockBackendPool creates a new mock instance

func (*MockBackendPool) CleanupVMSetFromBackendPoolByCondition added in v1.23.0

func (m *MockBackendPool) CleanupVMSetFromBackendPoolByCondition(slb *network.LoadBalancer, service *v1.Service, nodes []*v1.Node, clusterName string, shouldRemoveVMSetFromSLB func(string) bool) (*network.LoadBalancer, error)

CleanupVMSetFromBackendPoolByCondition mocks base method

func (*MockBackendPool) EXPECT added in v1.23.0

EXPECT returns an object that allows the caller to indicate expected use

func (*MockBackendPool) EnsureHostsInPool added in v1.23.0

func (m *MockBackendPool) EnsureHostsInPool(service *v1.Service, nodes []*v1.Node, backendPoolID, vmSetName, clusterName, lbName string, backendPool network.BackendAddressPool) error

EnsureHostsInPool mocks base method

func (*MockBackendPool) GetBackendPrivateIPs added in v1.23.15

func (m *MockBackendPool) GetBackendPrivateIPs(clusterName string, service *v1.Service, lb *network.LoadBalancer) ([]string, []string)

GetBackendPrivateIPs mocks base method

func (*MockBackendPool) ReconcileBackendPools added in v1.23.0

func (m *MockBackendPool) ReconcileBackendPools(clusterName string, service *v1.Service, lb *network.LoadBalancer) (bool, bool, error)

ReconcileBackendPools mocks base method

type MockBackendPoolMockRecorder added in v1.23.0

type MockBackendPoolMockRecorder struct {
	// contains filtered or unexported fields
}

MockBackendPoolMockRecorder is the mock recorder for MockBackendPool

func (*MockBackendPoolMockRecorder) CleanupVMSetFromBackendPoolByCondition added in v1.23.0

func (mr *MockBackendPoolMockRecorder) CleanupVMSetFromBackendPoolByCondition(slb, service, nodes, clusterName, shouldRemoveVMSetFromSLB interface{}) *gomock.Call

CleanupVMSetFromBackendPoolByCondition indicates an expected call of CleanupVMSetFromBackendPoolByCondition

func (*MockBackendPoolMockRecorder) EnsureHostsInPool added in v1.23.0

func (mr *MockBackendPoolMockRecorder) EnsureHostsInPool(service, nodes, backendPoolID, vmSetName, clusterName, lbName, backendPool interface{}) *gomock.Call

EnsureHostsInPool indicates an expected call of EnsureHostsInPool

func (*MockBackendPoolMockRecorder) GetBackendPrivateIPs added in v1.23.15

func (mr *MockBackendPoolMockRecorder) GetBackendPrivateIPs(clusterName, service, lb interface{}) *gomock.Call

GetBackendPrivateIPs indicates an expected call of GetBackendPrivateIPs

func (*MockBackendPoolMockRecorder) ReconcileBackendPools added in v1.23.0

func (mr *MockBackendPoolMockRecorder) ReconcileBackendPools(clusterName, service, lb interface{}) *gomock.Call

ReconcileBackendPools indicates an expected call of ReconcileBackendPools

type MockVMSet

type MockVMSet struct {
	// contains filtered or unexported fields
}

MockVMSet is a mock of VMSet interface.

func NewMockVMSet

func NewMockVMSet(ctrl *gomock.Controller) *MockVMSet

NewMockVMSet creates a new mock instance.

func (*MockVMSet) AttachDisk

func (m *MockVMSet) AttachDisk(ctx context.Context, nodeName types.NodeName, diskMap map[string]*AttachDiskOptions) (*azure.Future, error)

AttachDisk mocks base method.

func (*MockVMSet) DeleteCacheForNode added in v1.23.21

func (m *MockVMSet) DeleteCacheForNode(nodeName string) error

DeleteCacheForNode mocks base method.

func (*MockVMSet) DetachDisk

func (m *MockVMSet) DetachDisk(ctx context.Context, nodeName types.NodeName, diskMap map[string]string) error

DetachDisk mocks base method.

func (*MockVMSet) EXPECT

func (m *MockVMSet) EXPECT() *MockVMSetMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockVMSet) EnsureBackendPoolDeleted

func (m *MockVMSet) EnsureBackendPoolDeleted(service *v1.Service, backendPoolID, vmSetName string, backendAddressPools *[]network.BackendAddressPool, deleteFromVMSet bool) (bool, error)

EnsureBackendPoolDeleted mocks base method.

func (*MockVMSet) EnsureBackendPoolDeletedFromVMSets added in v0.7.3

func (m *MockVMSet) EnsureBackendPoolDeletedFromVMSets(vmSetNamesMap map[string]bool, backendPoolID string) error

EnsureBackendPoolDeletedFromVMSets mocks base method.

func (*MockVMSet) EnsureHostInPool

func (m *MockVMSet) EnsureHostInPool(service *v1.Service, nodeName types.NodeName, backendPoolID, vmSetName string) (string, string, string, *compute.VirtualMachineScaleSetVM, error)

EnsureHostInPool mocks base method.

func (*MockVMSet) EnsureHostsInPool

func (m *MockVMSet) EnsureHostsInPool(service *v1.Service, nodes []*v1.Node, backendPoolID, vmSetName string) error

EnsureHostsInPool mocks base method.

func (*MockVMSet) GetAgentPoolVMSetNames added in v0.7.3

func (m *MockVMSet) GetAgentPoolVMSetNames(nodes []*v1.Node) (*[]string, error)

GetAgentPoolVMSetNames mocks base method.

func (*MockVMSet) GetDataDisks

func (m *MockVMSet) GetDataDisks(nodeName types.NodeName, crt cache.AzureCacheReadType) ([]compute.DataDisk, *string, error)

GetDataDisks mocks base method.

func (*MockVMSet) GetIPByNodeName

func (m *MockVMSet) GetIPByNodeName(name string) (string, string, error)

GetIPByNodeName mocks base method.

func (*MockVMSet) GetInstanceIDByNodeName

func (m *MockVMSet) GetInstanceIDByNodeName(name string) (string, error)

GetInstanceIDByNodeName mocks base method.

func (*MockVMSet) GetInstanceTypeByNodeName

func (m *MockVMSet) GetInstanceTypeByNodeName(name string) (string, error)

GetInstanceTypeByNodeName mocks base method.

func (*MockVMSet) GetNodeCIDRMasksByProviderID added in v0.7.3

func (m *MockVMSet) GetNodeCIDRMasksByProviderID(providerID string) (int, int, error)

GetNodeCIDRMasksByProviderID mocks base method.

func (*MockVMSet) GetNodeNameByIPConfigurationID

func (m *MockVMSet) GetNodeNameByIPConfigurationID(ipConfigurationID string) (string, string, error)

GetNodeNameByIPConfigurationID mocks base method.

func (*MockVMSet) GetNodeNameByProviderID

func (m *MockVMSet) GetNodeNameByProviderID(providerID string) (types.NodeName, error)

GetNodeNameByProviderID mocks base method.

func (*MockVMSet) GetNodeVMSetName added in v1.23.0

func (m *MockVMSet) GetNodeVMSetName(node *v1.Node) (string, error)

GetNodeVMSetName mocks base method.

func (*MockVMSet) GetPowerStatusByNodeName

func (m *MockVMSet) GetPowerStatusByNodeName(name string) (string, error)

GetPowerStatusByNodeName mocks base method.

func (*MockVMSet) GetPrimaryInterface

func (m *MockVMSet) GetPrimaryInterface(nodeName string) (network.Interface, error)

GetPrimaryInterface mocks base method.

func (*MockVMSet) GetPrimaryVMSetName

func (m *MockVMSet) GetPrimaryVMSetName() string

GetPrimaryVMSetName mocks base method.

func (*MockVMSet) GetPrivateIPsByNodeName

func (m *MockVMSet) GetPrivateIPsByNodeName(name string) ([]string, error)

GetPrivateIPsByNodeName mocks base method.

func (*MockVMSet) GetProvisioningStateByNodeName added in v0.7.7

func (m *MockVMSet) GetProvisioningStateByNodeName(name string) (string, error)

GetProvisioningStateByNodeName mocks base method.

func (*MockVMSet) GetVMSetNames

func (m *MockVMSet) GetVMSetNames(service *v1.Service, nodes []*v1.Node) (*[]string, error)

GetVMSetNames mocks base method.

func (*MockVMSet) GetZoneByNodeName

func (m *MockVMSet) GetZoneByNodeName(name string) (cloud_provider.Zone, error)

GetZoneByNodeName mocks base method.

func (*MockVMSet) UpdateVM added in v0.7.3

func (m *MockVMSet) UpdateVM(ctx context.Context, nodeName types.NodeName) error

UpdateVM mocks base method.

func (*MockVMSet) WaitForUpdateResult added in v1.23.0

func (m *MockVMSet) WaitForUpdateResult(ctx context.Context, future *azure.Future, resourceGroupName, source string) error

WaitForUpdateResult mocks base method.

type MockVMSetMockRecorder

type MockVMSetMockRecorder struct {
	// contains filtered or unexported fields
}

MockVMSetMockRecorder is the mock recorder for MockVMSet.

func (*MockVMSetMockRecorder) AttachDisk

func (mr *MockVMSetMockRecorder) AttachDisk(ctx, nodeName, diskMap interface{}) *gomock.Call

AttachDisk indicates an expected call of AttachDisk.

func (*MockVMSetMockRecorder) DeleteCacheForNode added in v1.23.21

func (mr *MockVMSetMockRecorder) DeleteCacheForNode(nodeName interface{}) *gomock.Call

DeleteCacheForNode indicates an expected call of DeleteCacheForNode.

func (*MockVMSetMockRecorder) DetachDisk

func (mr *MockVMSetMockRecorder) DetachDisk(ctx, nodeName, diskMap interface{}) *gomock.Call

DetachDisk indicates an expected call of DetachDisk.

func (*MockVMSetMockRecorder) EnsureBackendPoolDeleted

func (mr *MockVMSetMockRecorder) EnsureBackendPoolDeleted(service, backendPoolID, vmSetName, backendAddressPools, deleteFromVMSet interface{}) *gomock.Call

EnsureBackendPoolDeleted indicates an expected call of EnsureBackendPoolDeleted.

func (*MockVMSetMockRecorder) EnsureBackendPoolDeletedFromVMSets added in v0.7.3

func (mr *MockVMSetMockRecorder) EnsureBackendPoolDeletedFromVMSets(vmSetNamesMap, backendPoolID interface{}) *gomock.Call

EnsureBackendPoolDeletedFromVMSets indicates an expected call of EnsureBackendPoolDeletedFromVMSets.

func (*MockVMSetMockRecorder) EnsureHostInPool

func (mr *MockVMSetMockRecorder) EnsureHostInPool(service, nodeName, backendPoolID, vmSetName interface{}) *gomock.Call

EnsureHostInPool indicates an expected call of EnsureHostInPool.

func (*MockVMSetMockRecorder) EnsureHostsInPool

func (mr *MockVMSetMockRecorder) EnsureHostsInPool(service, nodes, backendPoolID, vmSetName interface{}) *gomock.Call

EnsureHostsInPool indicates an expected call of EnsureHostsInPool.

func (*MockVMSetMockRecorder) GetAgentPoolVMSetNames added in v0.7.3

func (mr *MockVMSetMockRecorder) GetAgentPoolVMSetNames(nodes interface{}) *gomock.Call

GetAgentPoolVMSetNames indicates an expected call of GetAgentPoolVMSetNames.

func (*MockVMSetMockRecorder) GetDataDisks

func (mr *MockVMSetMockRecorder) GetDataDisks(nodeName, crt interface{}) *gomock.Call

GetDataDisks indicates an expected call of GetDataDisks.

func (*MockVMSetMockRecorder) GetIPByNodeName

func (mr *MockVMSetMockRecorder) GetIPByNodeName(name interface{}) *gomock.Call

GetIPByNodeName indicates an expected call of GetIPByNodeName.

func (*MockVMSetMockRecorder) GetInstanceIDByNodeName

func (mr *MockVMSetMockRecorder) GetInstanceIDByNodeName(name interface{}) *gomock.Call

GetInstanceIDByNodeName indicates an expected call of GetInstanceIDByNodeName.

func (*MockVMSetMockRecorder) GetInstanceTypeByNodeName

func (mr *MockVMSetMockRecorder) GetInstanceTypeByNodeName(name interface{}) *gomock.Call

GetInstanceTypeByNodeName indicates an expected call of GetInstanceTypeByNodeName.

func (*MockVMSetMockRecorder) GetNodeCIDRMasksByProviderID added in v0.7.3

func (mr *MockVMSetMockRecorder) GetNodeCIDRMasksByProviderID(providerID interface{}) *gomock.Call

GetNodeCIDRMasksByProviderID indicates an expected call of GetNodeCIDRMasksByProviderID.

func (*MockVMSetMockRecorder) GetNodeNameByIPConfigurationID

func (mr *MockVMSetMockRecorder) GetNodeNameByIPConfigurationID(ipConfigurationID interface{}) *gomock.Call

GetNodeNameByIPConfigurationID indicates an expected call of GetNodeNameByIPConfigurationID.

func (*MockVMSetMockRecorder) GetNodeNameByProviderID

func (mr *MockVMSetMockRecorder) GetNodeNameByProviderID(providerID interface{}) *gomock.Call

GetNodeNameByProviderID indicates an expected call of GetNodeNameByProviderID.

func (*MockVMSetMockRecorder) GetNodeVMSetName added in v1.23.0

func (mr *MockVMSetMockRecorder) GetNodeVMSetName(node interface{}) *gomock.Call

GetNodeVMSetName indicates an expected call of GetNodeVMSetName.

func (*MockVMSetMockRecorder) GetPowerStatusByNodeName

func (mr *MockVMSetMockRecorder) GetPowerStatusByNodeName(name interface{}) *gomock.Call

GetPowerStatusByNodeName indicates an expected call of GetPowerStatusByNodeName.

func (*MockVMSetMockRecorder) GetPrimaryInterface

func (mr *MockVMSetMockRecorder) GetPrimaryInterface(nodeName interface{}) *gomock.Call

GetPrimaryInterface indicates an expected call of GetPrimaryInterface.

func (*MockVMSetMockRecorder) GetPrimaryVMSetName

func (mr *MockVMSetMockRecorder) GetPrimaryVMSetName() *gomock.Call

GetPrimaryVMSetName indicates an expected call of GetPrimaryVMSetName.

func (*MockVMSetMockRecorder) GetPrivateIPsByNodeName

func (mr *MockVMSetMockRecorder) GetPrivateIPsByNodeName(name interface{}) *gomock.Call

GetPrivateIPsByNodeName indicates an expected call of GetPrivateIPsByNodeName.

func (*MockVMSetMockRecorder) GetProvisioningStateByNodeName added in v0.7.7

func (mr *MockVMSetMockRecorder) GetProvisioningStateByNodeName(name interface{}) *gomock.Call

GetProvisioningStateByNodeName indicates an expected call of GetProvisioningStateByNodeName.

func (*MockVMSetMockRecorder) GetVMSetNames

func (mr *MockVMSetMockRecorder) GetVMSetNames(service, nodes interface{}) *gomock.Call

GetVMSetNames indicates an expected call of GetVMSetNames.

func (*MockVMSetMockRecorder) GetZoneByNodeName

func (mr *MockVMSetMockRecorder) GetZoneByNodeName(name interface{}) *gomock.Call

GetZoneByNodeName indicates an expected call of GetZoneByNodeName.

func (*MockVMSetMockRecorder) UpdateVM added in v0.7.3

func (mr *MockVMSetMockRecorder) UpdateVM(ctx, nodeName interface{}) *gomock.Call

UpdateVM indicates an expected call of UpdateVM.

func (*MockVMSetMockRecorder) WaitForUpdateResult added in v1.23.0

func (mr *MockVMSetMockRecorder) WaitForUpdateResult(ctx, future, resourceGroupName, source interface{}) *gomock.Call

WaitForUpdateResult indicates an expected call of WaitForUpdateResult.

type NetworkData

type NetworkData struct {
	IPAddress []IPAddress `json:"ipAddress"`
	Subnet    []Subnet    `json:"subnet"`
}

NetworkData contains IP information for a network.

type NetworkInterface

type NetworkInterface struct {
	IPV4 NetworkData `json:"ipv4"`
	IPV6 NetworkData `json:"ipv6"`
	MAC  string      `json:"macAddress"`
}

NetworkInterface represents an instances network interface.

type NetworkMetadata

type NetworkMetadata struct {
	Interface []NetworkInterface `json:"interface"`
}

NetworkMetadata contains metadata about an instance's network

type PublicIPMetadata added in v0.7.3

type PublicIPMetadata struct {
	FrontendIPAddress string `json:"frontendIpAddress,omitempty"`
	PrivateIPAddress  string `json:"privateIpAddress,omitempty"`
}

PublicIPMetadata represents the public IP metadata.

type ScaleSet added in v0.7.3

type ScaleSet struct {
	*Cloud
	// contains filtered or unexported fields
}

ScaleSet implements VMSet interface for Azure scale set.

func NewTestScaleSet added in v0.7.3

func NewTestScaleSet(ctrl *gomock.Controller) (*ScaleSet, error)

NewTestScaleSet creates a fake ScaleSet for unit test

func (*ScaleSet) AttachDisk added in v0.7.3

func (ss *ScaleSet) AttachDisk(ctx context.Context, nodeName types.NodeName, diskMap map[string]*AttachDiskOptions) (*azure.Future, error)

AttachDisk attaches a disk to vm

func (*ScaleSet) DeleteCacheForNode added in v1.1.24

func (ss *ScaleSet) DeleteCacheForNode(nodeName string) error

DeleteCacheForNode deletes Node from VMSS VM and VM caches.

func (*ScaleSet) DetachDisk added in v0.7.3

func (ss *ScaleSet) DetachDisk(ctx context.Context, nodeName types.NodeName, diskMap map[string]string) error

DetachDisk detaches a disk from VM

func (ScaleSet) DisksAreAttached added in v0.7.3

func (c ScaleSet) DisksAreAttached(diskNames []string, nodeName types.NodeName) (map[string]bool, error)

DisksAreAttached checks if a list of volumes are attached to the node with the specified NodeName.

func (*ScaleSet) EnsureBackendPoolDeleted added in v0.7.3

func (ss *ScaleSet) EnsureBackendPoolDeleted(service *v1.Service, backendPoolID, vmSetName string, backendAddressPools *[]network.BackendAddressPool, deleteFromVMSet bool) (bool, error)

EnsureBackendPoolDeleted ensures the loadBalancer backendAddressPools deleted from the specified nodes.

func (*ScaleSet) EnsureBackendPoolDeletedFromVMSets added in v0.7.3

func (ss *ScaleSet) EnsureBackendPoolDeletedFromVMSets(vmssNamesMap map[string]bool, backendPoolID string) error

EnsureBackendPoolDeletedFromVMSets ensures the loadBalancer backendAddressPools deleted from the specified VMSS

func (*ScaleSet) EnsureHostInPool added in v0.7.3

func (ss *ScaleSet) EnsureHostInPool(service *v1.Service, nodeName types.NodeName, backendPoolID string, vmSetNameOfLB string) (string, string, string, *compute.VirtualMachineScaleSetVM, error)

EnsureHostInPool ensures the given VM's Primary NIC's Primary IP Configuration is participating in the specified LoadBalancer Backend Pool, which returns (resourceGroup, vmasName, instanceID, vmssVM, error).

func (*ScaleSet) EnsureHostsInPool added in v0.7.3

func (ss *ScaleSet) EnsureHostsInPool(service *v1.Service, nodes []*v1.Node, backendPoolID string, vmSetNameOfLB string) error

EnsureHostsInPool ensures the given Node's primary IP configurations are participating in the specified LoadBalancer Backend Pool.

func (*ScaleSet) GetAgentPoolVMSetNames added in v0.7.3

func (ss *ScaleSet) GetAgentPoolVMSetNames(nodes []*v1.Node) (*[]string, error)

GetAgentPoolVMSetNames returns all VMSS/VMAS names according to the nodes. We need to include the VMAS here because some of the cluster provisioning tools like capz allows mixed instance type.

func (*ScaleSet) GetDataDisks added in v0.7.3

func (ss *ScaleSet) GetDataDisks(nodeName types.NodeName, crt azcache.AzureCacheReadType) ([]compute.DataDisk, *string, error)

GetDataDisks gets a list of data disks attached to the node.

func (ScaleSet) GetDiskLun added in v0.7.3

func (c ScaleSet) GetDiskLun(diskName, diskURI string, nodeName types.NodeName) (int32, *string, error)

GetDiskLun finds the lun on the host that the vhd is attached to, given a vhd's diskName and diskURI.

func (*ScaleSet) GetIPByNodeName added in v0.7.3

func (ss *ScaleSet) GetIPByNodeName(nodeName string) (string, string, error)

GetIPByNodeName gets machine private IP and public IP by node name.

func (*ScaleSet) GetInstanceIDByNodeName added in v0.7.3

func (ss *ScaleSet) GetInstanceIDByNodeName(name string) (string, error)

GetInstanceIDByNodeName gets the cloud provider ID by node name. It must return ("", cloudprovider.InstanceNotFound) if the instance does not exist or is no longer running.

func (*ScaleSet) GetInstanceTypeByNodeName added in v0.7.3

func (ss *ScaleSet) GetInstanceTypeByNodeName(name string) (string, error)

GetInstanceTypeByNodeName gets the instance type by node name.

func (*ScaleSet) GetNodeCIDRMasksByProviderID added in v0.7.3

func (ss *ScaleSet) GetNodeCIDRMasksByProviderID(providerID string) (int, int, error)

GetNodeCIDRMaskByProviderID returns the node CIDR subnet mask by provider ID.

func (*ScaleSet) GetNodeNameByIPConfigurationID added in v0.7.3

func (ss *ScaleSet) GetNodeNameByIPConfigurationID(ipConfigurationID string) (string, string, error)

GetNodeNameByIPConfigurationID gets the node name and the VMSS name by IP configuration ID.

func (*ScaleSet) GetNodeNameByProviderID added in v0.7.3

func (ss *ScaleSet) GetNodeNameByProviderID(providerID string) (types.NodeName, error)

GetNodeNameByProviderID gets the node name by provider ID. providerID example: 1. vmas providerID: azure:///subscriptions/subsid/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/aks-nodepool1-27053986-0 2. vmss providerID: azure:///subscriptions/subsid/resourceGroups/rg/providers/Microsoft.Compute/virtualMachineScaleSets/aks-agentpool-22126781-vmss/virtualMachines/1 /subscriptions/subsid/resourceGroups/rg/providers/Microsoft.Compute/virtualMachineScaleSets/aks-agentpool-22126781-vmss/virtualMachines/k8s-agentpool-36841236-vmss_1

func (*ScaleSet) GetNodeVMSetName added in v1.23.0

func (ss *ScaleSet) GetNodeVMSetName(node *v1.Node) (string, error)

func (*ScaleSet) GetPowerStatusByNodeName added in v0.7.3

func (ss *ScaleSet) GetPowerStatusByNodeName(name string) (powerState string, err error)

GetPowerStatusByNodeName returns the power state of the specified node.

func (*ScaleSet) GetPrimaryInterface added in v0.7.3

func (ss *ScaleSet) GetPrimaryInterface(nodeName string) (network.Interface, error)

GetPrimaryInterface gets machine primary network interface by node name and vmSet.

func (*ScaleSet) GetPrimaryVMSetName added in v0.7.3

func (ss *ScaleSet) GetPrimaryVMSetName() string

GetPrimaryVMSetName returns the VM set name depending on the configured vmType. It returns config.PrimaryScaleSetName for vmss and config.PrimaryAvailabilitySetName for standard vmType.

func (*ScaleSet) GetPrivateIPsByNodeName added in v0.7.3

func (ss *ScaleSet) GetPrivateIPsByNodeName(nodeName string) ([]string, error)

returns a list of private ips assigned to node TODO (khenidak): This should read all nics, not just the primary allowing users to split ipv4/v6 on multiple nics

func (*ScaleSet) GetProvisioningStateByNodeName added in v0.7.7

func (ss *ScaleSet) GetProvisioningStateByNodeName(name string) (provisioningState string, err error)

GetProvisioningStateByNodeName returns the provisioningState for the specified node.

func (*ScaleSet) GetVMSetNames added in v0.7.3

func (ss *ScaleSet) GetVMSetNames(service *v1.Service, nodes []*v1.Node) (*[]string, error)

GetVMSetNames selects all possible scale sets for service load balancer. If the service has no loadbalancer mode annotation returns the primary VMSet. If service annotation for loadbalancer exists then return the eligible VMSet.

func (*ScaleSet) GetZoneByNodeName added in v0.7.3

func (ss *ScaleSet) GetZoneByNodeName(name string) (cloudprovider.Zone, error)

GetZoneByNodeName gets availability zone for the specified node. If the node is not running with availability zone, then it returns fault domain.

func (ScaleSet) SetDiskLun added in v0.7.3

func (c ScaleSet) SetDiskLun(nodeName types.NodeName, diskURI string, diskMap map[string]*AttachDiskOptions) (int32, error)

SetDiskLun find unused luns and allocate lun for every disk in diskMap. Return lun of diskURI, -1 if all luns are used.

func (*ScaleSet) UpdateVM added in v0.7.3

func (ss *ScaleSet) UpdateVM(ctx context.Context, nodeName types.NodeName) error

UpdateVM updates a vm

func (*ScaleSet) VMSSBatchSize added in v1.1.22

func (ss *ScaleSet) VMSSBatchSize(vmssName string) (int, error)

VMSSBatchSize returns the batch size for VMSS operations.

func (*ScaleSet) WaitForUpdateResult added in v1.0.16

func (ss *ScaleSet) WaitForUpdateResult(ctx context.Context, future *azure.Future, resourceGroupName, source string) error

WaitForUpdateResult waits for the response of the update request

type Subnet

type Subnet struct {
	Address string `json:"address"`
	Prefix  string `json:"prefix"`
}

Subnet represents subnet information.

type VMSSEntry added in v1.1.27

type VMSSEntry struct {
	VMSS          *compute.VirtualMachineScaleSet
	ResourceGroup string
	LastUpdate    time.Time
}

type VMSSVirtualMachinesEntry added in v1.1.27

type VMSSVirtualMachinesEntry struct {
	ResourceGroup  string
	VMSSName       string
	InstanceID     string
	VirtualMachine *compute.VirtualMachineScaleSetVM
	LastUpdate     time.Time
}

type VMSet

type VMSet interface {
	// GetInstanceIDByNodeName gets the cloud provider ID by node name.
	// It must return ("", cloudprovider.InstanceNotFound) if the instance does
	// not exist or is no longer running.
	GetInstanceIDByNodeName(name string) (string, error)
	// GetInstanceTypeByNodeName gets the instance type by node name.
	GetInstanceTypeByNodeName(name string) (string, error)
	// GetIPByNodeName gets machine private IP and public IP by node name.
	GetIPByNodeName(name string) (string, string, error)
	// GetPrimaryInterface gets machine primary network interface by node name.
	GetPrimaryInterface(nodeName string) (network.Interface, error)
	// GetNodeNameByProviderID gets the node name by provider ID.
	GetNodeNameByProviderID(providerID string) (types.NodeName, error)

	// GetZoneByNodeName gets cloudprovider.Zone by node name.
	GetZoneByNodeName(name string) (cloudprovider.Zone, error)

	// GetPrimaryVMSetName returns the VM set name depending on the configured vmType.
	// It returns config.PrimaryScaleSetName for vmss and config.PrimaryAvailabilitySetName for standard vmType.
	GetPrimaryVMSetName() string
	// GetVMSetNames selects all possible availability sets or scale sets
	// (depending vmType configured) for service load balancer, if the service has
	// no loadbalancer mode annotation returns the primary VMSet. If service annotation
	// for loadbalancer exists then return the eligible VMSet.
	GetVMSetNames(service *v1.Service, nodes []*v1.Node) (availabilitySetNames *[]string, err error)
	// GetNodeVMSetName returns the availability set or vmss name by the node name.
	// It will return empty string when using standalone vms.
	GetNodeVMSetName(node *v1.Node) (string, error)
	// EnsureHostsInPool ensures the given Node's primary IP configurations are
	// participating in the specified LoadBalancer Backend Pool.
	EnsureHostsInPool(service *v1.Service, nodes []*v1.Node, backendPoolID string, vmSetName string) error
	// EnsureHostInPool ensures the given VM's Primary NIC's Primary IP Configuration is
	// participating in the specified LoadBalancer Backend Pool.
	EnsureHostInPool(service *v1.Service, nodeName types.NodeName, backendPoolID string, vmSetName string) (string, string, string, *compute.VirtualMachineScaleSetVM, error)
	// EnsureBackendPoolDeleted ensures the loadBalancer backendAddressPools deleted from the specified nodes.
	EnsureBackendPoolDeleted(service *v1.Service, backendPoolID, vmSetName string, backendAddressPools *[]network.BackendAddressPool, deleteFromVMSet bool) (bool, error)
	//EnsureBackendPoolDeletedFromVMSets ensures the loadBalancer backendAddressPools deleted from the specified VMSS/VMAS
	EnsureBackendPoolDeletedFromVMSets(vmSetNamesMap map[string]bool, backendPoolID string) error

	// AttachDisk attaches a disk to vm
	AttachDisk(ctx context.Context, nodeName types.NodeName, diskMap map[string]*AttachDiskOptions) (*azure.Future, error)
	// DetachDisk detaches a disk from vm
	DetachDisk(ctx context.Context, nodeName types.NodeName, diskMap map[string]string) error
	// WaitForUpdateResult waits for the response of the update request
	WaitForUpdateResult(ctx context.Context, future *azure.Future, resourceGroupName, source string) error

	// GetDataDisks gets a list of data disks attached to the node.
	GetDataDisks(nodeName types.NodeName, crt azcache.AzureCacheReadType) ([]compute.DataDisk, *string, error)

	// UpdateVM updates a vm
	UpdateVM(ctx context.Context, nodeName types.NodeName) error

	// GetPowerStatusByNodeName returns the powerState for the specified node.
	GetPowerStatusByNodeName(name string) (string, error)

	// GetProvisioningStateByNodeName returns the provisioningState for the specified node.
	GetProvisioningStateByNodeName(name string) (string, error)

	// GetPrivateIPsByNodeName returns a slice of all private ips assigned to node (ipv6 and ipv4)
	GetPrivateIPsByNodeName(name string) ([]string, error)

	// GetNodeNameByIPConfigurationID gets the nodeName and vmSetName by IP configuration ID.
	GetNodeNameByIPConfigurationID(ipConfigurationID string) (string, string, error)

	// GetNodeCIDRMasksByProviderID returns the node CIDR subnet mask by provider ID.
	GetNodeCIDRMasksByProviderID(providerID string) (int, int, error)

	// GetAgentPoolVMSetNames returns all vmSet names according to the nodes
	GetAgentPoolVMSetNames(nodes []*v1.Node) (*[]string, error)

	// DeleteCacheForNode removes the node entry from cache.
	DeleteCacheForNode(nodeName string) error
}

VMSet defines functions all vmsets (including scale set and availability set) should be implemented. Don't forget to run the following command to generate the mock client: mockgen -destination=$GOPATH/src/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_mock_vmsets.go -source=$GOPATH/src/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_vmsets.go -package=provider VMSet

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL