azure

package
v0.4.12 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultImageOfferID is the default Azure Marketplace offer ID
	DefaultImageOfferID = "capi"
	// DefaultWindowsImageOfferID is the default Azure Marketplace offer ID for Windows
	DefaultWindowsImageOfferID = "capi-windows"
	// DefaultImagePublisherID is the default Azure Marketplace publisher ID
	DefaultImagePublisherID = "cncf-upstream"
	// LatestVersion is the image version latest
	LatestVersion = "latest"
)
View Source
const (

	// VirtualMachine ...
	VirtualMachine = "VirtualMachine"

	// VirtualMachineScaleSet ...
	VirtualMachineScaleSet = "VirtualMachineScaleSet"
)
View Source
const (
	// ControlPlaneNodeGroup will be used to create availability set for control plane machines
	ControlPlaneNodeGroup = "control-plane"
)
View Source
const (
	// DefaultUserName is the default username for created vm
	DefaultUserName = "capi"
)
View Source
const (
	// Global is the Azure global location value.
	Global = "global"
)
View Source
const (
	// PrivateAPIServerHostname will be used as the api server hostname for private clusters.
	PrivateAPIServerHostname = "apiserver"
)
View Source
const (
	// WindowsOS is Windows OS value for OSDisk
	WindowsOS = "Windows"
)

Variables

View Source
var ErrNotOwned = errors.New("resource is not managed and cannot be deleted")

ErrNotOwned is returned when a resource can't be deleted because it isn't owned.

Functions

func AddressPoolID added in v0.4.8

func AddressPoolID(subscriptionID, resourceGroup, loadBalancerName, backendPoolName string) string

AddressPoolID returns the azure resource ID for a given backend address pool.

func AutoRestClientAppendUserAgent added in v0.4.11

func AutoRestClientAppendUserAgent(c *autorest.Client, extension string)

AutoRestClientAppendUserAgent autorest client calls "AddToUserAgent" but ignores errors

func AvailabilitySetID added in v0.4.11

func AvailabilitySetID(subscriptionID, resourceGroup, availabilitySetName string) string

AvailabilitySetID returns the azure resource ID for a given availability set.

func FrontendIPConfigID added in v0.4.8

func FrontendIPConfigID(subscriptionID, resourceGroup, loadBalancerName, configName string) string

FrontendIPConfigID returns the azure resource ID for a given frontend IP config.

func GenerateAvailabilitySetName added in v0.4.11

func GenerateAvailabilitySetName(clusterName, nodeGroup string) string

GenerateAvailabilitySetName generates the name of a availability set based on the cluster name and the node group. node group identifies the set of nodes that belong to this availability set: For control plane nodes, this will be `control-plane`. For worker nodes, this will be the machine deployment name.

func GenerateBackendAddressPoolName added in v0.4.8

func GenerateBackendAddressPoolName(lbName string) string

GenerateBackendAddressPoolName generates a load balancer backend address pool name.

func GenerateControlPlaneOutboundIPName added in v0.4.10

func GenerateControlPlaneOutboundIPName(clusterName string) string

GenerateControlPlaneOutboundIPName generates a public IP name, based on the cluster name.

func GenerateControlPlaneOutboundLBName added in v0.4.10

func GenerateControlPlaneOutboundLBName(clusterName string) string

GenerateControlPlaneOutboundLBName generates the name of the control plane outbound LB.

func GenerateDataDiskName added in v0.4.6

func GenerateDataDiskName(machineName, nameSuffix string) string

GenerateDataDiskName generates the name of a data disk based on the name of a VM.

func GenerateFrontendIPConfigName added in v0.4.8

func GenerateFrontendIPConfigName(lbName string) string

GenerateFrontendIPConfigName generates a load balancer frontend IP config name.

func GenerateNICName

func GenerateNICName(machineName string) string

GenerateNICName generates the name of a network interface based on the name of a VM.

func GenerateNodeOutboundIPName added in v0.4.5

func GenerateNodeOutboundIPName(clusterName string) string

GenerateNodeOutboundIPName generates a public IP name, based on the cluster name.

func GenerateNodePublicIPName added in v0.4.5

func GenerateNodePublicIPName(machineName string) string

GenerateNodePublicIPName generates a node public IP name, based on the machine name.

func GenerateOSDiskName

func GenerateOSDiskName(machineName string) string

GenerateOSDiskName generates the name of an OS disk based on the name of a VM.

