scope

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 84 Imported by: 4

Documentation

Index

Constants

View Source
const AzureSecretKey = "clientSecret"

AzureSecretKey is the value for they client secret key.

View Source
const (
	// MachinePoolMachineScopeName is the sourceName, or more specifically the UserAgent, of client used in cordon and drain.
	MachinePoolMachineScopeName = "azuremachinepoolmachine-scope"
)
View Source
const ScalesetsServiceName = "scalesets"

ScalesetsServiceName is the name of the scalesets service. TODO: move this to scalesets.go once we remove the usage in this package, added here to avoid a circular dependency.

Variables

This section is empty.

Functions

func IsClusterNamespaceAllowed

func IsClusterNamespaceAllowed(ctx context.Context, k8sClient client.Client, allowedNamespaces *infrav1.AllowedNamespaces, namespace string) bool

IsClusterNamespaceAllowed indicates if the cluster namespace is allowed.

func NewWorkloadIdentityCredential added in v1.10.0

func NewWorkloadIdentityCredential(options *WorkloadIdentityCredentialOptions) (azcore.TokenCredential, error)

NewWorkloadIdentityCredential returns a workload identity credential.

Types

type AzureClients

type AzureClients struct {
	auth.EnvironmentSettings

	Authorizer                 autorest.Authorizer
	TokenCredential            azcore.TokenCredential
	ResourceManagerEndpoint    string
	ResourceManagerVMDNSSuffix string
}

AzureClients contains all the Azure clients used by the scopes.

func (*AzureClients) ClientID

func (c *AzureClients) ClientID() string

ClientID returns the Azure client id from the controller environment.

func (*AzureClients) ClientSecret

func (c *AzureClients) ClientSecret() string

ClientSecret returns the Azure client secret from the controller environment.

func (*AzureClients) CloudEnvironment

func (c *AzureClients) CloudEnvironment() string

CloudEnvironment returns the Azure environment the controller runs in.

func (*AzureClients) HashKey

func (c *AzureClients) HashKey() string

HashKey returns a base64 url encoded sha256 hash for the Auth scope (Azure TenantID + CloudEnv + SubscriptionID + ClientID).

func (*AzureClients) SubscriptionID

func (c *AzureClients) SubscriptionID() string

SubscriptionID returns the Azure subscription id of the cluster, either specified or from the environment.

func (*AzureClients) TenantID

func (c *AzureClients) TenantID() string

TenantID returns the Azure tenant id the controller runs in.

func (*AzureClients) Token added in v1.11.0

func (c *AzureClients) Token() azcore.TokenCredential

Token returns the Azure token credential of the cluster used for SDKv2 services.

type AzureClusterCredentialsProvider

type AzureClusterCredentialsProvider struct {
	AzureCredentialsProvider
	AzureCluster *infrav1.AzureCluster
}

AzureClusterCredentialsProvider wraps AzureCredentialsProvider with AzureCluster.

func NewAzureClusterCredentialsProvider

func NewAzureClusterCredentialsProvider(ctx context.Context, kubeClient client.Client, azureCluster *infrav1.AzureCluster) (*AzureClusterCredentialsProvider, error)

NewAzureClusterCredentialsProvider creates a new AzureClusterCredentialsProvider from the supplied inputs.

func (*AzureClusterCredentialsProvider) GetAuthorizer

func (p *AzureClusterCredentialsProvider) GetAuthorizer(ctx context.Context, tokenCredential azcore.TokenCredential, tokenAudience string) (autorest.Authorizer, error)

GetAuthorizer returns an Azure authorizer based on the provided azure identity. It delegates to AzureCredentialsProvider with AzureCluster metadata.

func (*AzureClusterCredentialsProvider) GetTokenCredential added in v1.11.0

func (p *AzureClusterCredentialsProvider) GetTokenCredential(ctx context.Context, resourceManagerEndpoint, activeDirectoryEndpoint, tokenAudience string) (azcore.TokenCredential, error)

GetTokenCredential returns an Azure TokenCredential based on the provided azure identity.

type AzureCredentialsProvider

type AzureCredentialsProvider struct {
	Client   client.Client
	Identity *infrav1.AzureClusterIdentity
}

AzureCredentialsProvider represents a credential provider with azure cluster identity.

func (*AzureCredentialsProvider) GetAuthorizer

func (p *AzureCredentialsProvider) GetAuthorizer(ctx context.Context, cred azcore.TokenCredential, tokenAudience string) (autorest.Authorizer, error)

GetAuthorizer returns an Azure authorizer based on the provided azure identity, cluster metadata, and tokenCredential.

func (*AzureCredentialsProvider) GetClientID added in v0.5.1

func (p *AzureCredentialsProvider) GetClientID() string

GetClientID returns the Client ID associated with the AzureCredentialsProvider's Identity.

func (*AzureCredentialsProvider) GetClientSecret added in v0.5.1

func (p *AzureCredentialsProvider) GetClientSecret(ctx context.Context) (string, error)

GetClientSecret returns the Client Secret associated with the AzureCredentialsProvider's Identity. NOTE: this only works if the Identity references a Service Principal Client Secret. If using another type of credentials, such a Certificate, we return an empty string.

func (*AzureCredentialsProvider) GetTenantID added in v0.5.1

func (p *AzureCredentialsProvider) GetTenantID() string

GetTenantID returns the Tenant ID associated with the AzureCredentialsProvider's Identity.

func (*AzureCredentialsProvider) GetTokenCredential added in v1.11.0

func (p *AzureCredentialsProvider) GetTokenCredential(ctx context.Context, resourceManagerEndpoint, activeDirectoryEndpoint, tokenAudience string, clusterMeta metav1.ObjectMeta) (azcore.TokenCredential, error)

GetTokenCredential returns an Azure TokenCredential based on the provided azure identity.

type ClusterCache added in v1.4.2

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

ClusterCache stores ClusterCache data locally so we don't have to hit the API multiple times within the same reconcile loop.

type ClusterScope

type ClusterScope struct {
	Client client.Client

	AzureClients
	Cluster      *clusterv1.Cluster
	AzureCluster *infrav1.AzureCluster
	// contains filtered or unexported fields
}

ClusterScope defines the basic context for an actuator to operate upon.

func NewClusterScope

func NewClusterScope(ctx context.Context, params ClusterScopeParams) (*ClusterScope, error)

NewClusterScope creates a new Scope from the supplied parameters. This is meant to be called for each reconcile iteration.

func (*ClusterScope) APIServerHost

func (s *ClusterScope) APIServerHost() string

APIServerHost returns the hostname used to reach the API server.

func (*ClusterScope) APIServerLB

func (s *ClusterScope) APIServerLB() *infrav1.LoadBalancerSpec

APIServerLB returns the cluster API Server load balancer.

func (*ClusterScope) APIServerLBName

func (s *ClusterScope) APIServerLBName() string

APIServerLBName returns the API Server LB name.

func (*ClusterScope) APIServerLBPoolName

func (s *ClusterScope) APIServerLBPoolName() string

APIServerLBPoolName returns the API Server LB backend pool name.

func (*ClusterScope) APIServerPort

func (s *ClusterScope) APIServerPort() int32

APIServerPort returns the APIServerPort to use when creating the load balancer.

func (*ClusterScope) APIServerPrivateIP

func (s *ClusterScope) APIServerPrivateIP() string

APIServerPrivateIP returns the API Server private IP.

func (*ClusterScope) APIServerPublicIP

func (s *ClusterScope) APIServerPublicIP() *infrav1.PublicIPSpec

APIServerPublicIP returns the API Server public IP.

func (*ClusterScope) AdditionalTags

func (s *ClusterScope) AdditionalTags() infrav1.Tags

AdditionalTags returns AdditionalTags from the scope's AzureCluster.

func (*ClusterScope) AnnotationJSON added in v1.0.0

func (s *ClusterScope) AnnotationJSON(annotation string) (map[string]interface{}, error)

AnnotationJSON returns a map[string]interface from a JSON annotation.

func (*ClusterScope) Authorizer

func (s *ClusterScope) Authorizer() autorest.Authorizer

Authorizer returns the Azure client Authorizer which is used for SDKv1 services.

func (*ClusterScope) AvailabilitySetEnabled

func (s *ClusterScope) AvailabilitySetEnabled() bool

AvailabilitySetEnabled informs machines that they should be part of an Availability Set.

func (*ClusterScope) AzureBastion added in v1.2.0

func (s *ClusterScope) AzureBastion() *infrav1.AzureBastion

AzureBastion returns the cluster AzureBastion.

func (*ClusterScope) AzureBastionSpec added in v1.2.0

func (s *ClusterScope) AzureBastionSpec() azure.ResourceSpecGetter

AzureBastionSpec returns the bastion spec.

func (*ClusterScope) BaseURI

func (s *ClusterScope) BaseURI() string

BaseURI returns the Azure ResourceManagerEndpoint.

func (*ClusterScope) Close

func (s *ClusterScope) Close(ctx context.Context) error

Close closes the current scope persisting the cluster configuration and status.

func (*ClusterScope) CloudProviderConfigOverrides

func (s *ClusterScope) CloudProviderConfigOverrides() *infrav1.CloudProviderConfigOverrides

CloudProviderConfigOverrides returns the cloud provider config overrides for the cluster.

func (*ClusterScope) ClusterName

func (s *ClusterScope) ClusterName() string

ClusterName returns the cluster name.

func (*ClusterScope) ControlPlaneOutboundLB

