Documentation ¶
Index ¶
- func IsInvalidConfig(err error) bool
- func IsInvalidObject(err error) bool
- func IsNotFound(err error) bool
- func IsParentNetworkRangeStillNotKnown(err error) bool
- type AzureConfigChecker
- type AzureConfigCheckerConfig
- type AzureConfigNetworkRangeGetter
- type AzureConfigNetworkRangeGetterConfig
- type AzureConfigPersister
- type AzureConfigPersisterConfig
- type AzureMachinePoolNetworkRangeGetter
- type AzureMachinePoolNetworkRangeGetterConfig
- type AzureMachinePoolSubnetChecker
- type AzureMachinePoolSubnetCheckerConfig
- type AzureMachinePoolSubnetCollector
- type AzureMachinePoolSubnetCollectorConfig
- type AzureMachinePoolSubnetPersister
- type AzureMachinePoolSubnetPersisterConfig
- type Checker
- type Collector
- type Config
- type NetworkRangeGetter
- type NetworkRangeType
- type Persister
- type Resource
- type TestChecker
- type TestCollector
- type TestNetworkRangeGetter
- type TestPersister
- type VirtualNetworkCollector
- type VirtualNetworkCollectorConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsInvalidConfig ¶
IsInvalidConfig asserts invalidConfigError.
func IsInvalidObject ¶
IsInvalidObject asserts invalidObjectError.
func IsNotFound ¶
func IsParentNetworkRangeStillNotKnown ¶
IsParentNetworkRangeStillNotKnown asserts parentNetworkRangeStillNotKnown. This can happen in node pools IPAM reconciliation, during subnet allocation, when AzureCluster.Spec.NetworkSpec.Vnet.CidrBlock is still not set, because VNet for the tenant cluster is still not allocated (e.g. when cluster is still being created).
Types ¶
type AzureConfigChecker ¶
type AzureConfigChecker struct {
// contains filtered or unexported fields
}
func NewAzureConfigChecker ¶
func NewAzureConfigChecker(config AzureConfigCheckerConfig) (*AzureConfigChecker, error)
type AzureConfigCheckerConfig ¶
type AzureConfigCheckerConfig struct { CtrlClient client.Client Logger micrologger.Logger }
type AzureConfigNetworkRangeGetter ¶
type AzureConfigNetworkRangeGetter struct {
// contains filtered or unexported fields
}
AzureConfigNetworkRangeGetter is NetworkRangeGetter implementation for AzureConfig.
func NewAzureConfigNetworkRangeGetter ¶
func NewAzureConfigNetworkRangeGetter(config AzureConfigNetworkRangeGetterConfig) (*AzureConfigNetworkRangeGetter, error)
func (*AzureConfigNetworkRangeGetter) GetParentNetworkRange ¶
func (g *AzureConfigNetworkRangeGetter) GetParentNetworkRange(_ context.Context, _ interface{}) (net.IPNet, error)
GetParentNetworkRange gets the predefined installation network range, since the tenant cluster virtual network is getting its IP range from all available address ranges in the installation.
func (*AzureConfigNetworkRangeGetter) GetRequiredIPMask ¶
func (g *AzureConfigNetworkRangeGetter) GetRequiredIPMask() net.IPMask
GetRequiredIPMask returns an IP mask for tenant cluster virtual network.
type AzureConfigPersister ¶
type AzureConfigPersister struct {
// contains filtered or unexported fields
}
func NewAzureConfigPersister ¶
func NewAzureConfigPersister(config AzureConfigPersisterConfig) (*AzureConfigPersister, error)
type AzureConfigPersisterConfig ¶
type AzureConfigPersisterConfig struct { CtrlClient client.Client Logger micrologger.Logger }
type AzureMachinePoolNetworkRangeGetter ¶
type AzureMachinePoolNetworkRangeGetter struct {
// contains filtered or unexported fields
}
AzureMachinePoolNetworkRangeGetter is a NetworkRangeGetter implementation for node pools.
func NewAzureMachinePoolNetworkRangeGetter ¶
func NewAzureMachinePoolNetworkRangeGetter(config AzureMachinePoolNetworkRangeGetterConfig) (*AzureMachinePoolNetworkRangeGetter, error)
func (*AzureMachinePoolNetworkRangeGetter) GetParentNetworkRange ¶
func (g *AzureMachinePoolNetworkRangeGetter) GetParentNetworkRange(ctx context.Context, obj interface{}) (net.IPNet, error)
GetParentNetworkRange returns the tenant cluster virtual network range, because the node pool subnet is getting its IP address range from all available address ranges in the tenant cluster virtual network.
func (*AzureMachinePoolNetworkRangeGetter) GetRequiredIPMask ¶
func (g *AzureMachinePoolNetworkRangeGetter) GetRequiredIPMask() net.IPMask
GetRequiredMask returns a /24 IP mask that is required for the node pools subnet.
type AzureMachinePoolNetworkRangeGetterConfig ¶
type AzureMachinePoolNetworkRangeGetterConfig struct { CtrlClient client.Client Logger micrologger.Logger }
type AzureMachinePoolSubnetChecker ¶
type AzureMachinePoolSubnetChecker struct {
// contains filtered or unexported fields
}
AzureMachinePoolSubnetChecker is a Checker implementation that checks if a subnet is allocated for the node pool specified in Check function.
func NewAzureMachinePoolSubnetChecker ¶
func NewAzureMachinePoolSubnetChecker(config AzureMachinePoolSubnetCheckerConfig) (*AzureMachinePoolSubnetChecker, error)
func (*AzureMachinePoolSubnetChecker) Check ¶
func (c *AzureMachinePoolSubnetChecker) Check(ctx context.Context, namespace string, name string) (bool, error)
Check function checks if a subnet is allocated for the specified AzureMachinePool. It is checking if the allocated subnet is set in the corresponding Cluster CR that owns specified AzureMachinePool.
type AzureMachinePoolSubnetCheckerConfig ¶
type AzureMachinePoolSubnetCheckerConfig struct { CtrlClient client.Client Logger micrologger.Logger }
type AzureMachinePoolSubnetCollector ¶
type AzureMachinePoolSubnetCollector struct {
// contains filtered or unexported fields
}
AzureMachinePoolSubnetCollector is a Collector implementation that collects all subnets that are already allocated in tenant cluster virtual network. See Collect function implementation and docs for more details.
func NewAzureMachineSubnetCollector ¶
func NewAzureMachineSubnetCollector(config AzureMachinePoolSubnetCollectorConfig) (*AzureMachinePoolSubnetCollector, error)
func (*AzureMachinePoolSubnetCollector) Collect ¶
func (c *AzureMachinePoolSubnetCollector) Collect(ctx context.Context, obj interface{}) ([]net.IPNet, error)
Collect function returns all subnets that are already allocated in tenant cluster virtual network. These include subnets set in AzureCluster CR and all subnets that are created in tenant cluster's Azure virtual network.
Why getting both of these?
- Subnets from AzureCluster CR: these are desired subnets for the tenant cluster, they might be already deployed in Azure or not.
- Subnets in Azure virtual network: In addition to subnets from AzureCluster CR that should be eventually deployed here, there might be some other subnets that are created outside of tenant cluster. For existing pre-node-pool clusters, legacy subnets, if they still exist, will be collected here.
type AzureMachinePoolSubnetCollectorConfig ¶
type AzureMachinePoolSubnetCollectorConfig struct { AzureClientFactory client.OrganizationFactory CtrlClient ctrl.Client Logger micrologger.Logger }
type AzureMachinePoolSubnetPersister ¶
type AzureMachinePoolSubnetPersister struct {
// contains filtered or unexported fields
}
AzureMachinePoolSubnetPersister is a Persister implementation that saves a subnet allocated for a node pool by adding it to Cluster CR.
func NewAzureMachinePoolSubnetPersister ¶
func NewAzureMachinePoolSubnetPersister(config AzureMachinePoolSubnetPersisterConfig) (*AzureMachinePoolSubnetPersister, error)
func (*AzureMachinePoolSubnetPersister) Persist ¶
func (p *AzureMachinePoolSubnetPersister) Persist(ctx context.Context, subnet net.IPNet, namespace string, name string) error
Persist functions takes a subnet CIDR allocated for the specified AzureMachinePool (namespace/ name) and adds it to Subnets array in the corresponding Cluster CR that owns the specified AzureMachinePool.
type AzureMachinePoolSubnetPersisterConfig ¶
type AzureMachinePoolSubnetPersisterConfig struct { CtrlClient client.Client Logger micrologger.Logger }
type Checker ¶
Checker determines whether a subnet has to be allocated. This decision is being made based on the status of the Kubernetes runtime object defined by namespace and name.
type Collector ¶
Collector implementation must return all networks that are allocated on any given moment. Failing to do that will result in overlapping allocations.
type Config ¶
type Config struct { Checker Checker Collector Collector Locker locker.Interface Logger micrologger.Logger NetworkRangeGetter NetworkRangeGetter NetworkRangeType NetworkRangeType Persister Persister }
type NetworkRangeGetter ¶
type NetworkRangeGetter interface { // GetParentNetworkRange return the network range from which the VNet/subnet range // will be allocated. It receives the CR that is being reconciled. GetParentNetworkRange(ctx context.Context, obj interface{}) (net.IPNet, error) // GetRequiredIPMask returns an IP mask that is required by the network range // that will be allocated. GetRequiredIPMask() net.IPMask }
NetworkRangeGetter implementation returns a network range from which a free IP range can be allocated.
type NetworkRangeType ¶
type NetworkRangeType string
const ( Name = "ipam" SubnetRange NetworkRangeType = "subnet" VirtualNetworkRange NetworkRangeType = "virtual network" )
type Persister ¶
type Persister interface {
Persist(ctx context.Context, subnet net.IPNet, namespace string, name string) error
}
Persister must mutate shared persistent state so that on successful execution persisted networks are visible by Collector implementations.
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
Resource finds free IP ranges: - AzureConfig: within an installation range to create new virtual network for the tenant cluster. - CAPI/CAPZ: within a virtual network to create new subnets.
func (*Resource) EnsureCreated ¶
EnsureCreated allocates tenant cluster network segments. It gathers existing subnets from existing system resources like Vnets and Cluster CRs.
func (*Resource) EnsureDeleted ¶
type TestChecker ¶
type TestChecker struct {
// contains filtered or unexported fields
}
func NewTestChecker ¶
func NewTestChecker(proceed bool) *TestChecker
type TestCollector ¶
type TestCollector struct {
// contains filtered or unexported fields
}
func NewTestCollector ¶
func NewTestCollector(subnets []net.IPNet) *TestCollector
type TestNetworkRangeGetter ¶
type TestNetworkRangeGetter struct {
// contains filtered or unexported fields
}
func NewTestNetworkRangeGetter ¶
func NewTestNetworkRangeGetter(parentNetworkRange net.IPNet, requiredNetworkMaskBits int) *TestNetworkRangeGetter
func (*TestNetworkRangeGetter) GetParentNetworkRange ¶
func (*TestNetworkRangeGetter) GetRequiredIPMask ¶
func (g *TestNetworkRangeGetter) GetRequiredIPMask() net.IPMask
type TestPersister ¶
type TestPersister struct {
// contains filtered or unexported fields
}
func NewTestPersister ¶
func NewTestPersister(subnet net.IPNet) *TestPersister
type VirtualNetworkCollector ¶
type VirtualNetworkCollector struct {
// contains filtered or unexported fields
}
func NewVirtualNetworkCollector ¶
func NewVirtualNetworkCollector(config VirtualNetworkCollectorConfig) (*VirtualNetworkCollector, error)
type VirtualNetworkCollectorConfig ¶
type VirtualNetworkCollectorConfig struct { AzureMetricsCollector collector.AzureAPIMetrics CredentialProvider credential.Provider InstallationName string K8sClient k8sclient.Interface Logger micrologger.Logger NetworkRange net.IPNet }
Source Files ¶
- azure_config_checker.go
- azure_config_network_range_getter.go
- azure_config_persister.go
- azure_machinepool_network_range_getter.go
- azure_machinepool_subnet_checker.go
- azure_machinepool_subnet_collector.go
- azure_machinepool_subnet_persister.go
- create.go
- delete.go
- error.go
- resource.go
- spec.go
- test_checker.go
- test_collector.go
- test_network_range_getter.go
- test_persister.go
- virtualnetwork_collector.go