azure

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: Apache-2.0 Imports: 26 Imported by: 11

Documentation

Index

Constants

View Source
const (
	// VMTagsLastAppliedAnnotation is the key for the machine object annotation
	// which tracks the AdditionalTags in the Machine Provider Config.
	// See https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
	// for annotation formatting rules.
	VMTagsLastAppliedAnnotation = "sigs.k8s.io/cluster-api-provider-azure-last-applied-tags-vm"

	// RGTagsLastAppliedAnnotation is the key for the Azure Cluster object annotation
	// which tracks the AdditionalTags for Resource Group which is part in the Azure Cluster.
	// See https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
	// for annotation formatting rules.
	RGTagsLastAppliedAnnotation = "sigs.k8s.io/cluster-api-provider-azure-last-applied-tags-rg"

	// ManagedClusterTagsLastAppliedAnnotation is the key for the AzureManagedControlPlane
	// object annotation which tracks the AdditionalTags for managed clusters.
	// See https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
	// for annotation formatting rules.
	ManagedClusterTagsLastAppliedAnnotation = "sigs.k8s.io/cluster-api-provider-azure-last-applied-tags-managedcluster"

	// SecurityRuleLastAppliedAnnotation is the key for the Azure Cluster
	// object annotation which tracks the security rules for security groups.
	// See https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
	// for annotation formatting rules.
	SecurityRuleLastAppliedAnnotation = "sigs.k8s.io/cluster-api-provider-azure-last-applied-security-rules"

	// CustomDataHashAnnotation is the key for the machine object annotation
	// which tracks the hash of the custom data.
	// See https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
	// for annotation formatting rules.
	CustomDataHashAnnotation = "sigs.k8s.io/cluster-api-provider-azure-vmss-custom-data-hash"
)
View Source
const (
	// DefaultUserName is the default username for a created VM.
	DefaultUserName = "capi"
	// DefaultAKSUserName is the default username for a created AKS VM.
	DefaultAKSUserName = "azureuser"
	// PublicCloudName is the name of the Azure public cloud.
	PublicCloudName = "AzurePublicCloud"
	// ChinaCloudName is the name of the Azure China cloud.
	ChinaCloudName = "AzureChinaCloud"
	// USGovernmentCloudName is the name of the Azure US Government cloud.
	USGovernmentCloudName = "AzureUSGovernmentCloud"
)
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 (
	// LinuxOS is Linux OS value for OSDisk.OSType.
	LinuxOS = "Linux"
	// WindowsOS is Windows OS value for OSDisk.OSType.
	WindowsOS = "Windows"
)
View Source
const (
	// BootstrappingExtensionLinux is the name of the Linux CAPZ bootstrapping VM extension.
	BootstrappingExtensionLinux = "CAPZ.Linux.Bootstrapping"
	// BootstrappingExtensionWindows is the name of the Windows CAPZ bootstrapping VM extension.
	BootstrappingExtensionWindows = "CAPZ.Windows.Bootstrapping"
)
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 (
	// CustomHeaderPrefix is the prefix of annotations that enable additional cluster / node pool features.
	// Whatever follows the prefix will be passed as a header to cluster/node pool creation/update requests.
	// E.g. add `"infrastructure.cluster.x-k8s.io/custom-header-UseGPUDedicatedVHD": "true"` annotation to
	// AzureManagedMachinePool CR to enable creating GPU nodes by the node pool.
	CustomHeaderPrefix = "infrastructure.cluster.x-k8s.io/custom-header-"
)
View Source
const (
	// DefaultWindowsOsAndVersion is the default Windows Server version to use when
	// generating default images for Windows nodes.
	DefaultWindowsOsAndVersion = "windows-2019"
)
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"
)

Variables

View Source
var (
	// LinuxBootstrapExtensionCommand is the command the VM bootstrap extension will execute to verify Linux nodes bootstrap completes successfully.
	LinuxBootstrapExtensionCommand = fmt.Sprintf("for i in $(seq 1 %d); do test -f %s && break; if [ $i -eq %d ]; then exit 1; else sleep %d; fi; done", bootstrapExtensionRetries, bootstrapSentinelFile, bootstrapExtensionRetries, bootstrapExtensionSleep)
	// WindowsBootstrapExtensionCommand is the command the VM bootstrap extension will execute to verify Windows nodes bootstrap completes successfully.
	WindowsBootstrapExtensionCommand = fmt.Sprintf("powershell.exe -Command \"for ($i = 0; $i -lt %d; $i++) {if (Test-Path '%s') {exit 0} else {Start-Sleep -Seconds %d}} exit -2\"",
		bootstrapExtensionRetries, bootstrapSentinelFile, bootstrapExtensionSleep)
)