func GenerateOutboundBackendAddressPoolName added in v0.4.10

func GenerateOutboundBackendAddressPoolName(lbName string) string

GenerateOutboundBackendAddressPoolName generates a load balancer outbound backend address pool name.

func GeneratePrivateDNSZoneName added in v0.4.10

func GeneratePrivateDNSZoneName(clusterName string) string

GeneratePrivateDNSZoneName generates the name of a private DNS zone based on the cluster name.

func GeneratePrivateFQDN added in v0.4.10

func GeneratePrivateFQDN(clusterName string) string

GeneratePrivateFQDN generates FQDN for a private API Server.

func GeneratePublicNICName added in v0.4.6

func GeneratePublicNICName(machineName string) string

GeneratePublicNICName generates the name of a public network interface based on the name of a VM.

func GenerateVNetLinkName added in v0.4.10

func GenerateVNetLinkName(vnetName string) string

GenerateVNetLinkName generates the name of a virtual network link name based on the vnet name.

func GetBootstrappingVMExtension added in v0.4.11

func GetBootstrappingVMExtension(osType string, cloud string) (name, publisher, version string)

GetBootstrappingVMExtension returns the CAPZ Bootstrapping VM extension. The CAPZ Bootstrapping extension is a simple clone of https://github.com/Azure/custom-script-extension-linux which allows running arbitrary scripts on the VM. Its role is to detect and report Kubernetes bootstrap failure or success.

func GetDefaultUbuntuImage

func GetDefaultUbuntuImage(k8sVersion string) (*infrav1.Image, error)

GetDefaultUbuntuImage returns the default image spec for Ubuntu.

func GetDefaultWindowsImage added in v0.4.11

func GetDefaultWindowsImage(k8sVersion string) (*infrav1.Image, error)

GetDefaultWindowsImage returns the default image spec for Windows.

func NATRuleID added in v0.4.8

func NATRuleID(subscriptionID, resourceGroup, loadBalancerName, natRuleName string) string

NATRuleID returns the azure resource ID for a inbound NAT rule.

func NetworkInterfaceID added in v0.4.8

func NetworkInterfaceID(subscriptionID, resourceGroup, nicName string) string

NetworkInterfaceID returns the azure resource ID for a given network interface.

func ProbeID added in v0.4.8

func ProbeID(subscriptionID, resourceGroup, loadBalancerName, probeName string) string

ProbeID returns the azure resource ID for a given probe.

func PublicIPID added in v0.4.8

func PublicIPID(subscriptionID, resourceGroup, ipName string) string

PublicIPID returns the azure resource ID for a given public IP.

func ResourceConflict added in v0.4.11

func ResourceConflict(err error) bool

ResourceConflict parses the error to check if it's a resource conflict error (409)

func ResourceNotFound

func ResourceNotFound(err error) bool

ResourceNotFound parses the error to check if it's a resource not found error.

func RouteTableID added in v0.4.8

func RouteTableID(subscriptionID, resourceGroup, routeTableName string) string

RouteTableID returns the azure resource ID for a given route table.

func SecurityGroupID added in v0.4.8

func SecurityGroupID(subscriptionID, resourceGroup, nsgName string) string

SecurityGroupID returns the azure resource ID for a given security group.

func SetAutoRestClientDefaults added in v0.4.11

func SetAutoRestClientDefaults(c *autorest.Client, auth autorest.Authorizer)

SetAutoRestClientDefaults set authorizer and user agent for autorest client

func SubnetID added in v0.4.8

func SubnetID(subscriptionID, resourceGroup, vnetName, subnetName string) string

SubnetID returns the azure resource ID for a given subnet.

func UserAgent

func UserAgent() string

UserAgent specifies a string to append to the agent identifier.

func VMID added in v0.4.8

func VMID(subscriptionID, resourceGroup, vmName string) string

VMID returns the azure resource ID for a given VM.

func VNetID added in v0.4.10

func VNetID(subscriptionID, resourceGroup, vnetName string) string

VNetID returns the azure resource ID for a given VNet.

Types

type Authorizer added in v0.4.6

type Authorizer interface {
	SubscriptionID() string
	ClientID() string
	ClientSecret() string
	CloudEnvironment() string
	TenantID() string
	BaseURI() string
	Authorizer() autorest.Authorizer
	HashKey() string
}

Authorizer is an interface which can get the subscription ID, base URI, and authorizer for an Azure service.

type AvailabilitySetSpec added in v0.4.11

