v1alpha1

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 5 Imported by: 9

Documentation

Overview

Package v1alpha1 provides alpha API for Katalyst Recommendation API objects.

Index

Constants

View Source
const (
	// GroupName is the group name used in this package
	GroupName string = "recommendation.katalyst.kubewharf.io"
)
View Source
const (
	ResourceNameResourceRecommend = "resourcerecommends"
)

ResourceNameResourceRecommend const is used to construct standard gvr

Variables

View Source
var (
	// SchemeBuilder collects schemas to build.
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	// AddToScheme is used by generated client to add this scheme to the generated client.
	AddToScheme = SchemeBuilder.AddToScheme
)
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}

SchemeGroupVersion is group version used to register these objects

Functions

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

Types

type Algorithm

type Algorithm string

Algorithm is the recommended algorithm

const (
	// AlgorithmPercentile is percentile recommender algorithm
	AlgorithmPercentile Algorithm = "percentile"
)

Algorithms

type AlgorithmPolicy

type AlgorithmPolicy struct {
	// Recommender specify the Recommender to recommend
	// if end-user wants to define their own recommender,
	// they should manage this field to match their recommend implementations.
	// When the value is "default", the default recommender is used.
	// Default to "default"
	// +optional
	// +kubebuilder:default:=default
	Recommender string `json:"recommender,omitempty"`

	// Algorithm specifies the recommendation algorithm used by the
	// recommender, default to "percentile"
	// +optional
	// +kubebuilder:default:=percentile
	Algorithm Algorithm `json:"algorithm,omitempty"`

	// Extensions config by key-value format.
	// +optional
	// +kubebuilder:pruning:PreserveUnknownFields
	Extensions *runtime.RawExtension `json:"extensions,omitempty"`
}

func (*AlgorithmPolicy) DeepCopy

func (in *AlgorithmPolicy) DeepCopy() *AlgorithmPolicy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlgorithmPolicy.

func (*AlgorithmPolicy) DeepCopyInto

func (in *AlgorithmPolicy) DeepCopyInto(out *AlgorithmPolicy)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ContainerControlledResourcesPolicy

type ContainerControlledResourcesPolicy struct {
	// ResourceName is the name of the resource that is controlled.
	ResourceName v1.ResourceName `json:"resourceName"`

	// MinAllowed Specifies the minimal amount of resources that will be recommended
	// for the container. The default is no minimum.
	// +optional
	MinAllowed *resource.Quantity `json:"minAllowed,omitempty"`

	// MaxAllowed Specifies the maximum amount of resources that will be recommended
	// for the container. The default is no maximum.
	// +optional
	MaxAllowed *resource.Quantity `json:"maxAllowed,omitempty"`

	// BufferPercent is used to get extra resource buffer for the given containers
	// +optional
	BufferPercent *int32 `json:"bufferPercent,omitempty"`

	// ControlledValues specifies which resource values should be controlled.
	// Defaults to RequestsOnly.
	// +optional
	ControlledValues *ContainerControlledValues `json:"controlledValues,omitempty"`
}

func (*ContainerControlledResourcesPolicy) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerControlledResourcesPolicy.

func (*ContainerControlledResourcesPolicy) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ContainerControlledValues

type ContainerControlledValues string

ContainerControlledValues controls which resource value should be recommended.

const (
	// ContainerControlledValuesRequestsAndLimits means resource request and limits
	// are recommended automatically.
	ContainerControlledValuesRequestsAndLimits ContainerControlledValues = "RequestsAndLimits"
	// ContainerControlledValuesRequestsOnly means only requested resource is recommended.
	ContainerControlledValuesRequestsOnly ContainerControlledValues = "RequestsOnly"
	// ContainerControlledValuesLimitsOnly means only limited resource is recommended.
	ContainerControlledValuesLimitsOnly ContainerControlledValues = "LimitsOnly"
)

type ContainerResourceList

type ContainerResourceList struct {
	// Current indicates the real resource configuration from the view of CRI interface.
	// +optional
	Current v1.ResourceList `json:"current,omitempty"`
	// Recommended amount of resources. Observes ContainerResourcePolicy.
	Target v1.ResourceList `json:"target"`
	// The most recent recommended resources target computed by the recommender
	// for the controlled containers, based only on actual resource usage, not taking
	// into account the ContainerResourcePolicy (UsageBuffer).
	// +optional
	UncappedTarget v1.ResourceList `json:"uncappedTarget,omitempty"`
}