Functions

func ARMClientOptions added in v1.11.0

func ARMClientOptions(azureEnvironment string, extraPolicies ...policy.Policy) (*arm.ClientOptions, error)

ARMClientOptions returns default ARM client options for CAPZ SDK v2 requests.

func AddressPoolID

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

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

func AliasOrNil added in v1.11.0

func AliasOrNil[T ~string](s *string) *T

AliasOrNil returns a pointer to a string-derived type from a passed string pointer, or nil if the pointer is nil or an empty string.

func AvailabilitySetID

func AvailabilitySetID(subscriptionID, resourceGroup, availabilitySetName string) string

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

func FleetID added in v1.13.0

func FleetID(subscriptionID, resourceGroup, fleetName string) string

FleetID returns the azure resource ID for a given fleet manager.

func FrontendIPConfigID

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

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

func GenerateAvailabilitySetName

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

func GenerateBackendAddressPoolName(lbName string) string

GenerateBackendAddressPoolName generates a load balancer backend address pool name.

func GenerateControlPlaneOutboundIPName

func GenerateControlPlaneOutboundIPName(clusterName string) string

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

func GenerateControlPlaneOutboundLBName

func GenerateControlPlaneOutboundLBName(clusterName string) string

GenerateControlPlaneOutboundLBName generates the name of the control plane outbound LB.

func GenerateDataDiskName

func GenerateDataDiskName(machineName, nameSuffix string) string

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

func GenerateFrontendIPConfigName

func GenerateFrontendIPConfigName(lbName string) string

GenerateFrontendIPConfigName generates a load balancer frontend IP config name.

func GenerateNICName

func GenerateNICName(machineName string, multiNIC bool, index int) string

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

func GenerateNodeOutboundIPName

func GenerateNodeOutboundIPName(clusterName string) string

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

func GenerateNodePublicIPName

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

func GenerateOutboundBackendAddressPoolName(lbName string) string

GenerateOutboundBackendAddressPoolName generates a load balancer outbound backend address pool name.

func GeneratePrivateDNSZoneName

func GeneratePrivateDNSZoneName(clusterName string) string

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

func GeneratePrivateFQDN

func GeneratePrivateFQDN(zoneName string) string

GeneratePrivateFQDN generates the FQDN for a private API Server based on the private DNS zone name.

func GeneratePublicNICName

func GeneratePublicNICName(machineName string) string

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

func GenerateVNetLinkName

func GenerateVNetLinkName(vnetName string) string

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

func GenerateVnetPeeringName added in v1.0.0

func GenerateVnetPeeringName(sourceVnetName string, remoteVnetName string) string

GenerateVnetPeeringName generates the name for a peering between two vnets.

func IsContextDeadlineExceededOrCanceledError added in v1.9.0

func IsContextDeadlineExceededOrCanceledError(err error) bool

IsContextDeadlineExceededOrCanceledError checks if it's a context deadline exceeded or canceled error.

func IsOperationNotDoneError added in v0.5.3

func IsOperationNotDoneError(target error) bool

IsOperationNotDoneError returns true if the target is an OperationNotDoneError.

func ManagedClusterID added in v1.7.0

func ManagedClusterID(subscriptionID, resourceGroup, managedClusterName string) string

ManagedClusterID returns the azure resource ID for a given managed cluster.

func NATRuleID

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

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

func NatGatewayID

func NatGatewayID(subscriptionID, resourceGroup, natgatewayName string) string

NatGatewayID returns the azure resource ID for a given NAT gateway.

func NetworkInterfaceID

func NetworkInterfaceID(subscriptionID, resourceGroup, nicName string) string

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

func PrivateDNSZoneID added in v1.6.0

func PrivateDNSZoneID(subscriptionID, resourceGroup, privateDNSZoneName string) string