func (s *ClusterScope) ControlPlaneOutboundLB() *infrav1.LoadBalancerSpec

ControlPlaneOutboundLB returns the cluster control plane outbound load balancer.

func (*ClusterScope) ControlPlaneRouteTable

func (s *ClusterScope) ControlPlaneRouteTable() infrav1.RouteTable

ControlPlaneRouteTable returns the cluster controlplane routetable.

func (*ClusterScope) ControlPlaneSubnet

func (s *ClusterScope) ControlPlaneSubnet() infrav1.SubnetSpec

ControlPlaneSubnet returns the cluster control plane subnet.

func (*ClusterScope) DeleteLongRunningOperationState added in v0.5.3

func (s *ClusterScope) DeleteLongRunningOperationState(name, service, futureType string)

DeleteLongRunningOperationState will delete the future from the AzureCluster status.

func (*ClusterScope) ExtendedLocation added in v1.8.0

func (s *ClusterScope) ExtendedLocation() *infrav1.ExtendedLocationSpec

ExtendedLocation returns the cluster extendedLocation.

func (*ClusterScope) ExtendedLocationName added in v1.8.0

func (s *ClusterScope) ExtendedLocationName() string

ExtendedLocationName returns ExtendedLocation name for the cluster.

func (*ClusterScope) ExtendedLocationType added in v1.8.0

func (s *ClusterScope) ExtendedLocationType() string

ExtendedLocationType returns ExtendedLocation type for the cluster.

func (*ClusterScope) FailureDomains added in v0.5.3

func (s *ClusterScope) FailureDomains() []*string

FailureDomains returns the failure domains for the cluster.

func (*ClusterScope) GenerateFQDN

func (s *ClusterScope) GenerateFQDN(ipName string) string

GenerateFQDN generates a fully qualified domain name, based on a hash, cluster name and cluster location.

func (*ClusterScope) GenerateLegacyFQDN

func (s *ClusterScope) GenerateLegacyFQDN() (ip string, domain string)

GenerateLegacyFQDN generates an IP name and a fully qualified domain name, based on a hash, cluster name and cluster location. Deprecated: use GenerateFQDN instead.

func (*ClusterScope) GetClient added in v1.10.0

func (s *ClusterScope) GetClient() client.Client

GetClient returns the controller-runtime client.

func (*ClusterScope) GetLongRunningOperationState added in v0.5.3

func (s *ClusterScope) GetLongRunningOperationState(name, service, futureType string) *infrav1.Future

GetLongRunningOperationState will get the future on the AzureCluster status.

func (*ClusterScope) GetPrivateDNSZoneName

func (s *ClusterScope) GetPrivateDNSZoneName() string

GetPrivateDNSZoneName returns the Private DNS Zone from the spec or generate it from cluster name.

func (*ClusterScope) GroupSpec added in v0.5.3

func (s *ClusterScope) GroupSpec() azure.ASOResourceSpecGetter

GroupSpec returns the resource group spec.

func (*ClusterScope) IsAPIServerPrivate

func (s *ClusterScope) IsAPIServerPrivate() bool

IsAPIServerPrivate returns true if the API Server LB is of type Internal.

func (*ClusterScope) IsAzureBastionEnabled added in v1.2.0

func (s *ClusterScope) IsAzureBastionEnabled() bool

IsAzureBastionEnabled returns true if the azure bastion is enabled.

func (*ClusterScope) IsIPv6Enabled

func (s *ClusterScope) IsIPv6Enabled() bool

IsIPv6Enabled returns true if IPv6 is enabled.

func (*ClusterScope) IsVnetManaged

func (s *ClusterScope) IsVnetManaged() bool

IsVnetManaged returns true if the vnet is managed.

func (*ClusterScope) LBSpecs

func (s *ClusterScope) LBSpecs() []azure.ResourceSpecGetter

LBSpecs returns the load balancer specs.

func (*ClusterScope) ListOptionsLabelSelector

func (s *ClusterScope) ListOptionsLabelSelector() client.ListOption

ListOptionsLabelSelector returns a ListOptions with a label selector for clusterName.

func (*ClusterScope) Location

func (s *ClusterScope) Location() string

Location returns the cluster location.

func (*ClusterScope) NSGSpecs

func (s *ClusterScope) NSGSpecs() []azure.ResourceSpecGetter

NSGSpecs returns the security group specs.

func (*ClusterScope) Namespace

func (s *ClusterScope) Namespace() string

Namespace returns the cluster namespace.

func (*ClusterScope) NatGatewaySpecs

func (s *ClusterScope) NatGatewaySpecs() []azure.ResourceSpecGetter

NatGatewaySpecs returns the node NAT gateway.

func (*ClusterScope) NodeOutboundLB

func (s *ClusterScope) NodeOutboundLB() *infrav1.LoadBalancerSpec

NodeOutboundLB returns the cluster node outbound load balancer.

func (*ClusterScope) NodeSubnets added in v0.5.1

func (s *ClusterScope) NodeSubnets() []infrav1.SubnetSpec

NodeSubnets returns the subnets with the node role.

func (*ClusterScope) OutboundLBName

func (s *ClusterScope) OutboundLBName(role string) string

OutboundLBName returns the name of the outbound LB.

func (*ClusterScope) OutboundPoolName

func (s *ClusterScope) OutboundPoolName(role string) string

OutboundPoolName returns the outbound LB backend pool name.

func (*ClusterScope) PatchObject

func (s *ClusterScope) PatchObject(ctx context.Context) error

PatchObject persists the cluster configuration and status.

func (*ClusterScope) PrivateDNSSpec

func (s *ClusterScope) PrivateDNSSpec() (zoneSpec azure.ResourceSpecGetter, linkSpec, recordSpec []azure.ResourceSpecGetter)

PrivateDNSSpec returns the private dns zone spec.

func (*ClusterScope) PrivateEndpointSpecs added in v1.8.0

func (s *ClusterScope) PrivateEndpointSpecs() []azure.ResourceSpecGetter

PrivateEndpointSpecs returns the private endpoint specs.

func (*ClusterScope) PublicIPSpecs

func (s *ClusterScope) PublicIPSpecs() []azure.ResourceSpecGetter

PublicIPSpecs returns the public IP specs.

func (*ClusterScope) ResourceGroup

func (s *ClusterScope) ResourceGroup() string

ResourceGroup returns the cluster resource group.

func (*ClusterScope) RouteTableSpecs

func (s *ClusterScope) RouteTableSpecs() []azure.ResourceSpecGetter

RouteTableSpecs returns the subnet route tables.

func (*ClusterScope) SetAnnotation added in v1.0.0

func (s *ClusterScope) SetAnnotation(key, value string)

SetAnnotation sets a key value annotation on the AzureCluster.

func (*ClusterScope) SetControlPlaneSecurityRules

func (s *ClusterScope) SetControlPlaneSecurityRules()

SetControlPlaneSecurityRules sets the default security rules of the control plane subnet. Note that this is not done in a webhook as it requires a valid Cluster object to exist to get the API Server port.

func (*ClusterScope) SetDNSName

func (s *ClusterScope) SetDNSName()

SetDNSName sets the API Server public IP DNS name. Note: this logic exists only for purposes of ensuring backwards compatibility for old clusters created without an APIServerLB, and should be removed in the future.

func (*ClusterScope) SetFailureDomain

func (s *ClusterScope) SetFailureDomain(id string, spec clusterv1.FailureDomainSpec)

SetFailureDomain will set the spec for a for a given key.

func (*ClusterScope) SetLongRunningOperationState added in v0.5.3

func (s *ClusterScope) SetLongRunningOperationState(future *infrav1.Future)

SetLongRunningOperationState will set the future on the AzureCluster status to allow the resource to continue in the next reconciliation.

func (*ClusterScope) SetNatGatewayIDInSubnets added in v1.1.0

func (s *ClusterScope) SetNatGatewayIDInSubnets(name string, id string)

SetNatGatewayIDInSubnets sets the NAT Gateway ID in the subnets with the same name.

func (*ClusterScope) SetSubnet

func (s *ClusterScope) SetSubnet(subnetSpec infrav1.SubnetSpec)

SetSubnet sets the subnet spec for the subnet with the same name.

func (*ClusterScope) Subnet added in v0.5.1

func (s *ClusterScope) Subnet(name string) infrav1.SubnetSpec

Subnet returns the subnet with the provided name.

func (*ClusterScope) SubnetSpecs

func (s *ClusterScope) SubnetSpecs() []azure.ResourceSpecGetter

SubnetSpecs returns the subnets specs.

func (*ClusterScope) Subnets

func (s *ClusterScope) Subnets() infrav1.Subnets

Subnets returns the cluster subnets.

func (*ClusterScope) UpdateAnnotationJSON added in v1.0.0

func (s *ClusterScope) UpdateAnnotationJSON(annotation string, content map[string]interface{}) error

UpdateAnnotationJSON updates the `annotation` with `content`. `content` in this case should be a `map[string]interface{}` suitable for turning into JSON. This `content` map will be marshalled into a JSON string before being set as the given `annotation`.

func (*ClusterScope) UpdateDeleteStatus added in v0.5.3

func (s *ClusterScope) UpdateDeleteStatus(condition clusterv1.ConditionType, service string, err error)

UpdateDeleteStatus updates a condition on the AzureCluster status after a DELETE operation.

func (*ClusterScope) UpdatePatchStatus added in v0.5.3