ContainerResourceList is used to represent the resourceLists

func (*ContainerResourceList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerResourceList.

func (*ContainerResourceList) DeepCopyInto

func (in *ContainerResourceList) DeepCopyInto(out *ContainerResourceList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ContainerResourcePolicy

type ContainerResourcePolicy struct {
	// Name of the container, or uses the wildcard "*".
	// If wildcard is used, the policy will apply to all containers under the workload
	ContainerName string `json:"containerName"`

	// ControlledResourcesPolicies controls how the recommenders computes recommended resources
	// for the container. If not specified, the recommenders computes recommended resources
	// for none of the container resources.
	ControlledResourcesPolicies []ContainerControlledResourcesPolicy `json:"controlledResourcesPolicies" patchStrategy:"merge"`
}

ContainerResourcePolicy provides the policy for recommender to manage the given container resources, including the container name, resource kind, usage buffer etc.

func (*ContainerResourcePolicy) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerResourcePolicy.

func (*ContainerResourcePolicy) DeepCopyInto

func (in *ContainerResourcePolicy) DeepCopyInto(out *ContainerResourcePolicy)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ContainerResources

type ContainerResources struct {
	// Name of the container.
	ContainerName string `json:"containerName"`
	// Requests indicates the recommenders resources for requests of this container
	// +optional
	Requests *ContainerResourceList `json:"requests,omitempty"`
	// Limits indicates the recommendation resources for limits of this container
	// +optional
	Limits *ContainerResourceList `json:"limits,omitempty"`
}

ContainerResources is the recommendations of resources computed by recommenders for a specific container. Respects the container resource policy in spec

func (*ContainerResources) DeepCopy

func (in *ContainerResources) DeepCopy() *ContainerResources

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerResources.

func (*ContainerResources) DeepCopyInto

func (in *ContainerResources) DeepCopyInto(out *ContainerResources)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CrossVersionObjectReference

type CrossVersionObjectReference struct {
	// Kind of the referent
	Kind string `json:"kind"`
	// Name of the referent
	Name string `json:"name"`
	// API version of the referent
	// +optional
	APIVersion string `json:"apiVersion,omitempty"`
}

CrossVersionObjectReference contains enough information to let you identify the referred resource. +structType=atomic

func (*CrossVersionObjectReference) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CrossVersionObjectReference.

func (*CrossVersionObjectReference) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PodResources

type PodResources struct {
	// Name of the pod.
	PodName string `json:"podName"`

	// Resources recommended by the recommenders for each container.
	// +optional
	// +patchMergeKey=containerName
	// +patchStrategy=merge
	ContainerRecommendations []ContainerResources `json:"containerRecommendations,omitempty"`
}

PodResources is the recommendation of resources computed by recommenders for a specific pod. Respects the container resource policy in the spec

func (*PodResources) DeepCopy

func (in *PodResources) DeepCopy() *PodResources

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodResources.

func (*PodResources) DeepCopyInto

func (in *PodResources) DeepCopyInto(out *PodResources)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RecommendResources

type RecommendResources struct {
	// Resources recommended by the recommenders for specific pod.
	// +optional
	// +patchMergeKey=podName
	// +patchStrategy=merge
	PodRecommendations []PodResources `json:"podRecommendations,omitempty"`

	// Resources recommended by the recommenders for each container.
	// +optional
	// +patchMergeKey=containerName
	// +patchStrategy=merge
	ContainerRecommendations []ContainerResources `json:"containerRecommendations,omitempty"`
}

RecommendResources is the recommendation of resources computed by recommenders for the controlled pods. Respects the container resource policy if present in the spec.

func (*RecommendResources) DeepCopy

func (in *RecommendResources) DeepCopy() *RecommendResources

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RecommendResources.

func (*RecommendResources) DeepCopyInto

func (in *RecommendResources) DeepCopyInto(out *RecommendResources)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourcePolicy

type ResourcePolicy struct {
	// policy of algorithm, if not provided, using default
	AlgorithmPolicy AlgorithmPolicy `json:"algorithmPolicy"`

	// Per-container resource recommend policies.
	// +patchMergeKey=containerName
	// +patchStrategy=merge
	ContainerPolicies []ContainerResourcePolicy `json:"containerPolicies" patchStrategy:"merge" patchMergeKey:"containerName"`
}

ResourcePolicy controls how computes the recommended resources

func (*ResourcePolicy) DeepCopy

func (in *ResourcePolicy) DeepCopy() *ResourcePolicy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePolicy.

func (*ResourcePolicy) DeepCopyInto

func (in *ResourcePolicy) DeepCopyInto(out *ResourcePolicy)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceRecommend

type ResourceRecommend struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   ResourceRecommendSpec   `json:"spec"`
	Status ResourceRecommendStatus `json:"status,omitempty"`
}

ResourceRecommend is the Schema for the resourcerecommends API

func (*ResourceRecommend) DeepCopy

func (in *ResourceRecommend) DeepCopy() *ResourceRecommend

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRecommend.

func (*ResourceRecommend) DeepCopyInto

func (in *ResourceRecommend) DeepCopyInto(out *ResourceRecommend)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ResourceRecommend) DeepCopyObject

