azure

package
v1.14.10 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ServiceAnnotationLoadBalancerInternal is the annotation used on the service
	ServiceAnnotationLoadBalancerInternal = "service.beta.kubernetes.io/azure-load-balancer-internal"

	// ServiceAnnotationLoadBalancerInternalSubnet is the annotation used on the service
	// to specify what subnet it is exposed on
	ServiceAnnotationLoadBalancerInternalSubnet = "service.beta.kubernetes.io/azure-load-balancer-internal-subnet"

	// ServiceAnnotationLoadBalancerMode is the annotation used on the service to specify the
	// Azure load balancer selection based on availability sets
	// There are currently three possible load balancer selection modes :
	// 1. Default mode - service has no annotation ("service.beta.kubernetes.io/azure-load-balancer-mode")
	//	  In this case the Loadbalancer of the primary Availability set is selected
	// 2. "__auto__" mode - service is annotated with __auto__ value, this when loadbalancer from any availability set
	//    is selected which has the minimum rules associated with it.
	// 3. "as1,as2" mode - this is when the load balancer from the specified availability sets is selected that has the
	//    minimum rules associated with it.
	ServiceAnnotationLoadBalancerMode = "service.beta.kubernetes.io/azure-load-balancer-mode"

	// ServiceAnnotationLoadBalancerAutoModeValue is the annotation used on the service to specify the
	// Azure load balancer auto selection from the availability sets
	ServiceAnnotationLoadBalancerAutoModeValue = "__auto__"

	// ServiceAnnotationDNSLabelName is the annotation used on the service
	// to specify the DNS label name for the service.
	ServiceAnnotationDNSLabelName = "service.beta.kubernetes.io/azure-dns-label-name"

	// ServiceAnnotationSharedSecurityRule is the annotation used on the service
	// to specify that the service should be exposed using an Azure security rule
	// that may be shared with other service, trading specificity of rules for an
	// increase in the number of services that can be exposed. This relies on the
	// Azure "augmented security rules" feature.
	ServiceAnnotationSharedSecurityRule = "service.beta.kubernetes.io/azure-shared-securityrule"

	// ServiceAnnotationLoadBalancerResourceGroup is the annotation used on the service
	// to specify the resource group of load balancer objects that are not in the same resource group as the cluster.
	ServiceAnnotationLoadBalancerResourceGroup = "service.beta.kubernetes.io/azure-load-balancer-resource-group"

	// ServiceAnnotationAllowedServiceTag is the annotation used on the service
	// to specify a list of allowed service tags separated by comma
	ServiceAnnotationAllowedServiceTag = "service.beta.kubernetes.io/azure-allowed-service-tags"

	// ServiceAnnotationLoadBalancerIdleTimeout is the annotation used on the service
	// to specify the idle timeout for connections on the load balancer in minutes.
	ServiceAnnotationLoadBalancerIdleTimeout = "service.beta.kubernetes.io/azure-load-balancer-tcp-idle-timeout"

	// ServiceAnnotationLoadBalancerMixedProtocols is the annotation used on the service
	// to create both TCP and UDP protocols when creating load balancer rules.
	ServiceAnnotationLoadBalancerMixedProtocols = "service.beta.kubernetes.io/azure-load-balancer-mixed-protocols"
)
View Source
const (
	// CloudProviderName is the value used for the --cloud-provider flag
	CloudProviderName = "azure"
)
View Source
const (

	// InternalLoadBalancerNameSuffix is load balancer posfix
	InternalLoadBalancerNameSuffix = "-internal"
)

Variables

View Source
var (
	// ErrorNotVmssInstance indicates an instance is not belongint to any vmss.
	ErrorNotVmssInstance = errors.New("not a vmss instance")
)

Functions

func MakeCRC32 added in v1.7.2

func MakeCRC32(str string) string

MakeCRC32 : convert string to CRC32 format

func NewCloud

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

NewCloud returns a Cloud with initialized clients