type AvailabilitySetSpec struct {
	Name string
}

AvailabilitySetSpec defines the specification for an availability set.

type BastionSpec added in v0.4.8

type BastionSpec struct {
	Name         string
	SubnetName   string
	PublicIPName string
	VNetName     string
}

BastionSpec defines the specification for bastion host.

type ClusterDescriber added in v0.4.6

type ClusterDescriber interface {
	Authorizer
	ResourceGroup() string
	ClusterName() string
	Location() string
	AdditionalTags() infrav1.Tags
	AvailabilitySetEnabled() bool
}

ClusterDescriber is an interface which can get common Azure Cluster information.

type ClusterScoper added in v0.4.10

type ClusterScoper interface {
	ClusterDescriber
	NetworkDescriber
}

ClusterScoper combines the ClusterDescriber and NetworkDescriber interfaces.

type CredentialGetter added in v0.4.4

type CredentialGetter interface {
	Service
	GetCredentials(ctx context.Context, group string, cluster string) ([]byte, error)
}

CredentialGetter is a Service which knows how to retrieve credentials for an Azure resource in a resource group.

type DiskSpec added in v0.4.6

type DiskSpec struct {
	Name string
}

DiskSpec defines the specification for a Disk.

type InboundNatSpec added in v0.4.7

type InboundNatSpec struct {
	Name             string
	LoadBalancerName string
}

InboundNatSpec defines the specification for an inbound NAT rule.

type LBSpec added in v0.4.6

type LBSpec struct {
	Name              string
	Role              string
	Type              infrav1.LBType
	SKU               infrav1.SKU
	SubnetName        string
	BackendPoolName   string
	FrontendIPConfigs []infrav1.FrontendIP
	APIServerPort     int32
}

LBSpec defines the specification for a Load Balancer.

type NICSpec added in v0.4.6

type NICSpec struct {
	Name                      string
	MachineName               string
	SubnetName                string
	VNetName                  string
	VNetResourceGroup         string
	StaticIPAddress           string
	PublicLBName              string
	PublicLBAddressPoolName   string
	PublicLBNATRuleName       string
	InternalLBName            string
	InternalLBAddressPoolName string
	PublicIPName              string
	VMSize                    string
	AcceleratedNetworking     *bool
	IPv6Enabled               bool
	EnableIPForwarding        bool
}

NICSpec defines the specification for a Network Interface.

type NSGSpec added in v0.4.7

type NSGSpec struct {
	Name         string
	IngressRules infrav1.IngressRules
}

NSGSpec defines the specification for a Security Group.

type NetworkDescriber added in v0.4.10

type NetworkDescriber interface {
	Vnet() *infrav1.VnetSpec
	IsVnetManaged() bool
	NodeSubnet() *infrav1.SubnetSpec
	ControlPlaneSubnet() *infrav1.SubnetSpec
	IsIPv6Enabled() bool
	NodeRouteTable() *infrav1.RouteTable
	ControlPlaneRouteTable() *infrav1.RouteTable
	APIServerLBName() string
	APIServerLBPoolName(string) string
	IsAPIServerPrivate() bool
	OutboundLBName(string) string
	OutboundPoolName(string) string
}

NetworkDescriber is an interface which can get common Azure Cluster Networking information.

type OldService added in v0.4.6

type OldService interface {
	Reconcile(ctx context.Context, spec interface{}) error
	Delete(ctx context.Context, spec interface{}) error
}

OldService is a generic interface for services that have not yet been refactored. Once all services have been converted to use Service, this should be removed. Example: virtualnetworks service would offer Reconcile/Delete methods.

type OperationNotDoneError added in v0.4.11

type OperationNotDoneError struct {
	Future *infrav1.Future
}

OperationNotDoneError is used to represent a long running operation that is not yet complete

func NewOperationNotDoneError added in v0.4.11

func NewOperationNotDoneError(future *infrav1.Future) *OperationNotDoneError

NewOperationNotDoneError returns a new OperationNotDoneError wrapping a Future

func (OperationNotDoneError) Error added in v0.4.11

func (onde OperationNotDoneError) Error() string

Error returns the error represented as a string

func (OperationNotDoneError) Is added in v0.4.11

func (onde OperationNotDoneError) Is(target error) bool

Is returns true if the target is an OperationNotDoneError

type PrivateDNSSpec added in v0.4.10

type PrivateDNSSpec struct {
	ZoneName          string
	VNetName          string
	VNetResourceGroup string
	LinkName          string
	Records           []infrav1.AddressRecord
}