func (s *ClusterScope) UpdatePatchStatus(condition clusterv1.ConditionType, service string, err error)

UpdatePatchStatus updates a condition on the AzureCluster status after a PATCH operation.

func (*ClusterScope) UpdatePutStatus added in v0.5.3

func (s *ClusterScope) UpdatePutStatus(condition clusterv1.ConditionType, service string, err error)

UpdatePutStatus updates a condition on the AzureCluster status after a PUT operation.

func (*ClusterScope) UpdateSubnetCIDRs added in v1.2.0

func (s *ClusterScope) UpdateSubnetCIDRs(name string, cidrBlocks []string)

UpdateSubnetCIDRs updates the subnet CIDRs for the subnet with the same name.

func (*ClusterScope) UpdateSubnetID added in v1.2.0

func (s *ClusterScope) UpdateSubnetID(name string, id string)

UpdateSubnetID updates the subnet ID for the subnet with the same name.

func (*ClusterScope) VNetSpec

func (s *ClusterScope) VNetSpec() azure.ResourceSpecGetter

VNetSpec returns the virtual network spec.

func (*ClusterScope) Vnet

func (s *ClusterScope) Vnet() *infrav1.VnetSpec

Vnet returns the cluster Vnet.

func (*ClusterScope) VnetPeeringSpecs added in v1.0.0

func (s *ClusterScope) VnetPeeringSpecs() []azure.ResourceSpecGetter

VnetPeeringSpecs returns the virtual network peering specs.

type ClusterScopeParams

type ClusterScopeParams struct {
	AzureClients
	Client       client.Client
	Cluster      *clusterv1.Cluster
	AzureCluster *infrav1.AzureCluster
	Cache        *ClusterCache
}

ClusterScopeParams defines the input parameters used to create a new Scope.

type CredentialsProvider

type CredentialsProvider interface {
	GetAuthorizer(ctx context.Context, tokenCredential azcore.TokenCredential, tokenAudience string) (autorest.Authorizer, error)
	GetClientID() string
	GetClientSecret(ctx context.Context) (string, error)
	GetTenantID() string
	GetTokenCredential(ctx context.Context, resourceManagerEndpoint, activeDirectoryEndpoint, tokenAudience string) (azcore.TokenCredential, error)
}

CredentialsProvider defines the behavior for azure identity based credential providers.

type MachineCache added in v1.1.0

type MachineCache struct {
	BootstrapData string
	VMImage       *infrav1.Image
	VMSKU         resourceskus.SKU
	// contains filtered or unexported fields
}

MachineCache stores common machine information so we don't have to hit the API multiple times within the same reconcile loop.

type MachinePoolCache added in v1.11.0

type MachinePoolCache struct {
	BootstrapData           string
	HasBootstrapDataChanges bool
	VMImage                 *infrav1.Image
	VMSKU                   resourceskus.SKU
	MaxSurge                int
}

MachinePoolCache stores common machine pool information so we don't have to hit the API multiple times within the same reconcile loop.

type MachinePoolMachineScope

type MachinePoolMachineScope struct {
	azure.ClusterScoper
	AzureMachinePoolMachine *infrav1exp.AzureMachinePoolMachine
	AzureMachinePool        *infrav1exp.AzureMachinePool
	MachinePool             *expv1.MachinePool
	MachinePoolScope        *MachinePoolScope
	// contains filtered or unexported fields
}

MachinePoolMachineScope defines a scope defined around a machine pool machine.

func NewMachinePoolMachineScope

func NewMachinePoolMachineScope(params MachinePoolMachineScopeParams) (*MachinePoolMachineScope, error)

NewMachinePoolMachineScope creates a new MachinePoolMachineScope from the supplied parameters. This is meant to be called for each reconcile iteration.

func (*MachinePoolMachineScope) Close

Close updates the state of MachinePoolMachine.

func (*MachinePoolMachineScope) CordonAndDrain

func (s *MachinePoolMachineScope) CordonAndDrain(ctx context.Context) error

CordonAndDrain will cordon and drain the Kubernetes node associated with this AzureMachinePoolMachine.

func (*MachinePoolMachineScope) DeleteLongRunningOperationState added in v0.5.3

func (s *MachinePoolMachineScope) DeleteLongRunningOperationState(name, service, futureType string)

DeleteLongRunningOperationState will delete the future from the AzureMachinePoolMachine status.

func (*MachinePoolMachineScope) GetLongRunningOperationState

func (s *MachinePoolMachineScope) GetLongRunningOperationState(name, service, futureType string) *infrav1.Future

GetLongRunningOperationState will get the future on the AzureMachinePoolMachine status.

func (*MachinePoolMachineScope) GetNode added in v1.5.0

GetNode returns the node associated with the AzureMachinePoolMachine. Returns an error if one occurred, and a boolean indicating if the node was found if there was no error.

func (*MachinePoolMachineScope) InstanceID

func (s *MachinePoolMachineScope) InstanceID() string

InstanceID is the unique ID of the machine within the Machine Pool.

func (*MachinePoolMachineScope) IsReady

func (s *MachinePoolMachineScope) IsReady() bool

IsReady indicates the machine has successfully provisioned and has a node ref associated.

func (*MachinePoolMachineScope) Name

func (s *MachinePoolMachineScope) Name() string

Name is the name of the Machine Pool Machine.

func (*MachinePoolMachineScope) OrchestrationMode added in v1.7.3

func (s *MachinePoolMachineScope) OrchestrationMode() infrav1.OrchestrationModeType

OrchestrationMode is the VMSS orchestration mode, either Uniform or Flexible.

func (*MachinePoolMachineScope) PatchObject added in v1.5.0

func (s *MachinePoolMachineScope) PatchObject(ctx context.Context) error

PatchObject persists the MachinePoolMachine spec and status.

func (*MachinePoolMachineScope) ProviderID

func (s *MachinePoolMachineScope) ProviderID() string

ProviderID returns the AzureMachinePool ID by parsing Spec.FakeProviderID.

func (*MachinePoolMachineScope) ProvisioningState

func (s *MachinePoolMachineScope) ProvisioningState() infrav1.ProvisioningState

ProvisioningState returns the AzureMachinePoolMachine provisioning state.

func (*MachinePoolMachineScope) ScaleSetName

func (s *MachinePoolMachineScope) ScaleSetName() string

ScaleSetName is the name of the VMSS.

func (*MachinePoolMachineScope) ScaleSetVMSpec added in v1.11.0

func (s *MachinePoolMachineScope) ScaleSetVMSpec() azure.ResourceSpecGetter

ScaleSetVMSpec returns the VMSS VM spec.

func (*MachinePoolMachineScope) SetFailureMessage

func (s *MachinePoolMachineScope) SetFailureMessage(v error)

SetFailureMessage sets the AzureMachinePoolMachine status failure message.

func (*MachinePoolMachineScope) SetFailureReason

func (s *MachinePoolMachineScope) SetFailureReason(v capierrors.MachineStatusError)

SetFailureReason sets the AzureMachinePoolMachine status failure reason.

func (*MachinePoolMachineScope) SetLongRunningOperationState

func (s *MachinePoolMachineScope) SetLongRunningOperationState(future *infrav1.Future)

SetLongRunningOperationState will set the future on the AzureMachinePoolMachine status to allow the resource to continue in the next reconciliation.

func (*MachinePoolMachineScope) SetVMSSVM

func (s *MachinePoolMachineScope) SetVMSSVM(instance *azure.VMSSVM)

SetVMSSVM update the scope with the current state of the VMSS VM.

func (*MachinePoolMachineScope) SetVMSSVMState added in v1.11.0

func (s *MachinePoolMachineScope) SetVMSSVMState(state infrav1.ProvisioningState)

SetVMSSVMState update the scope with the current provisioning state of the VMSS VM.

func (*MachinePoolMachineScope) UpdateDeleteStatus added in v0.5.3

func (s *MachinePoolMachineScope) UpdateDeleteStatus(condition clusterv1.ConditionType, service string, err error)

UpdateDeleteStatus updates a condition on the AzureMachinePoolMachine status after a DELETE operation.

func (*MachinePoolMachineScope) UpdateInstanceStatus added in v1.5.0

func (s *MachinePoolMachineScope) UpdateInstanceStatus(ctx context.Context) error

UpdateInstanceStatus updates the provisioning state of the AzureMachinePoolMachine and if it has the latest model applied using the VMSS VM instance. Note: This func should be called at the end of a reconcile request and after updating the scope with the most recent Azure data.

func (*MachinePoolMachineScope) UpdateNodeStatus added in v1.5.0

func (s *MachinePoolMachineScope) UpdateNodeStatus(ctx context.Context) error

UpdateNodeStatus updates AzureMachinePoolMachine conditions and ready status. It will also update the node ref and the Kubernetes version of the VM instance if the node is found. Note: This func should be called at the end of a reconcile request and after updating the scope with the most recent Azure data.

func (*MachinePoolMachineScope) UpdatePatchStatus added in v0.5.3

func (s *MachinePoolMachineScope) UpdatePatchStatus(condition clusterv1.ConditionType, service string, err error)

UpdatePatchStatus updates a condition on the AzureMachinePoolMachine status after a PATCH operation.

func (*MachinePoolMachineScope) UpdatePutStatus added in v0.5.3

func (s *MachinePoolMachineScope) UpdatePutStatus(condition clusterv1.ConditionType, service string, err error)

UpdatePutStatus updates a condition on the AzureMachinePoolMachine status after a PUT operation.