PrivateDNSZoneID returns the azure resource ID for a given private DNS zone.

func ProbeID

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

ProbeID returns the azure resource ID for a given probe.

func PtrSlice added in v1.11.0

func PtrSlice[T any](p *[]T) []*T

PtrSlice returns a slice of pointers from a pointer to a slice. It returns nil if the pointer is nil or the slice pointed to is empty.

func PublicIPID

func PublicIPID(subscriptionID, resourceGroup, ipName string) string

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

func PublicIPPrefixID added in v1.12.0

func PublicIPPrefixID(subscriptionID, resourceGroup, ipName string) string

PublicIPPrefixID returns the azure resource ID for a given public IP prefix.

func ResourceGroupID added in v1.0.0

func ResourceGroupID(subscriptionID, resourceGroup string) string

ResourceGroupID returns the azure resource ID for a given resource group.

func ResourceNotFound

func ResourceNotFound(err error) bool

ResourceNotFound parses an error to check if its status code is Not Found (404).

func RouteTableID

func RouteTableID(subscriptionID, resourceGroup, routeTableName string) string

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

func SecurityGroupID

func SecurityGroupID(subscriptionID, resourceGroup, nsgName string) string

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

func StringMapPtr added in v1.8.0

func StringMapPtr(m map[string]string) map[string]*string

StringMapPtr converts a map[string]string into a map[string]*string. It returns nil if the map is nil.

func StringSlice added in v1.8.0

func StringSlice(s *[]string) []string

StringSlice returns a string slice value for the passed string slice pointer. It returns a nil slice if the pointer is nil.

func SubnetID

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

func VMID(subscriptionID, resourceGroup, vmName string) string

VMID returns the azure resource ID for a given VM.

func VNetID

func VNetID(subscriptionID, resourceGroup, vnetName string) string

VNetID returns the azure resource ID for a given VNet.

func VirtualNetworkLinkID added in v1.6.0

func VirtualNetworkLinkID(subscriptionID, resourceGroup, privateDNSZoneName, virtualNetworkLinkName string) string

VirtualNetworkLinkID returns the azure resource ID for a given virtual network link.

func WithIndex

func WithIndex(name string, n int) string

WithIndex appends the index as suffix to a generated name.

Types

type ASOResourceSpecGetter added in v1.10.0

type ASOResourceSpecGetter[T genruntime.MetaObject] interface {
	// ResourceRef returns a concrete, named (and namespaced if applicable) ASO
	// resource type to facilitate a strongly-typed GET.
	ResourceRef() T
	// Parameters returns a modified object if it points to a non-nil resource.
	// Otherwise it returns an unmodified object if no updates are needed.
	Parameters(ctx context.Context, existing T) (T, error)
	// WasManaged returns whether or not the given resource was managed by a
	// non-ASO-backed CAPZ and should be considered eligible for adoption.
	WasManaged(T) bool
}

ASOResourceSpecGetter is an interface for getting all the required information to create/update/delete an Azure resource.

type AsyncReconciler added in v1.13.0

type AsyncReconciler interface {
	DefaultedAzureCallTimeout() time.Duration
	DefaultedAzureServiceReconcileTimeout() time.Duration
	DefaultedReconcilerRequeue() time.Duration
}

AsyncReconciler is an interface used to get the default timeouts and requeue time for a reconciler that reconciles services asynchronously.

type AsyncStatusUpdater added in v0.5.3

type AsyncStatusUpdater interface {
	SetLongRunningOperationState(*infrav1.Future)
	GetLongRunningOperationState(string, string, string) *infrav1.Future
	DeleteLongRunningOperationState(string, string, string)
	UpdatePutStatus(clusterv1.ConditionType, string, error)
	UpdateDeleteStatus(clusterv1.ConditionType, string, error)
	UpdatePatchStatus(clusterv1.ConditionType, string, error)
	AsyncReconciler
}

AsyncStatusUpdater is an interface used to keep track of long running operations in Status that has Conditions and Futures.

type Authorizer

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

Authorizer is an interface which can get details such as subscription ID, base URI, and token for authorizing to an Azure service.

func WithRegionalBaseURI added in v1.1.0

func WithRegionalBaseURI(authorizer Authorizer, region string) (Authorizer, error)

