scope

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: Apache-2.0 Imports: 50 Imported by: 4

Documentation

Index

Constants

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

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.

Types

type AzureClients

type AzureClients struct {
	auth.EnvironmentSettings

	Authorizer                 autorest.Authorizer
	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.

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, resourceManagerEndpoint, activeDirectoryEndpoint string) (autorest.Authorizer, error)

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

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, resourceManagerEndpoint, activeDirectoryEndpoint string, clusterMeta metav1.ObjectMeta) (autorest.Authorizer, error)

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

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.

type ClusterScope

type ClusterScope struct {
	logr.Logger
	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(loadBalancerName string) 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) Authorizer

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

Authorizer returns the Azure client Authorizer.

func (*ClusterScope) AvailabilitySetEnabled

func (s *ClusterScope) AvailabilitySetEnabled() bool

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

func (*ClusterScope) BaseURI

func (s *ClusterScope) BaseURI() string

BaseURI returns the Azure ResourceManagerEndpoint.

func (*ClusterScope) BastionSpec

func (s *ClusterScope) BastionSpec() azure.BastionSpec

BastionSpec returns the bastion spec.

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) 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() (string, 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) GetPrivateDNSZoneName

func (s *ClusterScope) GetPrivateDNSZoneName() string

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

func (*ClusterScope) IsAPIServerPrivate

func (s *ClusterScope) IsAPIServerPrivate() bool

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

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.LBSpec

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.NSGSpec

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.NatGatewaySpec

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

func (s *ClusterScope) NodeOutboundLBName() string

NodeOutboundLBName returns the name of the node outbound LB.

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(loadBalancerName 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() *azure.PrivateDNSSpec

PrivateDNSSpec returns the private dns zone spec.

func (*ClusterScope) PublicIPSpecs

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

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.RouteTableSpec

RouteTableSpecs returns the node route table.

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) 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.SubnetSpec

SubnetSpecs returns the subnets specs.

func (*ClusterScope) Subnets

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

Subnets returns the cluster subnets.

func (*ClusterScope) VNetSpec

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

VNetSpec returns the virtual network spec.

func (*ClusterScope) Vnet

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

Vnet returns the cluster Vnet.

type ClusterScopeParams

type ClusterScopeParams struct {
	AzureClients
	Client       client.Client
	Logger       logr.Logger
	Cluster      *clusterv1.Cluster
	AzureCluster *infrav1.AzureCluster
}

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

type CredentialsProvider

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

CredentialsProvider defines the behavior for azure identity based credential providers.

type MachinePoolMachineScope

type MachinePoolMachineScope struct {
	azure.ClusterScoper
	logr.Logger
	AzureMachinePoolMachine *infrav1exp.AzureMachinePoolMachine
	AzureMachinePool        *infrav1exp.AzureMachinePool
	MachinePool             *capiv1exp.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) GetLongRunningOperationState

func (s *MachinePoolMachineScope) GetLongRunningOperationState() *infrav1.Future

GetLongRunningOperationState gets a future representing the current state of a long-running operation if one exists.

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) 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) 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 sets a future representing the current state of a long-running operation.

func (*MachinePoolMachineScope) SetVMSSVM

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

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

func (*MachinePoolMachineScope) UpdateStatus

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

UpdateStatus updates the node reference for the machine and other status fields. This func should be called at the end of a reconcile request and after updating the scope with the most recent Azure data.

type MachinePoolMachineScopeParams

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

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

type MachinePoolScope

type MachinePoolScope struct {
	azure.ClusterScoper
	logr.Logger
	AzureMachinePool *infrav1exp.AzureMachinePool
	MachinePool      *capiv1exp.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 MachineScope by updating the machine spec, machine 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 Machine's bootstrap.dataSecretName.

func (*MachinePoolScope) GetLongRunningOperationState

func (m *MachinePoolScope) GetLongRunningOperationState() *infrav1.Future

GetLongRunningOperationState will get the future on the AzureMachinePool status to allow the resource to continue in the next reconciliation.

func (*MachinePoolScope) GetVMImage

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

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

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

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

PatchObject persists the machine spec and status.

func (*MachinePoolScope) ProviderID

func (m *MachinePoolScope) ProviderID() string

ProviderID returns the AzureMachinePool ID by parsing Spec.FakeProviderID.

func (*MachinePoolScope) ProvisioningState

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

ProvisioningState returns the AzureMachinePool provisioning state.

func (*MachinePoolScope) RoleAssignmentSpecs

func (m *MachinePoolScope) RoleAssignmentSpecs() []azure.RoleAssignmentSpec

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

func (m *MachinePoolScope) ScaleSetSpec() azure.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) SetBootstrapConditions

func (m *MachinePoolScope) SetBootstrapConditions(provisioningState string, extensionName string) error

SetBootstrapConditions sets the AzureMachinePool BootstrapSucceeded condition based on the extension provisioning states.

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

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

VMSSExtensionSpecs returns the vmss extension specs.

type MachinePoolScopeParams

type MachinePoolScopeParams struct {
	Client           client.Client
	Logger           logr.Logger
	MachinePool      *capiv1exp.MachinePool
	AzureMachinePool *infrav1exp.AzureMachinePool
	ClusterScope     azure.ClusterScoper
}

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

type MachineScope