type MachinePoolMachineScopeParams

type MachinePoolMachineScopeParams struct {
	AzureMachinePool        *infrav1exp.AzureMachinePool
	AzureMachinePoolMachine *infrav1exp.AzureMachinePoolMachine
	Client                  client.Client
	ClusterScope            azure.ClusterScoper
	MachinePool             *expv1.MachinePool
	// contains filtered or unexported fields
}

MachinePoolMachineScopeParams defines the input parameters used to create a new MachinePoolScope.

type MachinePoolScope

type MachinePoolScope struct {
	azure.ClusterScoper
	AzureMachinePool *infrav1exp.AzureMachinePool
	MachinePool      *expv1.MachinePool
	// contains filtered or unexported fields
}

MachinePoolScope defines a scope defined around a machine pool and its cluster.

func NewMachinePoolScope

func NewMachinePoolScope(params MachinePoolScopeParams) (*MachinePoolScope, error)

NewMachinePoolScope creates a new MachinePoolScope from the supplied parameters. This is meant to be called for each reconcile iteration.

func (*MachinePoolScope) AdditionalTags

func (m *MachinePoolScope) AdditionalTags() infrav1.Tags

AdditionalTags merges AdditionalTags from the scope's AzureCluster and AzureMachinePool. If the same key is present in both, the value from AzureMachinePool takes precedence.

func (*MachinePoolScope) Close

func (m *MachinePoolScope) Close(ctx context.Context) error

Close the MachinePoolScope by updating the AzureMachinePool spec and AzureMachinePool status.

func (*MachinePoolScope) DeleteLongRunningOperationState added in v0.5.3

func (m *MachinePoolScope) DeleteLongRunningOperationState(name, service, futureType string)

DeleteLongRunningOperationState will delete the future from the AzureMachinePool status.

func (MachinePoolScope) DesiredReplicas

func (m MachinePoolScope) DesiredReplicas() int32

DesiredReplicas returns the replica count on machine pool or 0 if machine pool replicas is nil.

func (*MachinePoolScope) GetBootstrapData

func (m *MachinePoolScope) GetBootstrapData(ctx context.Context) (string, error)

GetBootstrapData returns the bootstrap data from the secret in the MachinePool's bootstrap.dataSecretName.

func (*MachinePoolScope) GetLongRunningOperationState

func (m *MachinePoolScope) GetLongRunningOperationState(name, service, futureType string) *infrav1.Future

GetLongRunningOperationState will get the future on the AzureMachinePool status.

func (*MachinePoolScope) GetVMImage

func (m *MachinePoolScope) GetVMImage(ctx context.Context) (*infrav1.Image, error)

GetVMImage picks an image from the AzureMachinePool configuration, or uses a default one.

func (*MachinePoolScope) HasBootstrapDataChanges added in v1.7.3

func (m *MachinePoolScope) HasBootstrapDataChanges(ctx context.Context) (bool, error)

HasBootstrapDataChanges calculates the sha256 hash of the bootstrap data and compares it with the saved hash in AzureMachinePool.Status.

func (*MachinePoolScope) HasReplicasExternallyManaged added in v1.7.0

func (m *MachinePoolScope) HasReplicasExternallyManaged(ctx context.Context) bool

HasReplicasExternallyManaged returns true if the externally managed annotation is set on the CAPI MachinePool resource.

func (*MachinePoolScope) HasSystemAssignedIdentity added in v1.3.0

func (m *MachinePoolScope) HasSystemAssignedIdentity() bool

HasSystemAssignedIdentity returns true if the azure machine pool has system assigned identity.

func (*MachinePoolScope) InitMachinePoolCache added in v1.11.0

func (m *MachinePoolScope) InitMachinePoolCache(ctx context.Context) error

InitMachinePoolCache sets cached information about the machine pool to be used in the scope.

func (MachinePoolScope) MaxSurge

func (m MachinePoolScope) MaxSurge() (int, error)

MaxSurge returns the number of machines to surge, or 0 if the deployment strategy does not support surge.

func (*MachinePoolScope) Name

func (m *MachinePoolScope) Name() string

Name returns the Azure Machine Pool Name.

func (*MachinePoolScope) NeedsRequeue

func (m *MachinePoolScope) NeedsRequeue() bool

NeedsRequeue return true if any machines are not on the latest model or the VMSS is not in a terminal provisioning state.

func (*MachinePoolScope) PatchCAPIMachinePoolObject added in v1.7.0

func (m *MachinePoolScope) PatchCAPIMachinePoolObject(ctx context.Context) error

PatchCAPIMachinePoolObject persists the capi machinepool configuration and status.

func (*MachinePoolScope) PatchObject

func (m *MachinePoolScope) PatchObject(ctx context.Context) error

PatchObject persists the AzureMachinePool spec and status.

func (*MachinePoolScope) ProviderID

func (m *MachinePoolScope) ProviderID() string

ProviderID returns the AzureMachinePool ID by parsing Spec.ProviderID.

func (*MachinePoolScope) ProvisioningState

func (m *MachinePoolScope) ProvisioningState() infrav1.ProvisioningState

ProvisioningState returns the AzureMachinePool provisioning state.

func (*MachinePoolScope) ReconcileReplicas added in v1.7.0

func (m *MachinePoolScope) ReconcileReplicas(ctx context.Context, vmss *azure.VMSS) error

ReconcileReplicas ensures MachinePool replicas match VMSS capacity if replicas are externally managed by an autoscaler.

func (*MachinePoolScope) RoleAssignmentResourceType added in v1.3.0

func (m *MachinePoolScope) RoleAssignmentResourceType() string

RoleAssignmentResourceType returns the role assignment resource type.

func (*MachinePoolScope) RoleAssignmentSpecs

func (m *MachinePoolScope) RoleAssignmentSpecs(principalID *string) []azure.ResourceSpecGetter

RoleAssignmentSpecs returns the role assignment specs.

func (*MachinePoolScope) SaveVMImageToStatus

func (m *MachinePoolScope) SaveVMImageToStatus(image *infrav1.Image)

SaveVMImageToStatus persists the AzureMachinePool image to the status.

func (*MachinePoolScope) ScaleSetSpec

ScaleSetSpec returns the scale set spec.

func (*MachinePoolScope) SetAnnotation

func (m *MachinePoolScope) SetAnnotation(key, value string)

SetAnnotation sets a key value annotation on the AzureMachinePool.

func (*MachinePoolScope) SetFailureMessage

func (m *MachinePoolScope) SetFailureMessage(v error)

SetFailureMessage sets the AzureMachinePool status failure message.

func (*MachinePoolScope) SetFailureReason

func (m *MachinePoolScope) SetFailureReason(v capierrors.MachineStatusError)

SetFailureReason sets the AzureMachinePool status failure reason.

func (*MachinePoolScope) SetLongRunningOperationState

func (m *MachinePoolScope) SetLongRunningOperationState(future *infrav1.Future)

SetLongRunningOperationState will set the future on the AzureMachinePool status to allow the resource to continue in the next reconciliation.

func (*MachinePoolScope) SetNotReady

func (m *MachinePoolScope) SetNotReady()

SetNotReady sets the AzureMachinePool Ready Status to false.

func (*MachinePoolScope) SetProviderID

func (m *MachinePoolScope) SetProviderID(v string)

SetProviderID sets the AzureMachinePool providerID in spec.

func (*MachinePoolScope) SetReady

func (m *MachinePoolScope) SetReady()

SetReady sets the AzureMachinePool Ready Status to true.

func (*MachinePoolScope) SetSubnetName added in v0.5.1

func (m *MachinePoolScope) SetSubnetName() error

SetSubnetName defaults the AzureMachinePool subnet name to the name of the subnet with role 'node' when there is only one of them. Note: this logic exists only for purposes of ensuring backwards compatibility for old clusters created without the `subnetName` field being set, and should be removed in the future when this field is no longer optional.

func (*MachinePoolScope) SetVMSSState

func (m *MachinePoolScope) SetVMSSState(vmssState *azure.VMSS)

SetVMSSState updates the machine pool scope with the current state of the VMSS.

func (*MachinePoolScope) SystemAssignedIdentityDefinitionID added in v1.8.0

func (m *MachinePoolScope) SystemAssignedIdentityDefinitionID() string

SystemAssignedIdentityDefinitionID returns the role definition ID for the system assigned identity.

func (*MachinePoolScope) SystemAssignedIdentityName added in v1.8.0

func (m *MachinePoolScope) SystemAssignedIdentityName() string

SystemAssignedIdentityName returns the scope for the system assigned identity.

func (*MachinePoolScope) SystemAssignedIdentityScope added in v1.8.0

func (m *MachinePoolScope) SystemAssignedIdentityScope() string

SystemAssignedIdentityScope returns the scope for the system assigned identity.

func (*MachinePoolScope) UpdateCAPIMachinePoolReplicas added in v1.7.0

func (m *MachinePoolScope) UpdateCAPIMachinePoolReplicas(ctx context.Context, replicas *int32)

UpdateCAPIMachinePoolReplicas updates the associated MachinePool replica count.

func (*MachinePoolScope) UpdateDeleteStatus added in v0.5.3

func (m *MachinePoolScope) UpdateDeleteStatus(condition clusterv1.ConditionType, service string, err error)

UpdateDeleteStatus updates a condition on the AzureMachinePool status after a DELETE operation.

func (*MachinePoolScope) UpdatePatchStatus added in v0.5.3