func (in *ResourceRecommend) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ResourceRecommendCondition

type ResourceRecommendCondition struct {
	// type describes the current condition
	Type ResourceRecommendConditionType `json:"type"`
	// status is the status of the condition (True, False, Unknown)
	Status v1.ConditionStatus `json:"status"`
	// lastTransitionTime is the last time the condition transitioned from
	// one status to another
	// +optional
	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
	// reason is the reason for the condition's last transition.
	// +optional
	Reason string `json:"reason,omitempty"`
	// message is a human-readable explanation containing details about
	// the transition
	// +optional
	Message string `json:"message,omitempty"`
}

ResourceRecommendCondition describes the state of a ResourceRecommender at a certain point.

func (*ResourceRecommendCondition) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRecommendCondition.

func (*ResourceRecommendCondition) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceRecommendConditionType

type ResourceRecommendConditionType string

ResourceRecommendConditionType are the valid conditions of a ResourceRecommend.

const (
	// Validated indicates if initial validation is done
	Validated ResourceRecommendConditionType = "Validated"
	// Initialized indicates if the initialization is done
	Initialized ResourceRecommendConditionType = "Initialized"
	// RecommendationProvided indicates that recommender values have been provided
	RecommendationProvided ResourceRecommendConditionType = "RecommendationProvided"
)

type ResourceRecommendList

type ResourceRecommendList struct {
	metav1.TypeMeta `json:",inline"`

	// Standard list metadata
	// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
	// +optional
	metav1.ListMeta `json:"metadata,omitempty"`

	Items []ResourceRecommend `json:"items"`
}

ResourceRecommendList contains a list of ResourceRecommend

func (*ResourceRecommendList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRecommendList.

func (*ResourceRecommendList) DeepCopyInto

func (in *ResourceRecommendList) DeepCopyInto(out *ResourceRecommendList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ResourceRecommendList) DeepCopyObject

func (in *ResourceRecommendList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ResourceRecommendSpec

type ResourceRecommendSpec struct {
	// TargetRef points to the controller managing the set of pods for the recommenders to control。
	// e.g. Deployment.
	TargetRef CrossVersionObjectReference `json:"targetRef"`

	// ResourcePolicy controls how the recommender computes recommended resources.
	ResourcePolicy ResourcePolicy `json:"resourcePolicy"`
}

ResourceRecommendSpec defines the desired state of ResourceRecommend

func (*ResourceRecommendSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRecommendSpec.

func (*ResourceRecommendSpec) DeepCopyInto

func (in *ResourceRecommendSpec) DeepCopyInto(out *ResourceRecommendSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceRecommendStatus

type ResourceRecommendStatus struct {
	// LastRecommendationTime is last recommendation generation time
	// +optional
	LastRecommendationTime *metav1.Time `json:"lastRecommendationTime,omitempty"`

	// RecommendResources is the last recommendation of resources computed by
	// recommenders
	// +optional
	RecommendResources *RecommendResources `json:"recommendResources,omitempty"`

	// Conditions is the set of conditions required for this recommender to recommend,
	// and indicates whether those conditions are met.
	// +optional
	// +patchMergeKey=type
	// +patchStrategy=merge
	Conditions []ResourceRecommendCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`

	// ObservedGeneration used to record the generation number when status is updated.
	ObservedGeneration int64 `json:"observedGeneration"`
}

ResourceRecommendStatus defines the observed state of ResourceRecommend

func (*ResourceRecommendStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRecommendStatus.

func (*ResourceRecommendStatus) DeepCopyInto

func (in *ResourceRecommendStatus) DeepCopyInto(out *ResourceRecommendStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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