WithRegionalBaseURI returns an authorizer that has a regional base URI, like `https://{region}.management.azure.com`.

type ClusterDescriber

type ClusterDescriber interface {
	Authorizer
	ResourceGroup() string
	NodeResourceGroup() string
	ClusterName() string
	Location() string
	ExtendedLocation() *infrav1.ExtendedLocationSpec
	ExtendedLocationName() string
	ExtendedLocationType() string
	AdditionalTags() infrav1.Tags
	AvailabilitySetEnabled() bool
	CloudProviderConfigOverrides() *infrav1.CloudProviderConfigOverrides
	FailureDomains() []*string
}

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

type ClusterScoper

type ClusterScoper interface {
	ClusterDescriber
	NetworkDescriber
	AsyncStatusUpdater
	GetClient() client.Client
	GetDeletionTimestamp() *metav1.Time
}

ClusterScoper combines the ClusterDescriber and NetworkDescriber interfaces.

type CustomPutPatchHeaderPolicy added in v1.11.0

type CustomPutPatchHeaderPolicy struct {
	Headers map[string]string
}

CustomPutPatchHeaderPolicy adds custom headers to a PUT or PATCH request. It implements the policy.Policy interface.

func (CustomPutPatchHeaderPolicy) Do added in v1.11.0

Do adds any custom headers to a PUT or PATCH request.

type ExtensionSpec added in v0.5.3

type ExtensionSpec struct {
	Name              string
	VMName            string
	Publisher         string
	Version           string
	Settings          map[string]string
	ProtectedSettings map[string]string
}

ExtensionSpec defines the specification for a VM or VMSS extension.

func GetBootstrappingVMExtension

func GetBootstrappingVMExtension(osType string, cloud string, vmName string, cpuArchitectureType string) *ExtensionSpec

GetBootstrappingVMExtension returns the CAPZ Bootstrapping VM extension. The CAPZ Bootstrapping extension is a simple clone of https://github.com/Azure/custom-script-extension-linux for Linux or https://learn.microsoft.com/azure/virtual-machines/extensions/custom-script-windows for Windows. This extension allows running arbitrary scripts on the VM. Its role is to detect and report Kubernetes bootstrap failure or success.

type ManagedClusterScoper added in v1.4.0

type ManagedClusterScoper interface {
	ClusterDescriber
	NodeResourceGroup() string
	AsyncReconciler
}

ManagedClusterScoper defines the interface for ManagedClusterScope.

type NetworkDescriber

type NetworkDescriber interface {
	Vnet() *infrav1.VnetSpec
	IsVnetManaged() bool
	ControlPlaneSubnet() infrav1.SubnetSpec
	Subnets() infrav1.Subnets
	Subnet(string) infrav1.SubnetSpec
	NodeSubnets() []infrav1.SubnetSpec
	SetSubnet(infrav1.SubnetSpec)
	IsIPv6Enabled() bool
	ControlPlaneRouteTable() infrav1.RouteTable
	APIServerLB() *infrav1.LoadBalancerSpec
	APIServerLBName() string
	APIServerLBPoolName() string
	IsAPIServerPrivate() bool
	GetPrivateDNSZoneName() string
	OutboundLBName(string) string
	OutboundPoolName(string) string
}

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

type OperationNotDoneError

type OperationNotDoneError struct {
	Future *infrav1.Future
}

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

func NewOperationNotDoneError

func NewOperationNotDoneError(future *infrav1.Future) OperationNotDoneError

NewOperationNotDoneError returns a new OperationNotDoneError wrapping a Future.

func (OperationNotDoneError) Error

func (onde OperationNotDoneError) Error() string

Error returns the error represented as a string.

func (OperationNotDoneError) Is

func (onde OperationNotDoneError) Is(target error) bool

Is returns true if the target is an OperationNotDoneError.

type Pauser added in v1.11.0

type Pauser interface {
	Pause(context.Context) error
}

Pauser may be implemented for a ServiceReconciler that requires additional work to stop reconciliation.

type ReconcileError

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

func WithTerminalError(err error) ReconcileError

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

func WithTransientError

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

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

func (ReconcileError) Error

func (t ReconcileError) Error() string

Error returns the error message for a ReconcileError.

func (ReconcileError) Is