PrivateDNSSpec defines the specification for a private DNS zone.

type PublicIPSpec added in v0.4.6

type PublicIPSpec struct {
	Name    string
	DNSName string
	IsIPv6  bool
}

PublicIPSpec defines the specification for a Public IP.

type ReconcileError added in v0.4.11

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

ReconcileError represents an error that is not automatically recoverable errorType indicates what type of action is required to recover. It can take two values 1. `Transient` - Can be recovered through manual intervention, will be requeued after 2. `Terminal` - Cannot be recovered, will not be requeued

func WithTerminalError added in v0.4.11

func WithTerminalError(err error) ReconcileError

WithTerminalError wraps the error in a ReconcileError with errorType as `Terminal`

func WithTransientError added in v0.4.11

func WithTransientError(err error, requeueAfter time.Duration) ReconcileError

WithTransientError wraps the error in a ReconcileError with errorType as `Transient`

func (ReconcileError) Error added in v0.4.11

func (t ReconcileError) Error() string

Error returns the error message for a ReconcileError

func (ReconcileError) IsTerminal added in v0.4.11

func (t ReconcileError) IsTerminal() bool

IsTerminal returns if the ReconcileError is recoverable

func (ReconcileError) IsTransient added in v0.4.11

func (t ReconcileError) IsTransient() bool

IsTransient returns if the ReconcileError is recoverable

func (ReconcileError) RequeueAfter added in v0.4.11

func (t ReconcileError) RequeueAfter() time.Duration

RequeueAfter returns requestAfter value

type ReconcileErrorType added in v0.4.11

type ReconcileErrorType string

ReconcileErrorType represents the type of a ReconcileError

const (
	// TransientErrorType can be recovered, will be requeued after a configured time interval
	TransientErrorType ReconcileErrorType = "Transient"
	// TerminalErrorType cannot be recovered, will not be requeued
	TerminalErrorType ReconcileErrorType = "Terminal"
)

type ResourceType added in v0.4.10

type ResourceType string

ResourceType defines the type azure resource being reconciled. Eg. Virtual Machine, Virtual Machine Scale Sets

type RoleAssignmentSpec added in v0.4.7

type RoleAssignmentSpec struct {
	MachineName  string
	Name         string
	ResourceType string
}

RoleAssignmentSpec defines the specification for a Role Assignment.

type RouteTableRole added in v0.4.10

type RouteTableRole string

RouteTableRole defines the unique role of a route table.

type RouteTableSpec added in v0.4.7

type RouteTableSpec struct {
	Name   string
	Subnet *infrav1.SubnetSpec
}

RouteTableSpec defines the specification for a Route Table.

type ScaleSetSpec added in v0.4.8

type ScaleSetSpec struct {
	Name                         string
	Size                         string
	Capacity                     int64
	SSHKeyData                   string
	OSDisk                       infrav1.OSDisk
	DataDisks                    []infrav1.DataDisk
	SubnetName                   string
	VNetName                     string
	VNetResourceGroup            string
	PublicLBName                 string
	PublicLBAddressPoolName      string
	AcceleratedNetworking        *bool
	TerminateNotificationTimeout *int
	Identity                     infrav1.VMIdentity
	UserAssignedIdentities       []infrav1.UserAssignedIdentity
	SecurityProfile              *infrav1.SecurityProfile
	SpotVMOptions                *infrav1.SpotVMOptions
}

ScaleSetSpec defines the specification for a Scale Set.

type Service

type Service interface {
	Reconcile(ctx context.Context) error
	Delete(ctx context.Context) error
}

Service is a generic interface used by components offering a type of service. Example: virtualnetworks service would offer Reconcile/Delete methods.

type SubnetSpec added in v0.4.7

type SubnetSpec struct {
	Name              string
	CIDRs             []string
	VNetName          string
	RouteTableName    string
	SecurityGroupName string
	Role              infrav1.SubnetRole
}

SubnetSpec defines the specification for a Subnet.

type TagsSpec added in v0.4.8

type TagsSpec struct {
	Scope      string
	Tags       infrav1.Tags
	Annotation string
}

TagsSpec defines the specification for a set of tags.

type VMDeletedError added in v0.4.10

type VMDeletedError struct {
	ProviderID string
}

VMDeletedError is returned when a virtual machine is deleted outside of capz

func (VMDeletedError) Error added in v0.4.10