func (m *MachinePoolScope) UpdatePatchStatus(condition clusterv1.ConditionType, service string, err error)

UpdatePatchStatus updates a condition on the AzureMachinePool status after a PATCH operation.

func (*MachinePoolScope) UpdatePutStatus added in v0.5.3

func (m *MachinePoolScope) UpdatePutStatus(condition clusterv1.ConditionType, service string, err error)

UpdatePutStatus updates a condition on the AzureMachinePool status after a PUT operation.

func (*MachinePoolScope) VMSSExtensionSpecs

func (m *MachinePoolScope) VMSSExtensionSpecs() []azure.ResourceSpecGetter

VMSSExtensionSpecs returns the VMSS extension specs.

type MachinePoolScopeParams

type MachinePoolScopeParams struct {
	Client           client.Client
	MachinePool      *expv1.MachinePool
	AzureMachinePool *infrav1exp.AzureMachinePool
	ClusterScope     azure.ClusterScoper
	Cache            *MachinePoolCache
}

MachinePoolScopeParams defines the input parameters used to create a new MachinePoolScope.

type MachineScope

type MachineScope struct {
	azure.ClusterScoper
	Machine      *clusterv1.Machine
	AzureMachine *infrav1.AzureMachine
	// contains filtered or unexported fields
}

MachineScope defines a scope defined around a machine and its cluster.

func NewMachineScope

func NewMachineScope(params MachineScopeParams) (*MachineScope, error)

NewMachineScope creates a new MachineScope from the supplied parameters. This is meant to be called for each reconcile iteration.

func (*MachineScope) AdditionalTags

func (m *MachineScope) AdditionalTags() infrav1.Tags

AdditionalTags merges AdditionalTags from the scope's AzureCluster and AzureMachine. If the same key is present in both, the value from AzureMachine takes precedence.

func (*MachineScope) AnnotationJSON

func (m *MachineScope) AnnotationJSON(annotation string) (map[string]interface{}, error)

AnnotationJSON returns a map[string]interface from a JSON annotation.

func (*MachineScope) AvailabilitySet

func (m *MachineScope) AvailabilitySet() (string, bool)

AvailabilitySet returns the availability set for this machine if available.

func (*MachineScope) AvailabilitySetID added in v1.1.0

func (m *MachineScope) AvailabilitySetID() string

AvailabilitySetID returns the availability set for this machine, or "" if there is no availability set.

func (*MachineScope) AvailabilitySetSpec added in v1.1.0

func (m *MachineScope) AvailabilitySetSpec() azure.ResourceSpecGetter

AvailabilitySetSpec returns the availability set spec for this machine if available.

func (*MachineScope) AvailabilityZone

func (m *MachineScope) AvailabilityZone() string

AvailabilityZone returns the AzureMachine Availability Zone. Priority for selecting the AZ is

  1. Machine.Spec.FailureDomain
  2. AzureMachine.Spec.FailureDomain (This is to support deprecated AZ)
  3. No AZ

func (*MachineScope) BuildNICSpec added in v1.7.0

func (m *MachineScope) BuildNICSpec(nicName string, infrav1NetworkInterface infrav1.NetworkInterface, primaryNetworkInterface bool) *networkinterfaces.NICSpec

BuildNICSpec takes a NetworkInterface from the AzureMachineSpec and returns a NICSpec for use by the networkinterfaces service.

func (*MachineScope) Close

func (m *MachineScope) Close(ctx context.Context) error

Close the MachineScope by updating the machine spec, machine status.

func (*MachineScope) DeleteLongRunningOperationState added in v0.5.3

func (m *MachineScope) DeleteLongRunningOperationState(name, service, futureType string)

DeleteLongRunningOperationState will delete the future from the AzureMachine status.

func (*MachineScope) DiskSpecs

func (m *MachineScope) DiskSpecs() []azure.ResourceSpecGetter

DiskSpecs returns the disk specs.

func (*MachineScope) GetBootstrapData

func (m *MachineScope) GetBootstrapData(ctx context.Context) (string, error)

GetBootstrapData returns the bootstrap data from the secret in the Machine's bootstrap.dataSecretName.

func (*MachineScope) GetLongRunningOperationState added in v0.5.3

func (m *MachineScope) GetLongRunningOperationState(name, service, futureType string) *infrav1.Future

GetLongRunningOperationState will get the future on the AzureMachine status.

func (*MachineScope) GetVMID

func (m *MachineScope) GetVMID() string

GetVMID returns the AzureMachine instance id by parsing the scope's providerID.

func (*MachineScope) GetVMImage

func (m *MachineScope) GetVMImage(ctx context.Context) (*infrav1.Image, error)

GetVMImage returns the image from the machine configuration, or a default one.

func (*MachineScope) HasSystemAssignedIdentity added in v1.3.0

func (m *MachineScope) HasSystemAssignedIdentity() bool

HasSystemAssignedIdentity returns true if the azure machine has system assigned identity.

func (*MachineScope) InboundNatSpecs

func (m *MachineScope) InboundNatSpecs() []azure.ResourceSpecGetter

InboundNatSpecs returns the inbound NAT specs.

func (*MachineScope) InitMachineCache added in v1.1.0

func (m *MachineScope) InitMachineCache(ctx context.Context) error

InitMachineCache sets cached information about the machine to be used in the scope.

func (*MachineScope) IsControlPlane

func (m *MachineScope) IsControlPlane() bool

IsControlPlane returns true if the machine is a control plane.

func (*MachineScope) NICIDs added in v1.1.0

func (m *MachineScope) NICIDs() []string

NICIDs returns the NIC resource IDs.

func (*MachineScope) NICSpecs

func (m *MachineScope) NICSpecs() []azure.ResourceSpecGetter

NICSpecs returns the network interface specs.

func (*MachineScope) Name

func (m *MachineScope) Name() string

Name returns the AzureMachine name.

func (*MachineScope) Namespace

func (m *MachineScope) Namespace() string

Namespace returns the namespace name.

func (*MachineScope) PatchObject

func (m *MachineScope) PatchObject(ctx context.Context) error

PatchObject persists the machine spec and status.

func (*MachineScope) ProviderID

func (m *MachineScope) ProviderID() string

ProviderID returns the AzureMachine providerID from the spec.

func (*MachineScope) PublicIPSpecs

func (m *MachineScope) PublicIPSpecs() []azure.ResourceSpecGetter

PublicIPSpecs returns the public IP specs.

func (*MachineScope) Role

func (m *MachineScope) Role() string

Role returns the machine role from the labels.

func (*MachineScope) RoleAssignmentResourceType added in v1.3.0

func (m *MachineScope) RoleAssignmentResourceType() string

RoleAssignmentResourceType returns the role assignment resource type.

func (*MachineScope) RoleAssignmentSpecs

func (m *MachineScope) RoleAssignmentSpecs(principalID *string) []azure.ResourceSpecGetter

RoleAssignmentSpecs returns the role assignment specs.

func (*MachineScope) SetAddresses

func (m *MachineScope) SetAddresses(addrs []corev1.NodeAddress)

SetAddresses sets the Azure address status.

func (*MachineScope) SetAnnotation

func (m *MachineScope) SetAnnotation(key, value string)

SetAnnotation sets a key value annotation on the AzureMachine.

func (*MachineScope) SetConditionFalse added in v1.7.0

func (m *MachineScope) SetConditionFalse(conditionType clusterv1.ConditionType, reason string, severity clusterv1.ConditionSeverity, message string)

SetConditionFalse sets the specified AzureMachine condition to false.

func (*MachineScope) SetFailureMessage

func (m *MachineScope) SetFailureMessage(v error)

SetFailureMessage sets the AzureMachine status failure message.

func (*MachineScope) SetFailureReason

func (m *MachineScope) SetFailureReason(v capierrors.MachineStatusError)

SetFailureReason sets the AzureMachine status failure reason.

func (*MachineScope) SetLongRunningOperationState added in v0.5.3

func (m *MachineScope) SetLongRunningOperationState(future *infrav1.Future)

SetLongRunningOperationState will set the future on the AzureMachine status to allow the resource to continue in the next reconciliation.

func (*MachineScope) SetNotReady

func (m *MachineScope) SetNotReady()

SetNotReady sets the AzureMachine Ready Status to false.

func (*MachineScope) SetProviderID

func (m *MachineScope) SetProviderID(v string)

SetProviderID sets the AzureMachine providerID in spec.

func (*MachineScope) SetReady

func (m *MachineScope) SetReady()

SetReady sets the AzureMachine Ready Status to true.

func (*MachineScope) SetSubnetName added in v0.5.1

func (m *MachineScope) SetSubnetName() error

SetSubnetName defaults the AzureMachine subnet name to the name of one the subnets with the machine role when there is only one of them. Note: this logic exists only for purposes of ensuring backwards compatibility for old clusters created without the `subnetName` field being set, and should be removed in the future when this field is no longer optional.

func (*MachineScope) SetVMState

func (m *MachineScope) SetVMState(v infrav1.ProvisioningState)

SetVMState sets the AzureMachine VM state.

func (*MachineScope) Subnet

func (m *MachineScope) Subnet() infrav1.SubnetSpec

Subnet returns the machine's subnet.

func (*MachineScope) SystemAssignedIdentityDefinitionID added in v1.8.0

func (m *MachineScope) SystemAssignedIdentityDefinitionID() string

SystemAssignedIdentityDefinitionID returns the role definition id for the system assigned identity.