type MachineScope struct {
	logr.Logger

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

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

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

func (*MachineScope) DiskSpecs

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

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

func (m *MachineScope) GetVMID() string

GetVMID returns the AzureMachine instance id by parsing Spec.FakeProviderID.

func (*MachineScope) GetVMImage

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

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

func (*MachineScope) InboundNatSpecs

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

InboundNatSpecs returns the inbound NAT specs.

func (*MachineScope) IsControlPlane

func (m *MachineScope) IsControlPlane() bool

IsControlPlane returns true if the machine is a control plane.

func (*MachineScope) NICNames

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

NICNames returns the NIC names.

func (*MachineScope) NICSpecs

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

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.PublicIPSpec

PublicIPSpecs returns the public IP specs.

func (*MachineScope) Role

func (m *MachineScope) Role() string

Role returns the machine role from the labels.

func (*MachineScope) RoleAssignmentSpecs

func (m *MachineScope) RoleAssignmentSpecs() []azure.RoleAssignmentSpec

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

func (m *MachineScope) SetBootstrapConditions(provisioningState string, extensionName string) error

SetBootstrapConditions sets the AzureMachine BootstrapSucceeded condition based on the extension provisioning states.

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

func (m *MachineScope) UpdateStatus()

UpdateStatus updates the AzureMachine status.

func (*MachineScope) VMExtensionSpecs

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

VMExtensionSpecs returns the vm extension specs.

func (*MachineScope) VMSpec

func (m *MachineScope) VMSpec() azure.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
	Logger       logr.Logger
	ClusterScope azure.ClusterScoper
	Machine      *clusterv1.Machine
	AzureMachine *infrav1.AzureMachine
}

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

type ManagedControlPlaneCredentialsProvider

type ManagedControlPlaneCredentialsProvider struct {
	AzureCredentialsProvider
	AzureManagedControlPlane *infrav1exp.AzureManagedControlPlane
}

ManagedControlPlaneCredentialsProvider wraps AzureCredentialsProvider with AzureManagedControlPlane.

func NewManagedControlPlaneCredentialsProvider

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

NewManagedControlPlaneCredentialsProvider creates a new ManagedControlPlaneCredentialsProvider from the supplied inputs.

func (*ManagedControlPlaneCredentialsProvider) GetAuthorizer

func (p *ManagedControlPlaneCredentialsProvider) GetAuthorizer(ctx context.Context, resourceManagerEndpoint, activeDirectoryEndpoint string) (autorest.Authorizer, error)

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

type ManagedControlPlaneScope

type ManagedControlPlaneScope struct {
	logr.Logger
	Client client.Client

	AzureClients
	Cluster          *clusterv1.Cluster
	MachinePool      *expv1.MachinePool
	ControlPlane     *infrav1exp.AzureManagedControlPlane
	InfraMachinePool *infrav1exp.AzureManagedMachinePool
	PatchTarget      client.Object

	SystemNodePools []infrav1exp.AzureManagedMachinePool
	// 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) APIServerLBName

func (s *ManagedControlPlaneScope) APIServerLBName() string

APIServerLBName returns the API Server LB name.

func (*ManagedControlPlaneScope) APIServerLBPoolName

func (s *ManagedControlPlaneScope) APIServerLBPoolName(loadBalancerName 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) AgentPoolSpec added in v0.5.2

func (s *ManagedControlPlaneScope) AgentPoolSpec() azure.AgentPoolSpec

AgentPoolSpec returns an azure.AgentPoolSpec for currently reconciled AzureManagedMachinePool.

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) 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) GetKubeConfigData added in v0.5.2

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

GetKubeConfigData returns a []byte that contains kubeconfig.

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) GetSystemAgentPoolSpecs added in v0.5.2

func (s *ManagedControlPlaneScope) GetSystemAgentPoolSpecs(ctx context.Context) ([]azure.AgentPoolSpec, error)

GetSystemAgentPoolSpecs gets a slice of azure.AgentPoolSpec for system agent pools.

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) ManagedClusterSpec added in v0.5.2

func (s *ManagedControlPlaneScope) ManagedClusterSpec() (azure.ManagedClusterSpec, error)

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

func (s *ManagedControlPlaneScope) ResourceGroup() string

ResourceGroup returns the managed control plane's resource group.

func (*ManagedControlPlaneScope) SetAgentPoolProviderIDList added in v0.5.2

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

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

func (*ManagedControlPlaneScope) SetAgentPoolReady added in v0.5.2

func (s *ManagedControlPlaneScope) SetAgentPoolReady(ready bool)

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

func (*ManagedControlPlaneScope) SetAgentPoolReplicas added in v0.5.2

func (s *ManagedControlPlaneScope) SetAgentPoolReplicas(replicas int32)

SetAgentPoolReplicas sets the number of agent pool replicas.

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

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

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

func (s *ManagedControlPlaneScope) SubnetSpecs() []azure.SubnetSpec

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

func (s *ManagedControlPlaneScope) VNetSpec() azure.VNetSpec

VNetSpec returns the virtual network spec.

func (*ManagedControlPlaneScope) Vnet

Vnet returns the cluster Vnet.

type ManagedControlPlaneScopeParams

type ManagedControlPlaneScopeParams struct {
	AzureClients
	Client           client.Client
	Logger           logr.Logger
	Cluster          *clusterv1.Cluster
	ControlPlane     *infrav1exp.AzureManagedControlPlane
	InfraMachinePool *infrav1exp.AzureManagedMachinePool
	MachinePool      *expv1.MachinePool
	PatchTarget      client.Object
}

ManagedControlPlaneScopeParams 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.

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