Types

type BlobDiskController added in v1.7.2

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

BlobDiskController : blob disk controller struct

func (*BlobDiskController) CreateBlobDisk added in v1.7.2

func (c *BlobDiskController) CreateBlobDisk(dataDiskName string, storageAccountType storage.SkuName, sizeGB int) (string, error)

CreateBlobDisk : create a blob disk in a node

func (*BlobDiskController) CreateVolume added in v1.7.2

func (c *BlobDiskController) CreateVolume(blobName, accountName, accountType, location string, requestGB int) (string, string, int, error)

CreateVolume creates a VHD blob in a storage account that has storageType and location using the given storage account. If no storage account is given, search all the storage accounts associated with the resource group and pick one that fits storage type and location.

func (*BlobDiskController) DeleteBlobDisk added in v1.7.2

func (c *BlobDiskController) DeleteBlobDisk(diskURI string) error

DeleteBlobDisk : delete a blob disk from a node

func (*BlobDiskController) DeleteVolume added in v1.7.2

func (c *BlobDiskController) DeleteVolume(diskURI string) error

DeleteVolume deletes a VHD blob

type Cloud

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         *compute.SnapshotsClient
	FileClient              FileClient

	// Clients for vmss.
	VirtualMachineScaleSetsClient   VirtualMachineScaleSetsClient
	VirtualMachineScaleSetVMsClient VirtualMachineScaleSetVMsClient

	// client for vm sizes list
	VirtualMachineSizesClient VirtualMachineSizesClient

	*BlobDiskController
	*ManagedDiskController
	// contains filtered or unexported fields
}

Cloud holds the config and clients

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) AttachDisk

func (c Cloud) AttachDisk(isManagedDisk bool, diskName, diskURI string, nodeName types.NodeName, cachingMode compute.CachingTypes) error

AttachDisk attaches a vhd to vm. The vhd must exist, can be identified by diskName, diskURI.

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 added in v1.7.0