func (*MachineScope) SystemAssignedIdentityName added in v1.8.0

func (m *MachineScope) SystemAssignedIdentityName() string

SystemAssignedIdentityName returns the role assignment name for the system assigned identity.

func (*MachineScope) SystemAssignedIdentityScope added in v1.8.0

func (m *MachineScope) SystemAssignedIdentityScope() string

SystemAssignedIdentityScope returns the scope for the system assigned identity.

func (*MachineScope) TagsSpecs

func (m *MachineScope) TagsSpecs() []azure.TagsSpec

TagsSpecs returns the tags for the AzureMachine.

func (*MachineScope) UpdateAnnotationJSON

func (m *MachineScope) UpdateAnnotationJSON(annotation string, content map[string]interface{}) error

UpdateAnnotationJSON updates the `annotation` with `content`. `content` in this case should be a `map[string]interface{}` suitable for turning into JSON. This `content` map will be marshalled into a JSON string before being set as the given `annotation`.

func (*MachineScope) UpdateDeleteStatus added in v0.5.3

func (m *MachineScope) UpdateDeleteStatus(condition clusterv1.ConditionType, service string, err error)

UpdateDeleteStatus updates a condition on the AzureMachine status after a DELETE operation.

func (*MachineScope) UpdatePatchStatus added in v0.5.3

func (m *MachineScope) UpdatePatchStatus(condition clusterv1.ConditionType, service string, err error)

UpdatePatchStatus updates a condition on the AzureMachine status after a PATCH operation.

func (*MachineScope) UpdatePutStatus added in v0.5.3

func (m *MachineScope) UpdatePutStatus(condition clusterv1.ConditionType, service string, err error)

UpdatePutStatus updates a condition on the AzureMachine status after a PUT operation.

func (*MachineScope) VMExtensionSpecs

func (m *MachineScope) VMExtensionSpecs() []azure.ResourceSpecGetter

VMExtensionSpecs returns the VM extension specs.

func (*MachineScope) VMSpec

VMSpec returns the VM spec.

func (*MachineScope) VMState

func (m *MachineScope) VMState() infrav1.ProvisioningState

VMState returns the AzureMachine VM state.

type MachineScopeParams

type MachineScopeParams struct {
	Client       client.Client
	ClusterScope azure.ClusterScoper
	Machine      *clusterv1.Machine
	AzureMachine *infrav1.AzureMachine
	Cache        *MachineCache
	SKUCache     SKUCacher
}

MachineScopeParams defines the input parameters used to create a new MachineScope.

type ManagedControlPlaneCache added in v1.4.2

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

ManagedControlPlaneCache stores ManagedControlPlane data locally so we don't have to hit the API multiple times within the same reconcile loop.

type ManagedControlPlaneCredentialsProvider

type ManagedControlPlaneCredentialsProvider struct {
	AzureCredentialsProvider
	AzureManagedControlPlane *infrav1.AzureManagedControlPlane
}

ManagedControlPlaneCredentialsProvider wraps AzureCredentialsProvider with AzureManagedControlPlane.

func NewManagedControlPlaneCredentialsProvider

func NewManagedControlPlaneCredentialsProvider(ctx context.Context, kubeClient client.Client, managedControlPlane *infrav1.AzureManagedControlPlane) (*ManagedControlPlaneCredentialsProvider, error)

NewManagedControlPlaneCredentialsProvider creates a new ManagedControlPlaneCredentialsProvider from the supplied inputs.

func (*ManagedControlPlaneCredentialsProvider) GetAuthorizer

func (p *ManagedControlPlaneCredentialsProvider) GetAuthorizer(ctx context.Context, tokenCredential azcore.TokenCredential, tokenAudience string) (autorest.Authorizer, error)

GetAuthorizer returns an Azure authorizer based on the provided azure identity. It delegates to AzureCredentialsProvider with AzureManagedControlPlane metadata.

func (*ManagedControlPlaneCredentialsProvider) GetTokenCredential added in v1.11.0

func (p *ManagedControlPlaneCredentialsProvider) GetTokenCredential(ctx context.Context, resourceManagerEndpoint, activeDirectoryEndpoint, tokenAudience string) (azcore.TokenCredential, error)

GetTokenCredential returns an Azure TokenCredential based on the provided azure identity.

type ManagedControlPlaneScope

type ManagedControlPlaneScope struct {
	Client client.Client

	AzureClients
	Cluster             *clusterv1.Cluster
	ControlPlane        *infrav1.AzureManagedControlPlane
	ManagedMachinePools []ManagedMachinePool
	VnetDescriber       VnetDescriber
	// contains filtered or unexported fields
}

ManagedControlPlaneScope defines the basic context for an actuator to operate upon.

func NewManagedControlPlaneScope

func NewManagedControlPlaneScope(ctx context.Context, params ManagedControlPlaneScopeParams) (*ManagedControlPlaneScope, error)

NewManagedControlPlaneScope creates a new Scope from the supplied parameters. This is meant to be called for each reconcile iteration.

func (*ManagedControlPlaneScope) APIServerLB added in v1.2.0

APIServerLB returns the API Server LB spec.

func (*ManagedControlPlaneScope) APIServerLBName

func (s *ManagedControlPlaneScope) APIServerLBName() string

APIServerLBName returns the API Server LB name.

func (*ManagedControlPlaneScope) APIServerLBPoolName

func (s *ManagedControlPlaneScope) APIServerLBPoolName(_ string) string

APIServerLBPoolName returns the API Server LB backend pool name.

func (*ManagedControlPlaneScope) AdditionalTags

func (s *ManagedControlPlaneScope) AdditionalTags() infrav1.Tags

AdditionalTags returns AdditionalTags from the ControlPlane spec.

func (*ManagedControlPlaneScope) AnnotationJSON added in v1.0.0

func (s *ManagedControlPlaneScope) AnnotationJSON(annotation string) (map[string]interface{}, error)

AnnotationJSON returns a map[string]interface from a JSON annotation.

func (*ManagedControlPlaneScope) Authorizer

Authorizer returns the Azure client Authorizer.

func (*ManagedControlPlaneScope) AvailabilitySetEnabled

func (s *ManagedControlPlaneScope) AvailabilitySetEnabled() bool

AvailabilitySetEnabled is always false for a managed control plane.

func (*ManagedControlPlaneScope) AvailabilityStatusFilter added in v1.7.0

func (s *ManagedControlPlaneScope) AvailabilityStatusFilter(cond *clusterv1.Condition) *clusterv1.Condition

AvailabilityStatusFilter ignores the health metrics connection error that occurs on startup for every AKS cluster.

func (*ManagedControlPlaneScope) AvailabilityStatusResource added in v1.7.0

func (s *ManagedControlPlaneScope) AvailabilityStatusResource() conditions.Setter

AvailabilityStatusResource refers to the AzureManagedControlPlane.

func (*ManagedControlPlaneScope) AvailabilityStatusResourceURI added in v1.7.0

func (s *ManagedControlPlaneScope) AvailabilityStatusResourceURI() string

AvailabilityStatusResourceURI constructs the ID of the underlying AKS resource.

func (*ManagedControlPlaneScope) BaseURI

func (s *ManagedControlPlaneScope) BaseURI() string

BaseURI returns the Azure ResourceManagerEndpoint.

func (*ManagedControlPlaneScope) Close added in v0.5.2

Close closes the current scope persisting the cluster configuration and status.

func (*ManagedControlPlaneScope) CloudProviderConfigOverrides

func (s *ManagedControlPlaneScope) CloudProviderConfigOverrides() *infrav1.CloudProviderConfigOverrides

CloudProviderConfigOverrides returns the cloud provider config overrides for the cluster.

func (*ManagedControlPlaneScope) ClusterName

func (s *ManagedControlPlaneScope) ClusterName() string

ClusterName returns the managed control plane's name.

func (*ManagedControlPlaneScope) ControlPlaneRouteTable

func (s *ManagedControlPlaneScope) ControlPlaneRouteTable() infrav1.RouteTable

ControlPlaneRouteTable returns the cluster controlplane routetable.

func (*ManagedControlPlaneScope) ControlPlaneSubnet

func (s *ManagedControlPlaneScope) ControlPlaneSubnet() infrav1.SubnetSpec

ControlPlaneSubnet returns the cluster control plane subnet.

func (*ManagedControlPlaneScope) DeleteLongRunningOperationState added in v0.5.3

func (s *ManagedControlPlaneScope) DeleteLongRunningOperationState(name, service, futureType string)

DeleteLongRunningOperationState will delete the future from the AzureManagedControlPlane status.

func (*ManagedControlPlaneScope) ExtendedLocation added in v1.8.0

func (s *ManagedControlPlaneScope) ExtendedLocation() *infrav1.ExtendedLocationSpec

ExtendedLocation has not been implemented for AzureManagedControlPlane.

func (*ManagedControlPlaneScope) ExtendedLocationName added in v1.8.0

func (s *ManagedControlPlaneScope) ExtendedLocationName() string

ExtendedLocationName has not been implemented for AzureManagedControlPlane.

func (*ManagedControlPlaneScope) ExtendedLocationType added in v1.8.0

func (s *ManagedControlPlaneScope) ExtendedLocationType() string

ExtendedLocationType has not been implemented for AzureManagedControlPlane.

func (*ManagedControlPlaneScope) FailureDomains added in v0.5.3

func (s *ManagedControlPlaneScope) FailureDomains() []*string

