azure

package
v0.0.0-...-112d741 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2017 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CloudProviderName is the value used for the --cloud-provider flag
	CloudProviderName = "azure"
)
View Source
const ServiceAnnotationLoadBalancerInternal = "service.beta.kubernetes.io/azure-load-balancer-internal"

ServiceAnnotationLoadBalancerInternal is the annotation used on the service

Variables

This section is empty.

Functions

func NewCloud

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

NewCloud returns a Cloud with initialized clients

Types

type Cloud

type Cloud struct {
	Config
	Environment             azure.Environment
	RoutesClient            network.RoutesClient
	SubnetsClient           network.SubnetsClient
	InterfacesClient        network.InterfacesClient
	RouteTablesClient       network.RouteTablesClient
	LoadBalancerClient      network.LoadBalancersClient
	PublicIPAddressesClient network.PublicIPAddressesClient
	SecurityGroupsClient    network.SecurityGroupsClient
	VirtualMachinesClient   compute.VirtualMachinesClient
	StorageAccountClient    storage.AccountsClient
	// contains filtered or unexported fields
}

Cloud holds the config and clients

func (*Cloud) AddSSHKeyToAllInstances

func (az *Cloud) AddSSHKeyToAllInstances(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 (az *Cloud) AttachDisk(diskName, diskURI string, nodeName types.NodeName, lun int32, cachingMode compute.CachingTypes) error

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

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(name, storageAccount, storageType, location string, requestGB int) (string, string, error)

CreateFileShare creates a file share, using a matching storage account

func (*Cloud) CreateOrUpdateInterfaceWithRetry

func (az *Cloud) CreateOrUpdateInterfaceWithRetry(nic network.Interface) error

CreateOrUpdateInterfaceWithRetry invokes az.PublicIPAddressesClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdateLBWithRetry

func (az *Cloud) CreateOrUpdateLBWithRetry(lb network.LoadBalancer) error

CreateOrUpdateLBWithRetry invokes az.LoadBalancerClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdatePIPWithRetry

func (az *Cloud) CreateOrUpdatePIPWithRetry(pip network.PublicIPAddress) error

CreateOrUpdatePIPWithRetry invokes az.PublicIPAddressesClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdateRouteTableWithRetry

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

CreateOrUpdateRouteTableWithRetry invokes az.RouteTablesClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdateRouteWithRetry

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

CreateOrUpdateRouteWithRetry invokes az.RoutesClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdateSGWithRetry

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

CreateOrUpdateSGWithRetry invokes az.SecurityGroupsClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateOrUpdateVMWithRetry

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

CreateOrUpdateVMWithRetry invokes az.VirtualMachinesClient.CreateOrUpdate with exponential backoff retry

func (*Cloud) CreateRoute

func (az *Cloud) CreateRoute(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) CreateVolume

func (az *Cloud) CreateVolume(name, storageAccount, storageType, 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 (*Cloud) CurrentNodeName

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

CurrentNodeName returns the name of the node we are currently running on On most clouds (e.g. GCE) this is the hostname, so we provide the hostname

func (*Cloud) DeleteFileShare

func (az *Cloud) DeleteFileShare(accountName, key, name string) error

DeleteFileShare deletes a file share using storage account name and key

func (*Cloud) DeleteLBWithRetry

func (az *Cloud) DeleteLBWithRetry(lbName string) error

DeleteLBWithRetry invokes az.LoadBalancerClient.Delete with exponential backoff retry

func (*Cloud) DeletePublicIPWithRetry

func (az *Cloud) DeletePublicIPWithRetry(pipName string) error

DeletePublicIPWithRetry invokes az.PublicIPAddressesClient.Delete with exponential backoff retry

func (*Cloud) DeleteRoute

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

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

func (*Cloud) DeleteRouteWithRetry

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

DeleteRouteWithRetry invokes az.RoutesClient.Delete with exponential backoff retry

func (*Cloud) DeleteVolume

func (az *Cloud) DeleteVolume(name, uri string) error

DeleteVolume deletes a VHD blob

func (*Cloud) DetachDiskByName

func (az *Cloud) DetachDiskByName(diskName, diskURI string, nodeName types.NodeName) error

DetachDiskByName detaches a vhd from host the vhd can be identified by diskName or diskURI

func (*Cloud) DisksAreAttached

func (az *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(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(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) ExternalID

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

ExternalID returns the cloud provider ID of the specified instance (deprecated).

func (*Cloud) GetDiskLun

func (az *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) GetLoadBalancer

func (az *Cloud) GetLoadBalancer(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) GetNextDiskLun

func (az *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) GetVirtualMachineWithRetry

func (az *Cloud) GetVirtualMachineWithRetry(name types.NodeName) (compute.VirtualMachine, bool, error)

GetVirtualMachineWithRetry invokes az.getVirtualMachine with exponential backoff retry

func (*Cloud) GetZone

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

GetZone returns the Zone containing the current failure zone and locality region that the program is running in

func (*Cloud) Initialize

func (az *Cloud) Initialize(clientBuilder controller.ControllerClientBuilder)

Initialize passes a Kubernetes clientBuilder interface to the cloud provider

func (*Cloud) InstanceID

func (az *Cloud) InstanceID(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) InstanceType

func (az *Cloud) InstanceType(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(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) ListRoutes

func (az *Cloud) ListRoutes(clusterName string) (routes []*cloudprovider.Route, err error)

ListRoutes lists all managed routes that belong to the specified clusterName

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(name types.NodeName) ([]v1.NodeAddress, error)

NodeAddresses returns the addresses of the specified instance.

func (*Cloud) NodeAddressesByProviderID

func (az *Cloud) NodeAddressesByProviderID(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) Routes

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

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

func (*Cloud) ScrubDNS

func (az *Cloud) ScrubDNS(nameservers, searches []string) (nsOut, srchOut []string)

ScrubDNS provides an opportunity for cloud-provider-specific code to process DNS settings for pods.

func (*Cloud) UpdateLoadBalancer

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

UpdateLoadBalancer updates hosts under the specified load balancer.

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 Config

type Config struct {
	// The cloud environment identifier. Takes values from https://github.com/Azure/go-autorest/blob/ec5f4903f77ed9927ac95b19ab8e44ada64c1356/autorest/azure/environments.go#L13
	Cloud string `json:"cloud" yaml:"cloud"`
	// The AAD Tenant ID for the Subscription that the cluster is deployed in
	TenantID string `json:"tenantId" yaml:"tenantId"`
	// The ID of the Azure Subscription that the cluster is deployed in
	SubscriptionID string `json:"subscriptionId" yaml:"subscriptionId"`
	// 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 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 ClientID for an AAD application with RBAC access to talk to Azure RM APIs
	AADClientID string `json:"aadClientId" yaml:"aadClientId"`
	// The ClientSecret for an AAD application with RBAC access to talk to Azure RM APIs
	AADClientSecret string `json:"aadClientSecret" yaml:"aadClientSecret"`
	// The path of a client certificate for an AAD application with RBAC access to talk to Azure RM APIs
	AADClientCertPath string `json:"aadClientCertPath" yaml:"aadClientCertPath"`
	// The password of the client certificate for an AAD application with RBAC access to talk to Azure RM APIs
	AADClientCertPassword string `json:"aadClientCertPassword" yaml:"aadClientCertPassword"`
	// 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"`
	// Enable rate limiting
	CloudProviderRateLimit bool `json:"cloudProviderRateLimit" yaml:"cloudProviderRateLimit"`
	// Rate limit QPS
	CloudProviderRateLimitQPS float32 `json:"cloudProviderRateLimitQPS" yaml:"cloudProviderRateLimitQPS"`
	// Rate limit Bucket Size
	CloudProviderRateLimitBucket int `json:"cloudProviderRateLimitBucket" yaml:"cloudProviderRateLimitBucket"`
}

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

Jump to

Keyboard shortcuts

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