func (az *Cloud) CreateFileShare(shareName, accountName, accountType, accountKind, resourceGroup, location string, requestGiB int) (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 added in v1.14.0

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

CreateOrUpdateInterface invokes az.PublicIPAddressesClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdateLB added in v1.14.0

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

CreateOrUpdateLB invokes az.LoadBalancerClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdatePIP added in v1.14.0

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

CreateOrUpdatePIP invokes az.PublicIPAddressesClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdateRoute added in v1.14.0

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

CreateOrUpdateRoute invokes az.RoutesClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdateRouteTable added in v1.14.0

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

CreateOrUpdateRouteTable invokes az.RouteTablesClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdateSGWithRetry added in v1.6.5

func (az *Cloud) CreateOrUpdateSGWithRetry(service *v1.Service, sg network.SecurityGroup) error

CreateOrUpdateSGWithRetry invokes az.SecurityGroupsClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdateSecurityGroup added in v1.14.0

func (az *Cloud) CreateOrUpdateSecurityGroup(service *v1.Service, sg network.SecurityGroup) error

CreateOrUpdateSecurityGroup invokes az.SecurityGroupsClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdateVMWithRetry added in v1.6.5

func (az *Cloud) CreateOrUpdateVMWithRetry(resourceGroup, vmName string, newVM compute.VirtualMachine) error

CreateOrUpdateVMWithRetry invokes az.VirtualMachinesClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdateVmssWithRetry added in v1.14.7

func (az *Cloud) CreateOrUpdateVmssWithRetry(resourceGroupName string, VMScaleSetName string, parameters compute.VirtualMachineScaleSet) error

CreateOrUpdateVmssWithRetry invokes az.VirtualMachineScaleSetsClient.Update with exponential backoff retry

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 added in v1.7.0

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

DeleteFileShare deletes a file share using storage account name and key

func (*Cloud) DeleteLB added in v1.14.0

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

DeleteLB invokes az.LoadBalancerClient.Delete with exponential backoff retry

func (*Cloud) DeletePublicIP added in v1.14.0

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 added in v1.14.0

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

DeleteRouteWithName invokes az.RoutesClient.CreateOrUpdate with exponential backoff retry

func (Cloud) DetachDisk added in v1.12.9

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

DetachDisk detaches a disk from host. The vhd can be identified by diskName or diskURI.

func (Cloud) DisksAreAttached added in v1.4.6

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 added in v1.14.0

func (az *Cloud) EnsureStorageAccount(accountName, accountType, accountKind, resourceGroup, location, genAccountNamePrefix string) (string, string, error)

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

func (*Cloud) Event added in v1.12.0

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

Event creates a event for the specified object.

func (*Cloud) GetActiveZones added in v1.12.0

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

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

func (*Cloud) GetAzureDiskLabels added in v1.12.0

func (c *Cloud) GetAzureDiskLabels(diskURI string) (map[string]string, error)

GetAzureDiskLabels gets availability zone labels for Azuredisk.

func (Cloud) GetDiskLun

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

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

func (*Cloud) GetIPForMachineWithRetry added in v1.8.0

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

GetIPForMachineWithRetry invokes az.getIPForMachine with exponential backoff retry

func (*Cloud) GetLabelsForVolume added in v1.12.0

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 exists, and if so, what its status is.

func (*Cloud) GetLoadBalancerName added in v1.12.0

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

GetLoadBalancerName returns the LoadBalancer name.

func (*Cloud) GetLocation added in v1.12.0

func (az *Cloud) GetLocation() string

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

func (Cloud) GetNextDiskLun

func (c Cloud) GetNextDiskLun(nodeName types.NodeName) (int32, error)

GetNextDiskLun searches all vhd attachment on the host and find unused lun. Return -1 if all luns are used.

func (*Cloud) GetNodeResourceGroup added in v1.12.0

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

GetNodeResourceGroup gets resource group for given node.

func (*Cloud) GetResourceGroups added in v1.12.0

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

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

func (*Cloud) GetScaleSetWithRetry added in v1.14.7

func (az *Cloud) GetScaleSetWithRetry(service *v1.Service, resourceGroupName, vmssName string) (compute.VirtualMachineScaleSet, error)

GetScaleSetWithRetry gets scale set with exponential backoff retry

func (*Cloud) GetStorageAccesskey added in v1.14.0

func (az *Cloud) GetStorageAccesskey(account, resourceGroup string) (string, error)

GetStorageAccesskey gets the storage account access key

func (*Cloud) GetUnmanagedNodes added in v1.12.0

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 added in v1.6.5

func (az *Cloud) GetVirtualMachineWithRetry(name types.NodeName, crt cacheReadType) (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 added in v1.8.0

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 added in v1.8.0

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 added in v1.12.0

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

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

func (*Cloud) HasClusterID added in v1.8.0

func (az *Cloud) HasClusterID() bool

HasClusterID returns true if the cluster has a clusterID

func (*Cloud) Initialize added in v1.7.0

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

Initialize passes a Kubernetes clientBuilder interface to the cloud provider

func (*Cloud) InstanceExistsByProviderID added in v1.8.0

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) InstanceShutdownByProviderID added in v1.11.0

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 added in v1.7.0

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) IsNodeUnmanaged added in v1.12.0

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 added in v1.12.0

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 added in v1.14.0

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

ListLB invokes az.LoadBalancerClient.List with exponential backoff retry

func (*Cloud) ListPIP added in v1.14.0

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 added in v1.14.0

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

ListVirtualMachines invokes az.VirtualMachinesClient.List with exponential backoff retry

func (*Cloud) ListVirtualMachinesWithRetry added in v1.14.0

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

ListVirtualMachinesWithRetry 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 added in v1.7.0

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) ResizeFileShare added in v1.10.0

func (az *Cloud) ResizeFileShare(accountName, accountKey, 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) SetInformers added in v1.12.0

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