func (t ReconcileError) Is(target error) bool

Is returns true if the target is a ReconcileError.

func (ReconcileError) IsTerminal

func (t ReconcileError) IsTerminal() bool

IsTerminal returns if the ReconcileError is recoverable.

func (ReconcileError) IsTransient

func (t ReconcileError) IsTransient() bool

IsTransient returns if the ReconcileError is recoverable.

func (ReconcileError) RequeueAfter

func (t ReconcileError) RequeueAfter() time.Duration

RequeueAfter returns requestAfter value.

type ReconcileErrorType

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 Reconciler

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

Reconciler is a generic interface for a controller reconciler which has Reconcile and Delete methods.

type ResourceSpecGetter added in v0.5.3

type ResourceSpecGetter interface {
	// ResourceName returns the name of the resource.
	ResourceName() string
	// OwnerResourceName returns the name of the resource that owns the resource
	// in the case that the resource is an Azure subresource.
	OwnerResourceName() string
	// ResourceGroupName returns the name of the resource group the resource is in.
	ResourceGroupName() string
	// Parameters takes the existing resource and returns the desired parameters of the resource.
	// If the resource does not exist, or we do not care about existing parameters to update the resource, existing should be nil.
	// If no update is needed on the resource, Parameters should return nil.
	Parameters(ctx context.Context, existing interface{}) (params interface{}, err error)
}

ResourceSpecGetter is an interface for getting all the required information to create/update/delete an Azure resource.

type ResourceSpecGetterWithHeaders added in v1.4.0

type ResourceSpecGetterWithHeaders interface {
	ResourceSpecGetter
	// CustomHeaders returns the headers that should be added to Azure API calls.
	CustomHeaders() map[string]string
}

ResourceSpecGetterWithHeaders is a ResourceSpecGetter that can return custom headers to be added to API calls.

type ResourceType

type ResourceType string

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

type RoleAssignmentSpec

type RoleAssignmentSpec struct {
	MachineName  string
	Name         string
	ResourceType string
}

RoleAssignmentSpec defines the specification for a Role Assignment.

type ScaleSetSpec

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
	AdditionalCapabilities       *infrav1.AdditionalCapabilities
	DiagnosticsProfile           *infrav1.Diagnostics
	FailureDomains               []string
	VMExtensions                 []infrav1.VMExtension
	NetworkInterfaces            []infrav1.NetworkInterface
	IPv6Enabled                  bool
	OrchestrationMode            infrav1.OrchestrationModeType
}

ScaleSetSpec defines the specification for a Scale Set.

type ServiceReconciler added in v1.3.0

type ServiceReconciler interface {
	Name() string
	Reconciler
}

ServiceReconciler is an Azure service reconciler which can reconcile an Azure service.

type TagsSpec

type TagsSpec struct {
	Scope string
	Tags  infrav1.Tags
	// Annotation is the key which stores the last applied tags as value in JSON format.
	// The last applied tags are used to find out which tags are being managed by CAPZ
	// and if any has to be deleted by comparing it with the new desired tags
	Annotation string
}

TagsSpec defines the specification for a set of tags.

type VMDeletedError

type VMDeletedError struct {
	ProviderID string
}

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

func (VMDeletedError) Error

func (vde VMDeletedError) Error() string

Error returns the error string.

type VMSS

type VMSS struct {
	ID        string                    `json:"id,omitempty"`
	Name      string                    `json:"name,omitempty"`
	Sku       string                    `json:"sku,omitempty"`
	Capacity  int64                     `json:"capacity,omitempty"`
	Zones     []string                  `json:"zones,omitempty"`
	Image     infrav1.Image             `json:"image,omitempty"`
	State     infrav1.ProvisioningState `json:"vmState,omitempty"`
	Identity  infrav1.VMIdentity        `json:"identity,omitempty"`
	Tags      infrav1.Tags              `json:"tags,omitempty"`
	Instances []VMSSVM                  `json:"instances,omitempty"`
}

VMSS defines a virtual machine scale set.

func (VMSS) HasEnoughLatestModelOrNotMixedModel

func (vmss VMSS) HasEnoughLatestModelOrNotMixedModel() bool

HasEnoughLatestModelOrNotMixedModel returns true if VMSS instance have the latest model applied to all or equal to the capacity.

