capacity

package
v0.0.0-...-ea6e92e Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterManager

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

func NewClusterManager

func NewClusterManager(namespace string, cl runtimeclient.Client) *ClusterManager

func (*ClusterManager) GetOptimalTargetCluster

func (b *ClusterManager) GetOptimalTargetCluster(ctx context.Context, optimalClusterFilter OptimalTargetClusterFilter) (string, error)

GetOptimalTargetCluster returns the name of the cluster with the most available capacity where a Space could be provisioned.

If two clusters have the same limit and they both have the same usage, then the logic distributes spaces in a batches of 50.

If the two clusters don't have the same limit, then the batch is based on the scale of the limits. Let's say that the limit for member1 is 1000 and for member2 is 2000, then the batch of spaces would be 50 for member1 and 100 for member2.

If the preferredCluster is provided and it is also one of the available clusters, then the same name is returned. In case the preferredCluster was not provided or not found/available and the clusterRoles are provided then the candidates optimal cluster pool will be made out by only those matching the labels, if any available.

type OptimalTargetClusterFilter

type OptimalTargetClusterFilter struct {
	// PreferredCluster if specified and available,
	// it will be used to find the desired member cluster by name.
	PreferredCluster string
	// ToolchainStatusNamespace is the namespace where the toolchainstatus CR will be searched,
	// in order to check which cluster has enough resources and can be candidate for the "optimal" cluster for Space provisioning.
	ToolchainStatusNamespace string
	// ClusterRoles is a list of cluster-role labels,
	// if provided, only the clusters matching those labels will be selected as candidates for the "optimal" cluster.
	ClusterRoles []string
}

OptimalTargetClusterFilter is used by GetOptimalTargetCluster in order to retrieve an "optimal" cluster for the Space to be provisioned into.

Jump to

Keyboard shortcuts

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