SetInformers sets informers for Azure cloud provider.

func (*Cloud) ShouldNodeExcludedFromLoadBalancer added in v1.12.0

func (az *Cloud) ShouldNodeExcludedFromLoadBalancer(node *v1.Node) bool

ShouldNodeExcludedFromLoadBalancer returns true if node is unmanaged or in external resource group.

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) UpdateVmssVMWithRetry added in v1.10.0

func (az *Cloud) UpdateVmssVMWithRetry(resourceGroupName string, VMScaleSetName string, instanceID string, parameters compute.VirtualMachineScaleSetVM) error

UpdateVmssVMWithRetry invokes az.VirtualMachineScaleSetVMsClient.Update with exponential backoff retry

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 ComputeMetadata added in v1.10.10

type ComputeMetadata struct {
	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"`
	UpdateDomain   string `json:"platformUpdateDomain,omitempty"`
	ResourceGroup  string `json:"resourceGroupName,omitempty"`
	VMScaleSetName string `json:"vmScaleSetName,omitempty"`
}

ComputeMetadata represents compute information

type Config

type Config struct {
	auth.AzureAuthConfig

	// The name of the resource group that the cluster is deployed in
	ResourceGroup string `json:"resourceGroup" yaml:"resourceGroup"`
	// The location of the resource group that the cluster is deployed in
	Location string `json:"location" yaml:"location"`
	// The name of the VNet that the cluster is deployed in
	VnetName string `json:"vnetName" yaml:"vnetName"`
	// The name of the resource group that the Vnet is deployed in
	VnetResourceGroup string `json:"vnetResourceGroup" yaml:"vnetResourceGroup"`
	// The name of the subnet that the cluster is deployed in
	SubnetName string `json:"subnetName" yaml:"subnetName"`
	// The name of the security group attached to the cluster's subnet
	SecurityGroupName string `json:"securityGroupName" yaml:"securityGroupName"`
	// (Optional in 1.6) The name of the route table attached to the subnet that the cluster is deployed in
	RouteTableName string `json:"routeTableName" yaml:"routeTableName"`
	// (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" yaml:"primaryAvailabilitySetName"`
	// The type of azure nodes. Candidate values are: vmss and standard.
	// If not set, it will be default to standard.
	VMType string `json:"vmType" yaml:"vmType"`
	// 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" yaml:"primaryScaleSetName"`
	// Enable exponential backoff to manage resource request retries
	CloudProviderBackoff bool `json:"cloudProviderBackoff" yaml:"cloudProviderBackoff"`
	// Backoff retry limit
	CloudProviderBackoffRetries int `json:"cloudProviderBackoffRetries" yaml:"cloudProviderBackoffRetries"`
	// Backoff exponent
	CloudProviderBackoffExponent float64 `json:"cloudProviderBackoffExponent" yaml:"cloudProviderBackoffExponent"`
	// Backoff duration
	CloudProviderBackoffDuration int `json:"cloudProviderBackoffDuration" yaml:"cloudProviderBackoffDuration"`
	// Backoff jitter
	CloudProviderBackoffJitter float64 `json:"cloudProviderBackoffJitter" yaml:"cloudProviderBackoffJitter"`
	// Backoff mode, options are v2 and default.
	// * default means two-layer backoff retrying, one in the cloud provider and the other in the Azure SDK.
	// * v2 means only backoff in the Azure SDK is used. In such mode, CloudProviderBackoffDuration and
	//   CloudProviderBackoffJitter are omitted.
	// "default" will be used if not specified.
	CloudProviderBackoffMode string `json:"cloudProviderBackoffMode" yaml:"cloudProviderBackoffMode"`
	// Enable rate limiting
	CloudProviderRateLimit bool `json:"cloudProviderRateLimit" yaml:"cloudProviderRateLimit"`
	// Rate limit QPS (Read)
	CloudProviderRateLimitQPS float32 `json:"cloudProviderRateLimitQPS" yaml:"cloudProviderRateLimitQPS"`
	// Rate limit Bucket Size
	CloudProviderRateLimitBucket int `json:"cloudProviderRateLimitBucket" yaml:"cloudProviderRateLimitBucket"`
	// Rate limit QPS (Write)
	CloudProviderRateLimitQPSWrite float32 `json:"cloudProviderRateLimitQPSWrite" yaml:"cloudProviderRateLimitQPSWrite"`
	// Rate limit Bucket Size
	CloudProviderRateLimitBucketWrite int `json:"cloudProviderRateLimitBucketWrite" yaml:"cloudProviderRateLimitBucketWrite"`

	// Use instance metadata service where possible
	UseInstanceMetadata bool `json:"useInstanceMetadata" yaml:"useInstanceMetadata"`

	// 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" yaml:"loadBalancerSku"`
	// ExcludeMasterFromStandardLB excludes master nodes from standard load balancer.
	// If not set, it will be default to true.
	ExcludeMasterFromStandardLB *bool `json:"excludeMasterFromStandardLB" yaml:"excludeMasterFromStandardLB"`
	// 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" yaml:"disableOutboundSNAT"`

	// Maximum allowed LoadBalancer Rule Count is the limit enforced by Azure Load balancer
	MaximumLoadBalancerRuleCount int `json:"maximumLoadBalancerRuleCount" yaml:"maximumLoadBalancerRuleCount"`
}