FailureDomains returns the failure domains for the cluster.

func (*ManagedControlPlaneScope) GetAllAgentPoolSpecs added in v1.2.0

func (s *ManagedControlPlaneScope) GetAllAgentPoolSpecs() ([]azure.ResourceSpecGetter, error)

GetAllAgentPoolSpecs gets a slice of azure.AgentPoolSpec for the list of agent pools.

func (*ManagedControlPlaneScope) GetClient added in v1.10.0

func (s *ManagedControlPlaneScope) GetClient() client.Client

GetClient returns the controller-runtime client.

func (*ManagedControlPlaneScope) GetKubeConfigData added in v0.5.2

func (s *ManagedControlPlaneScope) GetKubeConfigData() []byte

GetKubeConfigData returns a []byte that contains kubeconfig.

func (*ManagedControlPlaneScope) GetLongRunningOperationState added in v0.5.3

func (s *ManagedControlPlaneScope) GetLongRunningOperationState(name, service, futureType string) *infrav1.Future

GetLongRunningOperationState will get the future on the AzureManagedControlPlane status.

func (*ManagedControlPlaneScope) GetPrivateDNSZoneName

func (s *ManagedControlPlaneScope) GetPrivateDNSZoneName() string

GetPrivateDNSZoneName returns the Private DNS Zone from the spec or generate it from cluster name. Currently always empty as managed control planes do not currently implement private clusters.

func (*ManagedControlPlaneScope) GroupSpec added in v0.5.3

GroupSpec returns the resource group spec.

func (*ManagedControlPlaneScope) IsAPIServerPrivate

func (s *ManagedControlPlaneScope) IsAPIServerPrivate() bool

IsAPIServerPrivate returns true if the API Server LB is of type Internal. Currently always false as managed control planes do not currently implement private clusters.

func (*ManagedControlPlaneScope) IsIPv6Enabled

func (s *ManagedControlPlaneScope) IsIPv6Enabled() bool

IsIPv6Enabled returns true if a cluster is ipv6 enabled. Currently always false as managed control planes do not currently implement ipv6.

func (*ManagedControlPlaneScope) IsVnetManaged

func (s *ManagedControlPlaneScope) IsVnetManaged() bool

IsVnetManaged returns true if the vnet is managed.

func (*ManagedControlPlaneScope) Location

func (s *ManagedControlPlaneScope) Location() string

Location returns the managed control plane's Azure location, or an empty string.

func (*ManagedControlPlaneScope) MakeEmptyKubeConfigSecret added in v0.5.2

func (s *ManagedControlPlaneScope) MakeEmptyKubeConfigSecret() corev1.Secret

MakeEmptyKubeConfigSecret creates an empty secret object that is used for storing kubeconfig secret data.

func (*ManagedControlPlaneScope) ManagedClusterAnnotations added in v1.2.0

func (s *ManagedControlPlaneScope) ManagedClusterAnnotations() map[string]string

ManagedClusterAnnotations returns the annotations for the managed cluster.

func (*ManagedControlPlaneScope) ManagedClusterSpec added in v0.5.2

func (s *ManagedControlPlaneScope) ManagedClusterSpec() azure.ResourceSpecGetter

ManagedClusterSpec returns the managed cluster spec.

func (*ManagedControlPlaneScope) NodeNatGateway

func (s *ManagedControlPlaneScope) NodeNatGateway() infrav1.NatGateway

NodeNatGateway returns the cluster node NAT gateway.

func (*ManagedControlPlaneScope) NodeResourceGroup added in v0.5.2

func (s *ManagedControlPlaneScope) NodeResourceGroup() string

NodeResourceGroup returns the managed control plane's node resource group.

func (*ManagedControlPlaneScope) NodeRouteTable

func (s *ManagedControlPlaneScope) NodeRouteTable() infrav1.RouteTable

NodeRouteTable returns the cluster node routetable.

func (*ManagedControlPlaneScope) NodeSubnet

NodeSubnet returns the cluster node subnet.

func (*ManagedControlPlaneScope) NodeSubnets added in v0.5.1

func (s *ManagedControlPlaneScope) NodeSubnets() []infrav1.SubnetSpec

NodeSubnets returns the subnets with the node role.

func (*ManagedControlPlaneScope) OutboundLBName

func (s *ManagedControlPlaneScope) OutboundLBName(_ string) string

OutboundLBName returns the name of the outbound LB. Note: for managed clusters, the outbound LB lifecycle is not managed.

func (*ManagedControlPlaneScope) OutboundPoolName

func (s *ManagedControlPlaneScope) OutboundPoolName(_ string) string

OutboundPoolName returns the outbound LB backend pool name.

func (*ManagedControlPlaneScope) PatchObject

func (s *ManagedControlPlaneScope) PatchObject(ctx context.Context) error

PatchObject persists the cluster configuration and status.

func (*ManagedControlPlaneScope) PrivateEndpointSpecs added in v1.8.0

func (s *ManagedControlPlaneScope) PrivateEndpointSpecs() []azure.ResourceSpecGetter

PrivateEndpointSpecs returns the private endpoint specs.

func (*ManagedControlPlaneScope) ResourceGroup

func (s *ManagedControlPlaneScope) ResourceGroup() string

ResourceGroup returns the managed control plane's resource group.

func (*ManagedControlPlaneScope) SetAnnotation added in v1.0.0

func (s *ManagedControlPlaneScope) SetAnnotation(key, value string)

SetAnnotation sets a key value annotation on the ControlPlane.

func (*ManagedControlPlaneScope) SetControlPlaneEndpoint added in v0.5.2

func (s *ManagedControlPlaneScope) SetControlPlaneEndpoint(endpoint clusterv1.APIEndpoint)

SetControlPlaneEndpoint sets a control plane endpoint.

func (*ManagedControlPlaneScope) SetKubeConfigData added in v0.5.2

func (s *ManagedControlPlaneScope) SetKubeConfigData(kubeConfigData []byte)

SetKubeConfigData sets kubeconfig data.

func (*ManagedControlPlaneScope) SetKubeletIdentity added in v1.10.0

func (s *ManagedControlPlaneScope) SetKubeletIdentity(id string)

SetKubeletIdentity sets the ID of the user-assigned identity for kubelet if not already set.

func (*ManagedControlPlaneScope) SetLongRunningOperationState added in v0.5.3

func (s *ManagedControlPlaneScope) SetLongRunningOperationState(future *infrav1.Future)

SetLongRunningOperationState will set the future on the AzureManagedControlPlane status to allow the resource to continue in the next reconciliation.

func (*ManagedControlPlaneScope) SetOIDCIssuerProfileStatus added in v1.11.0

func (s *ManagedControlPlaneScope) SetOIDCIssuerProfileStatus(oidc *infrav1.OIDCIssuerProfileStatus)

SetOIDCIssuerProfileStatus sets the status for the OIDC issuer profile config.

func (*ManagedControlPlaneScope) SetSubnet

SetSubnet sets the passed subnet spec into the scope. This is not used when using a managed control plane.

func (*ManagedControlPlaneScope) Subnet added in v0.5.1

Subnet returns the subnet with the provided name.

func (*ManagedControlPlaneScope) SubnetSpecs

SubnetSpecs returns the subnets specs.

func (*ManagedControlPlaneScope) Subnets added in v0.5.1

Subnets returns the subnets specs.

func (*ManagedControlPlaneScope) SubscriptionID

func (s *ManagedControlPlaneScope) SubscriptionID() string

SubscriptionID returns the Azure client Subscription ID.

func (*ManagedControlPlaneScope) TagsSpecs added in v1.0.0

func (s *ManagedControlPlaneScope) TagsSpecs() []azure.TagsSpec

TagsSpecs returns the tag specs for the ManagedControlPlane.

func (*ManagedControlPlaneScope) UpdateAnnotationJSON added in v1.0.0

func (s *ManagedControlPlaneScope) UpdateAnnotationJSON(annotation string, content map[string]interface{}) error

UpdateAnnotationJSON updates the `annotation` with `content`. `content` in this case should be a `map[string]interface{}` suitable for turning into JSON. This `content` map will be marshalled into a JSON string before being set as the given `annotation`.

func (*ManagedControlPlaneScope) UpdateDeleteStatus added in v0.5.3

func (s *ManagedControlPlaneScope) UpdateDeleteStatus(condition clusterv1.ConditionType, service string, err error)

UpdateDeleteStatus updates a condition on the AzureManagedControlPlane status after a DELETE operation.

func (*ManagedControlPlaneScope) UpdatePatchStatus added in v0.5.3

func (s *ManagedControlPlaneScope) UpdatePatchStatus(condition clusterv1.ConditionType, service string, err error)

UpdatePatchStatus updates a condition on the AzureManagedControlPlane status after a PATCH operation.

func (*ManagedControlPlaneScope) UpdatePutStatus added in v0.5.3

func (s *ManagedControlPlaneScope) UpdatePutStatus(condition clusterv1.ConditionType, service string, err error)

UpdatePutStatus updates a condition on the AzureManagedControlPlane status after a PUT operation.

func (*ManagedControlPlaneScope) UpdateSubnetCIDRs added in v1.2.0

func (s *ManagedControlPlaneScope) UpdateSubnetCIDRs(_ string, _ []string)

UpdateSubnetCIDRs updates the subnet CIDRs for the subnet with the same name. This is not used when using a managed control plane.

func (*ManagedControlPlaneScope) UpdateSubnetID added in v1.2.0

