recommendation

package
v0.5.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	PercentileAlgorithmType = "percentile"
	// DefaultAlgorithmType use percentile as the default algorithm
	DefaultAlgorithmType = PercentileAlgorithmType
)
View Source
const (
	DefaultUsageBuffer = 30
	MaxUsageBuffer     = 100
	MinUsageBuffer     = 0
)
View Source
const (
	ContainerPolicySelectAllFlag = "*"
)
View Source
const (
	DefaultRecommenderType = "default"
)
View Source
const (
	// TargetRefKindDeployment is Deployment
	TargetRefKindDeployment string = "Deployment"
)

Variables

View Source
var AlgorithmTypes = []string{PercentileAlgorithmType}
View Source
var TargetRefKinds = []string{TargetRefKindDeployment}

Functions

func SortContainersByContainerName

func SortContainersByContainerName(containers []Container)

func ValidateAndExtractAlgorithmPolicy

func ValidateAndExtractAlgorithmPolicy(algorithmPolicyReq v1alpha1.AlgorithmPolicy) (
	v1alpha1.AlgorithmPolicy, *errortypes.CustomError,
)

Types

type ByContainerName

type ByContainerName []Container

func (ByContainerName) Len

func (c ByContainerName) Len() int

func (ByContainerName) Less

func (c ByContainerName) Less(i, j int) bool

func (ByContainerName) Swap

func (c ByContainerName) Swap(i, j int)

type Config

type Config struct {
	TargetRef       v1alpha1.CrossVersionObjectReference
	Containers      []Container
	AlgorithmPolicy v1alpha1.AlgorithmPolicy
}

type Container

type Container struct {
	ContainerName    string
	ContainerConfigs []ContainerConfig
}

func ValidateAndExtractContainers

func ValidateAndExtractContainers(ctx context.Context, client k8sclient.Client, namespace string,
	targetRef v1alpha1.CrossVersionObjectReference,
	containerPolicies []v1alpha1.ContainerResourcePolicy) (
	[]Container, *errortypes.CustomError,
)

type ContainerConfig

type ContainerConfig struct {
	ControlledResource    v1.ResourceName
	ResourceBufferPercent int32
}

type Recommendation

type Recommendation struct {
	types.NamespacedName
	ObservedGeneration int64
	Config
	// Map of the status conditions (keys are condition types).
	Conditions      *conditionstypes.ResourceRecommendConditionsMap
	Recommendations []v1alpha1.ContainerResources
}

func NewRecommendation

func NewRecommendation(resourceRecommend *v1alpha1.ResourceRecommend) *Recommendation

func (*Recommendation) AsStatus

AsStatus returns this objects equivalent of VPA Status.

func (*Recommendation) SetConfig

func (r *Recommendation) SetConfig(ctx context.Context, client k8sclient.Client,
	resourceRecommend *v1alpha1.ResourceRecommend,
) *errortypes.CustomError

Jump to

Keyboard shortcuts

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