Config holds the configuration parsed from the --cloud-config flag All fields are required unless otherwise specified

type DisksClient added in v1.10.0

type DisksClient interface {
	CreateOrUpdate(ctx context.Context, resourceGroupName string, diskName string, diskParameter compute.Disk) (resp *http.Response, err error)
	Delete(ctx context.Context, resourceGroupName string, diskName string) (resp *http.Response, err error)
	Get(ctx context.Context, resourceGroupName string, diskName string) (result compute.Disk, err error)
}

DisksClient defines needed functions for azure compute.DisksClient

type FileClient added in v1.10.0

type FileClient interface {
	// contains filtered or unexported methods
}

FileClient is the interface for creating file shares, interface for test injection.

type IPAddress added in v1.8.0

type IPAddress struct {
	PrivateIP string `json:"privateIPAddress"`
	PublicIP  string `json:"publicIPAddress"`
}

IPAddress represents IP address information.

type InstanceMetadata added in v1.8.0

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

InstanceMetadata represents instance information.

type InstanceMetadataService added in v1.10.10

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

InstanceMetadataService knows how to query the Azure instance metadata server.

func NewInstanceMetadataService added in v1.10.10

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

NewInstanceMetadataService creates an instance of the InstanceMetadataService accessor object.

func (*InstanceMetadataService) GetMetadata added in v1.10.10

func (ims *InstanceMetadataService) GetMetadata(crt cacheReadType) (*InstanceMetadata, error)

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

type InterfacesClient added in v1.9.0

type InterfacesClient interface {
	CreateOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters network.Interface) (resp *http.Response, err error)
	Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, expand string) (result network.Interface, err error)
	GetVirtualMachineScaleSetNetworkInterface(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result network.Interface, err error)
}

InterfacesClient defines needed functions for azure network.InterfacesClient

type LoadBalancersClient added in v1.9.0

type LoadBalancersClient interface {
	CreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters network.LoadBalancer) (resp *http.Response, err error)
	Delete(ctx context.Context, resourceGroupName string, loadBalancerName string) (resp *http.Response, err error)
	Get(ctx context.Context, resourceGroupName string, loadBalancerName string, expand string) (result network.LoadBalancer, err error)
	List(ctx context.Context, resourceGroupName string) (result []network.LoadBalancer, err error)
}

LoadBalancersClient defines needed functions for azure network.LoadBalancersClient

type ManagedDiskController added in v1.7.2

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

ManagedDiskController : managed disk controller struct