func (VMSS) HasLatestModelApplied

func (vmss VMSS) HasLatestModelApplied(vm VMSSVM) bool

HasLatestModelApplied returns true if the VMSS instance matches the VMSS image reference.

func (VMSS) HasLatestModelAppliedToAll

func (vmss VMSS) HasLatestModelAppliedToAll() bool

HasLatestModelAppliedToAll returns true if all VMSS instance have the latest model applied.

func (VMSS) HasModelChanges

func (vmss VMSS) HasModelChanges(other VMSS) bool

HasModelChanges returns true if the spec fields which will mutate the Azure VMSS model are different.

func (VMSS) InstancesByProviderID

func (vmss VMSS) InstancesByProviderID(mode infrav1.OrchestrationModeType) map[string]VMSSVM

InstancesByProviderID returns VMSSVMs by ID.

type VMSSVM

type VMSSVM struct {
	ID                 string                        `json:"id,omitempty"`
	InstanceID         string                        `json:"instanceID,omitempty"`
	Image              infrav1.Image                 `json:"image,omitempty"`
	Name               string                        `json:"name,omitempty"`
	AvailabilityZone   string                        `json:"availabilityZone,omitempty"`
	State              infrav1.ProvisioningState     `json:"vmState,omitempty"`
	BootstrappingState infrav1.ProvisioningState     `json:"bootstrappingState,omitempty"`
	OrchestrationMode  infrav1.OrchestrationModeType `json:"orchestrationMode,omitempty"`
}

VMSSVM defines a VM in a virtual machine scale set.

func (VMSSVM) ProviderID

func (vm VMSSVM) ProviderID() string

ProviderID returns the K8s provider ID for the VMSS instance.

Directories

Path Synopsis
Package mock_azure is a generated GoMock package.
Package mock_azure is a generated GoMock package.
mocks
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.
aso
aso/mock_aso
Package mock_aso is a generated GoMock package.
Package mock_aso is a generated GoMock package.
async/mock_async
Package mock_async is a generated GoMock package.
Package mock_async is a generated GoMock package.
availabilitysets/mock_availabilitysets
Package mock_availabilitysets is a generated GoMock package.
Package mock_availabilitysets 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
Run go generate to regenerate this mock.
Run go generate to regenerate this mock.
identities/mock_identities
Package mock_identities is a generated GoMock package.
Package mock_identities 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
Run go generate to regenerate this mock.
Run go generate to regenerate this mock.
managedclusters/mock_managedclusters
Code generated by MockGen.
Code generated by MockGen.
natgateways/mock_natgateways
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
Run go generate to regenerate this mock.
Run go generate to regenerate this mock.
privateendpoints/mock_privateendpoints
Run go generate to regenerate this mock.
Run go generate to regenerate this mock.
publicips/mock_publicips
Package mock_publicips is a generated GoMock package.
Package mock_publicips is a generated GoMock package.
resourcehealth/mock_resourcehealth
Package mock_resourcehealth is a generated GoMock package.
Package mock_resourcehealth 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
Run go generate to regenerate this mock.
Run go generate to regenerate this mock.
scalesets/mock_scalesets
Package mock_scalesets is a generated GoMock package.
Package mock_scalesets is a generated GoMock package.
scalesetvms/mock_scalesetvms
Package mock_scalesetvms is a generated GoMock package.
Package mock_scalesetvms is a generated GoMock package.
securitygroups/mock_securitygroups
Run go generate to regenerate this mock.
Run go generate to regenerate this mock.
subnets/mock_subnets
Run go generate to regenerate this mock.
Run go generate to regenerate this mock.
tags/mock_tags
Package mock_tags is a generated GoMock package.
Package mock_tags is a generated GoMock package.
virtualmachineimages/mock_virtualmachineimages
Package mock_virtualmachineimages is a generated GoMock package.
Package mock_virtualmachineimages 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
Run go generate to regenerate this mock.
Run go generate to regenerate this mock.
vmextensions/mock_vmextensions
Run go generate to regenerate this mock.
Run go generate to regenerate this mock.
vnetpeerings/mock_vnetpeerings
Run go generate to regenerate this mock.
Run go generate to regenerate this mock.

Jump to

Keyboard shortcuts

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