func (vde VMDeletedError) Error() string

Error returns the error string

type VMExtensionSpec added in v0.4.11

type VMExtensionSpec struct {
	Name      string
	VMName    string
	Publisher string
	Version   string
}

VMExtensionSpec defines the specification for a VM extension.

type VMSSExtensionSpec added in v0.4.11

type VMSSExtensionSpec struct {
	Name         string
	ScaleSetName string
	Publisher    string
	Version      string
}

VMSSExtensionSpec defines the specification for a VMSS extension.

type VMSpec added in v0.4.7

type VMSpec struct {
	Name                   string
	Role                   string
	NICNames               []string
	SSHKeyData             string
	Size                   string
	Zone                   string
	Identity               infrav1.VMIdentity
	OSDisk                 infrav1.OSDisk
	DataDisks              []infrav1.DataDisk
	UserAssignedIdentities []infrav1.UserAssignedIdentity
	SpotVMOptions          *infrav1.SpotVMOptions
	SecurityProfile        *infrav1.SecurityProfile
}

VMSpec defines the specification for a Virtual Machine.

type VNetSpec added in v0.4.7

type VNetSpec struct {
	ResourceGroup string
	Name          string
	CIDRs         []string
}

VNetSpec defines the specification for a Virtual Network.

Directories

Path Synopsis
Run go generate to regenerate this mock.
Run go generate to regenerate this mock.
services
agentpools/mock_agentpools
Package mock_agentpools is a generated GoMock package.
Package mock_agentpools is a generated GoMock package.
availabilitysets/mock_availabilitysets
Package mock_availabilitysets is a generated GoMock package.
Package mock_availabilitysets is a generated GoMock package.
bastionhosts/mocks_bastionhosts
Package mock_bastionhosts is a generated GoMock package.
Package mock_bastionhosts is a generated GoMock package.
disks/mock_disks
Package mock_disks is a generated GoMock package.
Package mock_disks is a generated GoMock package.
groups/mock_groups
Package mock_groups is a generated GoMock package.
Package mock_groups is a generated GoMock package.
inboundnatrules/mock_inboundnatrules
Package mock_inboundnatrules is a generated GoMock package.
Package mock_inboundnatrules is a generated GoMock package.
loadbalancers/mock_loadbalancers
Package mock_loadbalancers is a generated GoMock package.
Package mock_loadbalancers is a generated GoMock package.
managedclusters/mock_managedclusters
Run go generate to regenerate this mock.
Run go generate to regenerate this mock.
networkinterfaces/mock_networkinterfaces
Package mock_networkinterfaces is a generated GoMock package.
Package mock_networkinterfaces is a generated GoMock package.
privatedns/mock_privatedns
Package mock_privatedns is a generated GoMock package.
Package mock_privatedns is a generated GoMock package.
publicips/mock_publicips
Package mock_publicips is a generated GoMock package.
Package mock_publicips is a generated GoMock package.
resourceskus/mock_resourceskus
Run go generate to regenerate this mock.
Run go generate to regenerate this mock.
roleassignments/mock_roleassignments
Package mock_roleassignments is a generated GoMock package.
Package mock_roleassignments is a generated GoMock package.
routetables/mock_routetables
Package mock_routetables is a generated GoMock package.
Package mock_routetables is a generated GoMock package.
scalesets/mock_scalesets
Package mock_scalesets is a generated GoMock package.
Package mock_scalesets is a generated GoMock package.
securitygroups/mock_securitygroups
Package mock_securitygroups is a generated GoMock package.
Package mock_securitygroups is a generated GoMock package.
subnets/mock_subnets
Package mock_subnets is a generated GoMock package.
Package mock_subnets is a generated GoMock package.
tags/mock_tags
Package mock_tags is a generated GoMock package.
Package mock_tags is a generated GoMock package.
virtualmachines/mock_virtualmachines
Package mock_virtualmachines is a generated GoMock package.
Package mock_virtualmachines is a generated GoMock package.
virtualnetworks/mock_virtualnetworks
Package mock_virtualnetworks is a generated GoMock package.
Package mock_virtualnetworks is a generated GoMock package.
vmextensions/mock_vmextensions
Package mock_vmextensions is a generated GoMock package.
Package mock_vmextensions is a generated GoMock package.
vmssextensions/mock_vmssextensions
Package mock_vmssextensions is a generated GoMock package.
Package mock_vmssextensions is a generated GoMock package.

Jump to

Keyboard shortcuts

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