func (*ManagedDiskController) CreateManagedDisk added in v1.7.2

func (c *ManagedDiskController) CreateManagedDisk(options *ManagedDiskOptions) (string, error)

CreateManagedDisk : create managed disk

func (*ManagedDiskController) DeleteManagedDisk added in v1.7.2

func (c *ManagedDiskController) DeleteManagedDisk(diskURI string) error

DeleteManagedDisk : delete managed disk

func (*ManagedDiskController) GetDisk added in v1.14.0

func (c *ManagedDiskController) GetDisk(resourceGroup, diskName string) (string, string, error)

GetDisk return: disk provisionState, diskID, error

func (*ManagedDiskController) ResizeDisk added in v1.11.0

func (c *ManagedDiskController) ResizeDisk(diskURI string, oldSize resource.Quantity, newSize resource.Quantity) (resource.Quantity, error)

ResizeDisk Expand the disk to new size

type ManagedDiskOptions added in v1.12.0

type ManagedDiskOptions struct {
	// The name of the disk.
	DiskName string
	// The size in GB.
	SizeGB int
	// 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
	// The SKU of storage account.
	StorageAccountType compute.DiskStorageAccountTypes
	// IOPS Caps for UltraSSD disk
	DiskIOPSReadWrite string
	// Throughput Cap (MBps) for UltraSSD disk
	DiskMBpsReadWrite string
}

ManagedDiskOptions specifies the options of managed disks.

type NetworkData added in v1.8.0

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

NetworkData contains IP information for a network.

type NetworkInterface added in v1.8.0

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

NetworkInterface represents an instances network interface.

type NetworkMetadata added in v1.8.0

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

NetworkMetadata contains metadata about an instance's network

type PublicIPAddressesClient added in v1.9.0

type PublicIPAddressesClient interface {
	CreateOrUpdate(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters network.PublicIPAddress) (resp *http.Response, err error)
	Delete(ctx context.Context, resourceGroupName string, publicIPAddressName string) (resp *http.Response, err error)
	Get(ctx context.Context, resourceGroupName string, publicIPAddressName string, expand string) (result network.PublicIPAddress, err error)
	GetVirtualMachineScaleSetPublicIPAddress(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, publicIPAddressName string, expand string) (result network.PublicIPAddress, err error)
	List(ctx context.Context, resourceGroupName string) (result []network.PublicIPAddress, err error)
}

PublicIPAddressesClient defines needed functions for azure network.PublicIPAddressesClient

type RouteTablesClient added in v1.10.0

type RouteTablesClient interface {
	CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, parameters network.RouteTable) (resp *http.Response, err error)
	Get(ctx context.Context, resourceGroupName string, routeTableName string, expand string) (result network.RouteTable, err error)
}

RouteTablesClient defines needed functions for azure network.RouteTablesClient

type RoutesClient added in v1.10.0

type RoutesClient interface {
	CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, routeParameters network.Route) (resp *http.Response, err error)
	Delete(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) (resp *http.Response, err error)
}

RoutesClient defines needed functions for azure network.RoutesClient

type SecurityGroupsClient added in v1.9.0

type SecurityGroupsClient interface {
	CreateOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters network.SecurityGroup) (resp *http.Response, err error)
	Delete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (resp *http.Response, err error)
	Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, expand string) (result network.SecurityGroup, err error)
	List(ctx context.Context, resourceGroupName string) (result []network.SecurityGroup, err error)
}

SecurityGroupsClient defines needed functions for azure network.SecurityGroupsClient

type StorageAccountClient added in v1.10.0

type StorageAccountClient interface {
	Create(ctx context.Context, resourceGroupName string, accountName string, parameters storage.AccountCreateParameters) (result *http.Response, err error)
	Delete(ctx context.Context, resourceGroupName string, accountName string) (result autorest.Response, err error)
	ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result storage.AccountListKeysResult, err error)
	ListByResourceGroup(ctx context.Context, resourceGroupName string) (result storage.AccountListResult, err error)
	GetProperties(ctx context.Context, resourceGroupName string, accountName string) (result storage.Account, err error)
}