func (s *ManagedControlPlaneScope) UpdateSubnetID(_ string, _ string)

UpdateSubnetID updates the subnet ID for the subnet with the same name. This is not used when using a managed control plane.

func (*ManagedControlPlaneScope) VNetSpec

VNetSpec returns the virtual network spec.

func (*ManagedControlPlaneScope) Vnet

Vnet returns the cluster Vnet.

type ManagedControlPlaneScopeParams

type ManagedControlPlaneScopeParams struct {
	AzureClients
	Client              client.Client
	Cluster             *clusterv1.Cluster
	ControlPlane        *infrav1.AzureManagedControlPlane
	ManagedMachinePools []ManagedMachinePool
	Cache               *ManagedControlPlaneCache
	VnetDescriber       VnetDescriber
}

ManagedControlPlaneScopeParams defines the input parameters used to create a new managed control plane.

type ManagedMachinePool added in v1.4.0

type ManagedMachinePool struct {
	InfraMachinePool *infrav1.AzureManagedMachinePool
	MachinePool      *expv1.MachinePool
}

ManagedMachinePool defines the scope interface for a managed machine pool.

type ManagedMachinePoolScope added in v1.4.0

type ManagedMachinePoolScope struct {
	Client client.Client

	azure.ManagedClusterScoper
	Cluster          *clusterv1.Cluster
	MachinePool      *expv1.MachinePool
	ControlPlane     *infrav1.AzureManagedControlPlane
	InfraMachinePool *infrav1.AzureManagedMachinePool
	// contains filtered or unexported fields
}

ManagedMachinePoolScope defines the basic context for an actuator to operate upon.

func NewManagedMachinePoolScope added in v1.4.0

func NewManagedMachinePoolScope(ctx context.Context, params ManagedMachinePoolScopeParams) (*ManagedMachinePoolScope, error)

NewManagedMachinePoolScope creates a new Scope from the supplied parameters. This is meant to be called for each reconcile iteration.

func (*ManagedMachinePoolScope) AgentPoolAnnotations added in v1.4.0

func (s *ManagedMachinePoolScope) AgentPoolAnnotations() map[string]string

AgentPoolAnnotations returns a map of annotations for the infra machine pool.

func (*ManagedMachinePoolScope) AgentPoolSpec added in v1.4.0

AgentPoolSpec returns an azure.ResourceSpecGetter for currently reconciled AzureManagedMachinePool.

func (*ManagedMachinePoolScope) Close added in v1.4.0

Close closes the current scope persisting the cluster configuration and status.

func (*ManagedMachinePoolScope) DeleteLongRunningOperationState added in v1.4.0

func (s *ManagedMachinePoolScope) DeleteLongRunningOperationState(name, service, futureType string)

DeleteLongRunningOperationState will delete the future from the AzureManagedMachinePool status.

func (*ManagedMachinePoolScope) GetCAPIMachinePoolAnnotation added in v1.4.2

func (s *ManagedMachinePoolScope) GetCAPIMachinePoolAnnotation(key string) (success bool, value string)

GetCAPIMachinePoolAnnotation gets the specified annotation on the associated MachinePool.

func (*ManagedMachinePoolScope) GetLongRunningOperationState added in v1.4.0

func (s *ManagedMachinePoolScope) GetLongRunningOperationState(name, service, futureType string) *infrav1.Future

GetLongRunningOperationState will get the future on the AzureManagedMachinePool status.

func (*ManagedMachinePoolScope) Name added in v1.5.0

func (s *ManagedMachinePoolScope) Name() string

Name returns the name of the infra machine pool.

func (*ManagedMachinePoolScope) PatchCAPIMachinePoolObject added in v1.4.2

func (s *ManagedMachinePoolScope) PatchCAPIMachinePoolObject(ctx context.Context) error

PatchCAPIMachinePoolObject persists the capi machinepool configuration and status.

func (*ManagedMachinePoolScope) PatchObject added in v1.4.0

func (s *ManagedMachinePoolScope) PatchObject(ctx context.Context) error

PatchObject persists the cluster configuration and status.

func (*ManagedMachinePoolScope) RemoveCAPIMachinePoolAnnotation added in v1.5.0

func (s *ManagedMachinePoolScope) RemoveCAPIMachinePoolAnnotation(key string)

RemoveCAPIMachinePoolAnnotation removes the specified annotation on the associated MachinePool.

func (*ManagedMachinePoolScope) SetAgentPoolProviderIDList added in v1.4.0

func (s *ManagedMachinePoolScope) SetAgentPoolProviderIDList(providerIDs []string)

SetAgentPoolProviderIDList sets a list of agent pool's Azure VM IDs.

func (*ManagedMachinePoolScope) SetAgentPoolReady added in v1.4.0

func (s *ManagedMachinePoolScope) SetAgentPoolReady(ready bool)

SetAgentPoolReady sets the flag that indicates if the agent pool is ready or not.

func (*ManagedMachinePoolScope) SetAgentPoolReplicas added in v1.4.0

func (s *ManagedMachinePoolScope) SetAgentPoolReplicas(replicas int32)

SetAgentPoolReplicas sets the number of agent pool replicas.

func (*ManagedMachinePoolScope) SetCAPIMachinePoolAnnotation added in v1.5.0

func (s *ManagedMachinePoolScope) SetCAPIMachinePoolAnnotation(key, value string)

SetCAPIMachinePoolAnnotation sets the specified annotation on the associated MachinePool.

func (*ManagedMachinePoolScope) SetCAPIMachinePoolReplicas added in v1.5.0

func (s *ManagedMachinePoolScope) SetCAPIMachinePoolReplicas(replicas *int32)

SetCAPIMachinePoolReplicas sets the associated MachinePool replica count.

func (*ManagedMachinePoolScope) SetLongRunningOperationState added in v1.4.0

func (s *ManagedMachinePoolScope) SetLongRunningOperationState(future *infrav1.Future)

SetLongRunningOperationState will set the future on the AzureManagedMachinePool status to allow the resource to continue in the next reconciliation.

func (*ManagedMachinePoolScope) SetSubnetName added in v1.9.0

func (s *ManagedMachinePoolScope) SetSubnetName()

SetSubnetName updates AzureManagedMachinePool.SubnetName if AzureManagedMachinePool.SubnetName is empty with s.ControlPlane.Spec.VirtualNetwork.Subnet.Name.

func (*ManagedMachinePoolScope) UpdateDeleteStatus added in v1.4.0

func (s *ManagedMachinePoolScope) UpdateDeleteStatus(condition clusterv1.ConditionType, service string, err error)

UpdateDeleteStatus updates a condition on the AzureManagedControlPlane status after a DELETE operation.

func (*ManagedMachinePoolScope) UpdatePatchStatus added in v1.4.0

func (s *ManagedMachinePoolScope) UpdatePatchStatus(condition clusterv1.ConditionType, service string, err error)

UpdatePatchStatus updates a condition on the AzureManagedMachinePool status after a PATCH operation.

func (*ManagedMachinePoolScope) UpdatePutStatus added in v1.4.0

func (s *ManagedMachinePoolScope) UpdatePutStatus(condition clusterv1.ConditionType, service string, err error)

UpdatePutStatus updates a condition on the AzureManagedMachinePool status after a PUT operation.

type ManagedMachinePoolScopeParams added in v1.4.0

type ManagedMachinePoolScopeParams struct {
	ManagedMachinePool
	Client                   client.Client
	Cluster                  *clusterv1.Cluster
	ControlPlane             *infrav1.AzureManagedControlPlane
	ManagedControlPlaneScope azure.ManagedClusterScoper
}

ManagedMachinePoolScopeParams defines the input parameters used to create a new managed control plane.

type NodeStatus

type NodeStatus struct {
	Ready   bool
	Version string
}

NodeStatus represents the status of a Kubernetes node.

type SKUCacher added in v1.11.0

type SKUCacher interface {
	Get(context.Context, string, resourceskus.ResourceType) (resourceskus.SKU, error)
}

SKUCacher fetches a SKU from its cache.

type VnetDescriber added in v1.11.0

type VnetDescriber interface {
	IsManaged(context.Context) (bool, error)
}

VnetDescriber answers whether a virtual network is managed or not.

type WorkloadIdentityCredentialOptions added in v1.10.0

type WorkloadIdentityCredentialOptions struct {
	azcore.ClientOptions
	ClientID      string
	TenantID      string
	TokenFilePath string
}

WorkloadIdentityCredentialOptions contains the configurable options for azwi.

func NewWorkloadIdentityCredentialOptions added in v1.10.0

func NewWorkloadIdentityCredentialOptions() *WorkloadIdentityCredentialOptions

NewWorkloadIdentityCredentialOptions returns an empty instance of WorkloadIdentityCredentialOptions.

func (*WorkloadIdentityCredentialOptions) WithClientID added in v1.10.0

WithClientID sets client ID to WorkloadIdentityCredentialOptions.

func (*WorkloadIdentityCredentialOptions) WithDefaults added in v1.10.0

WithDefaults sets token file path. It also sets the client tenant ID from injected env in case empty values are passed.

func (*WorkloadIdentityCredentialOptions) WithTenantID added in v1.10.0

WithTenantID sets tenant ID to WorkloadIdentityCredentialOptions.

Directories

Path Synopsis
Run go generate to regenerate this mock.
Run go generate to regenerate this mock.
strategies

Jump to

Keyboard shortcuts

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