StorageAccountClient defines needed functions for azure storage.AccountsClient

type Subnet added in v1.8.0

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

Subnet represents subnet information.

type SubnetsClient added in v1.9.0

type SubnetsClient interface {
	CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters network.Subnet) (resp *http.Response, err error)
	Delete(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string) (resp *http.Response, err error)
	Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (result network.Subnet, err error)
	List(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result []network.Subnet, err error)
}

SubnetsClient defines needed functions for azure network.SubnetsClient

type VMSet added in v1.10.0

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)
	// 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, isInternal bool) 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, isInternal bool) error
	// EnsureBackendPoolDeleted ensures the loadBalancer backendAddressPools deleted from the specified nodes.
	EnsureBackendPoolDeleted(service *v1.Service, backendPoolID, vmSetName string, backendAddressPools *[]network.BackendAddressPool) error

	// AttachDisk attaches a vhd to vm. The vhd must exist, can be identified by diskName, diskURI, and lun.
	AttachDisk(isManagedDisk bool, diskName, diskURI string, nodeName types.NodeName, lun int32, cachingMode compute.CachingTypes) error
	// DetachDisk detaches a vhd from host. The vhd can be identified by diskName or diskURI.
	DetachDisk(diskName, diskURI string, nodeName types.NodeName) (*http.Response, error)
	// GetDataDisks gets a list of data disks attached to the node.
	GetDataDisks(nodeName types.NodeName, crt cacheReadType) ([]compute.DataDisk, error)

	// GetPowerStatusByNodeName returns the power state of the specified node.
	GetPowerStatusByNodeName(name string) (string, error)
}

VMSet defines functions all vmsets (including scale set and availability set) should be implemented.

type VirtualMachineScaleSetVMsClient added in v1.10.0

type VirtualMachineScaleSetVMsClient interface {
	Get(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result compute.VirtualMachineScaleSetVM, err error)
	GetInstanceView(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result compute.VirtualMachineScaleSetVMInstanceView, err error)
	List(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (result []compute.VirtualMachineScaleSetVM, err error)
	Update(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string, parameters compute.VirtualMachineScaleSetVM) (resp *http.Response, err error)
}

VirtualMachineScaleSetVMsClient defines needed functions for azure compute.VirtualMachineScaleSetVMsClient

type VirtualMachineScaleSetsClient added in v1.10.0

type VirtualMachineScaleSetsClient interface {
	Get(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result compute.VirtualMachineScaleSet, err error)
	List(ctx context.Context, resourceGroupName string) (result []compute.VirtualMachineScaleSet, err error)
	CreateOrUpdate(ctx context.Context, resourceGroupName string, VMScaleSetName string, parameters compute.VirtualMachineScaleSet) (resp *http.Response, err error)
}

VirtualMachineScaleSetsClient defines needed functions for azure compute.VirtualMachineScaleSetsClient

type VirtualMachineSizesClient added in v1.12.0

type VirtualMachineSizesClient interface {
	List(ctx context.Context, location string) (result compute.VirtualMachineSizeListResult, err error)
}

VirtualMachineSizesClient defines needed functions for azure compute.VirtualMachineSizesClient

type VirtualMachinesClient added in v1.9.0

type VirtualMachinesClient interface {
	CreateOrUpdate(ctx context.Context, resourceGroupName string, VMName string, parameters compute.VirtualMachine) (resp *http.Response, err error)
	Get(ctx context.Context, resourceGroupName string, VMName string, expand compute.InstanceViewTypes) (result compute.VirtualMachine, err error)
	List(ctx context.Context, resourceGroupName string) (result []compute.VirtualMachine, err error)
}

VirtualMachinesClient defines needed functions for azure compute.VirtualMachinesClient

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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