quotamanagementv1alpha1

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package v1beta1 contains API Schema definitions for the usagemetricscollector.sigs.k8s.io API group +kubebuilder:object:generate=true +groupName=quotamanagement.usagemetricscollector.sigs.k8s.io +versionName=v1alpha1

+kubebuilder:object:generate=true

Index

Constants

View Source
const (
	// MaxObservedQuotaAnnotationKey is the key for an alpha field that stores
	// the max observed quotas associated with a ResourceQuotaDescriptor. This annotation's value will be a serialized ResourceList.
	MaxObservedQuotaAnnotationKey = "usagemetricscollector.sigs.k8s.io/maxObservedQuota"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: apiGroup, Version: apiVersion}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

This section is empty.

Types

type AllocationConstantStrategy

type AllocationConstantStrategy struct {
	ConstantAllocated bool `json:"constantAllocated"`
}

func (*AllocationConstantStrategy) DeepCopy

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

func (*AllocationConstantStrategy) DeepCopyInto

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

type AllocationDelayedStrategy

type AllocationDelayedStrategy struct {
	// ExpectedUsageDate is a timestamp of when the quota is expected to be allocated to pods.
	// This can be used to indicate an upcoming launch event, whereby you may not
	// be fully utilising your allocated resources until a known "go-live" date.
	// +required
	ExpectedUsageDate metav1.Time `json:"expectedUsageDate"`
}

func (*AllocationDelayedStrategy) DeepCopy

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

func (*AllocationDelayedStrategy) DeepCopyInto

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

type AllocationDisasterRecoveryStrategy

type AllocationDisasterRecoveryStrategy struct {
	// AlwaysAllocated indicates whether the quota is expected to be 'allocated' (e.g. consumed
	// by pods) all the time, for example in an 'active-active' or an `active-passive` configuration.
	// If false, it's expected that the quota will not be allocated until a disaster recovery
	// or test event actually occurs.
	// +required
	AlwaysAllocated bool `json:"alwaysAllocated"`
}

AllocationDisasterRecoveryStrategy indicates that this capacity is used for disaster recovery planning, and may not be allocated (or may consume significantly less CPU if it is allocated) until needed, either during a disaster recovery event or a test of disaster recovery resiliency.

func (*AllocationDisasterRecoveryStrategy) DeepCopy

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

func (*AllocationDisasterRecoveryStrategy) DeepCopyInto

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

type AllocationPercent

type AllocationPercent int

AllocationPercent is the target percentage for max quota allocated over a window. ex: 90 for a policy requiring that at least 90% of the available quota was allocated over an observation window. +kubebuilder:validation:Maximum=100 +kubebuilder:validation:Minimum=0

type AllocationPeriodicStrategy

type AllocationPeriodicStrategy struct {
	// Interval defines how frequently the quota is expected to meet its policy.
	// e.g. for a namespace that runs a job every 90 days, and is unallocated otherwise the duration would be 90 days.
	// +required
	Interval metav1.Duration `json:"interval"`
}

func (*AllocationPeriodicStrategy) DeepCopy

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

func (*AllocationPeriodicStrategy) DeepCopyInto

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

type AllocationStrategy

type AllocationStrategy struct {
	// AllocationStrategyType is the union discriminator for which strategy is used.
	// +required
	AllocationStrategyType AllocationStrategyType `json:"allocationStrategyType,omitempty"`

	// Delayed indicates that this capacity is intended to be consumed at a later date.
	// +optional
	Delayed *AllocationDelayedStrategy `json:"delayed,omitempty"`

	// DisasterRecovery indicates that this capacity is used for disaster recovery planning,
	// and may not be allocated (or may consume significantly less CPU if it is allocated)
	// until needed, either during a disaster recovery event or a test of disaster recovery
	// resiliency.
	// +optional
	DisasterRecovery *AllocationDisasterRecoveryStrategy `json:"disasterRecovery,omitempty"`

	// Periodic indicates interval at which you want to allocate resources
	// +optional
	Periodic *AllocationPeriodicStrategy `json:"periodic,omitempty"`

	// Constant indicates that resources are in constant or near constant use
	// eg. allocated for a significant portion of the day+
	// +optional
	Constant *AllocationConstantStrategy `json:"constant,omitempty"`
}

AllocationStrategy describes how a set of resource quota is to be used. Exactly one item is expected to be specified.

func (*AllocationStrategy) DeepCopy

func (in *AllocationStrategy) DeepCopy() *AllocationStrategy

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

func (*AllocationStrategy) DeepCopyInto

func (in *AllocationStrategy) DeepCopyInto(out *AllocationStrategy)

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

type AllocationStrategyType

type AllocationStrategyType string

AllocationStrategyType is the union discriminator for which strategy is used.

const (
	Delayed          AllocationStrategyType = "Delayed"
	DisasterRecovery AllocationStrategyType = "DisasterRecovery"
	Periodic         AllocationStrategyType = "Periodic"
	Constant         AllocationStrategyType = "Constant"
)

type PolicyState

type PolicyState string

AllocationStrategyType is the union discriminator for which strategy is used. +kubebuilder:validation:Enum=OutOfPolicy;InPolicy

const (
	OutOfPolicy PolicyState = "OutOfPolicy"
	InPolicy    PolicyState = "InPolicy"
)

type ResourceQuotaDescriptor

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

	Spec ResourceQuotaDescriptorSpec `json:"spec"`

	Status ResourceQuotaDescriptorStatus `json:"status,omitempty"`
}

ResourceQuotaDescriptor is used to describe what quota given out to a namespace is intended to be used for. This is created per priority class per namespace.

func (*ResourceQuotaDescriptor) DeepCopy

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

func (*ResourceQuotaDescriptor) DeepCopyInto

func (in *ResourceQuotaDescriptor) DeepCopyInto(out *ResourceQuotaDescriptor)

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

func (*ResourceQuotaDescriptor) DeepCopyObject

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

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

type ResourceQuotaDescriptorCondition

type ResourceQuotaDescriptorCondition struct {
	Type   ResourceQuotaDescriptorConditionType `json:"type,omitempty"`
	Status metav1.ConditionStatus               `json:"status,omitempty"`
	// +optional
	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
	Reason             string      `json:"reason,omitempty"`
	Message            string      `json:"message,omitempty"`
}

func (*ResourceQuotaDescriptorCondition) DeepCopy

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

func (*ResourceQuotaDescriptorCondition) DeepCopyInto

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

type ResourceQuotaDescriptorConditionType

type ResourceQuotaDescriptorConditionType string

+kubebuilder:validation:Enum=OutOfPolicy;RightsizeScheduled;Rightsized

const (
	// ResourceQuotaDescriptorOutOfPolicy is set to true if the namespace ResourceQuota usage does not
	// adhere to the policy stated in the ResourceQuotaDescriptor.
	ResourceQuotaDescriptorOutOfPolicy ResourceQuotaDescriptorConditionType = "OutOfPolicy"

	// ResourceQuotaDescriptorRightsizeScheduled is set to true if the Quota is OutOfPolicy and the
	// a rightsize is scheduled.
	ResourceQuotaDescriptorRightsizeScheduled ResourceQuotaDescriptorConditionType = "RightsizeScheduled"

	// ResourceQuotaDescriptorRequiresRightsize is set to true if the Quota had its values changed
	// as part of a rightsize event.
	ResourceQuotaDescriptorRightsized ResourceQuotaDescriptorConditionType = "Rightsized"
)

type ResourceQuotaDescriptorList

type ResourceQuotaDescriptorList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`

	Items []ResourceQuotaDescriptor `json:"items,omitempty"`
}

ResourceQuotaDescriptorList contains a list of ResourceQuotaDescriptorLists, used for deserializing LIST requests.

func (*ResourceQuotaDescriptorList) DeepCopy

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

func (*ResourceQuotaDescriptorList) DeepCopyInto

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

func (*ResourceQuotaDescriptorList) DeepCopyObject

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

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

type ResourceQuotaDescriptorSpec

type ResourceQuotaDescriptorSpec struct {
	// ResourceQuotaRef is object reference to ResourceQuota
	// +required
	ResourceQuotaRef corev1.LocalObjectReference `json:"resourceQuotaRef,omitempty"`

	// Issue is a URL reference to more context (ex: github issue)
	// +optional
	Issue string `json:"issue,omitempty"`

	// AllocationStrategy describes how the resources are to be used. Possible strategies are
	// Delayed, DisasterRecovery, Periodic, Constant
	// +required
	AllocationStrategy AllocationStrategy `json:"allocationStrategy"`

	// TargetAllocations defines the policy applied to quota usage.
	// +optional
	TargetAllocationsPolicy *TargetAllocationsPolicy `json:"targetAllocationsPolicy,omitempty"`
}

ResourceQuotaDescriptorSpec describes how a portion of ResourceQuota is used.

func (*ResourceQuotaDescriptorSpec) DeepCopy

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

func (*ResourceQuotaDescriptorSpec) DeepCopyInto

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

type ResourceQuotaDescriptorStatus

type ResourceQuotaDescriptorStatus struct {

	// ObservationWindowStart is the start time of the observation window used to populate
	// the status values.
	// +optional
	ObservationWindowStart *metav1.Time `json:"observationWindowStart,omitempty"`
	// ObservationWindowEnd is the end time of the observation window used to populate
	// the status values.
	// +optional
	ObservationWindowEnd *metav1.Time `json:"observationWindowEnd,omitempty"`
	// ObservationWindowLength is the duration of the obseration window used to populate
	// the status values.
	// +optional
	ObservationWindowLength *metav1.Duration `json:"observationWindowLength,omitempty"`

	// QuotaRightsizingEnabled is enabled for the resource quota.
	// +optional
	QuotaRightsizingEnabled *bool `json:"quotaRightsizingEnabled,omitempty"`

	// PolicyState defines the state of the resource quota with respect to the usage policy.
	// +optional
	PolicyState PolicyState `json:"policyState,omitempty"`

	// GracePeriodLength is the length of time a Quota may be OutOfPolicy before
	// it is rightsized according to the policy.
	// +optional
	GracePeriodLength *metav1.Duration `json:"gracePeriodLength,omitempty"`

	// ScheduledRightsizeDate is the time that the quota will be rightsized to the proposed
	// value.
	// Not set if no rightsize is scheduled.
	// +optional
	ScheduledRightsizeDate *metav1.Time `json:"scheduledRightsizeDate,omitempty"`

	// ActualQuota contains the most recent quota values observed during the window.
	// +optional
	ActualQuota corev1.ResourceList `json:"actualQuota,omitempty"`

	// ProposedQuota the quota values proposed for rightsizing.  If rightsizing is enabled
	// the quota values will be changed to the proposed values after a grace period.
	// ProposedQuota is driven off the observed quota used and the target policy
	// defined in the spec.
	// +optional
	ProposedQuota corev1.ResourceList `json:"proposedQuota,omitempty"`

	// PreRightsizeQuota is the *max* observed quota values prior to any rightsizing event.
	// It may be used to authorize increasing quota values back to their
	// pre-rightsized values.
	// +optional
	PreRightsizeQuota corev1.ResourceList `json:"preRightsizeQuota,omitempty"`

	// MaxUsedQuota is the max quota used during the observation window.
	// +optional
	MaxUsedQuota corev1.ResourceList `json:"maxUsedQuota,omitempty"`

	// P95UsedQuota is the p95 quota used during the observation window
	// +optional
	P95UsedQuota corev1.ResourceList `json:"p95UsedQuota,omitempty"`

	// AvgUsedQuota is the average quota used during the observation window
	// +optional
	AvgUsedQuota corev1.ResourceList `json:"avgUsedQuota,omitempty"`

	// LastRightsizeTime is the last time quota's values were set to the proposed quota value.
	// Not set if no rightsize has been performed.
	// +optional
	LastRightsizeTime *metav1.Time `json:"lastRightsizeTime,omitempty"`
}

ResourceQuotaDescriptorSpec describes how a portion of ResourceQuota is used.

func (*ResourceQuotaDescriptorStatus) DeepCopy

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

func (*ResourceQuotaDescriptorStatus) DeepCopyInto

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

type TargetAllocationsPolicy

type TargetAllocationsPolicy struct {
	// LimitsTargetPercent describes the maximum amount of compute resources allowed.
	// More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
	// +optional
	LimitsTargetPercent map[corev1.ResourceName]AllocationPercent `json:"limitsTargetPercent,omitempty"`
	// RequestsTargetPercent describes the minimum amount of compute resources required.
	// If RequestsTargetPercent is omitted for a container, it defaults to Limits if that is explicitly specified,
	// otherwise to an implementation-defined value.
	// More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
	// +optional
	RequestsTargetPercent map[corev1.ResourceName]AllocationPercent `json:"requestsTargetPercent,omitempty"`
}

TargetAllocationsPolicy defines the policy applied to quota usage.

func (*TargetAllocationsPolicy) DeepCopy

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

func (*TargetAllocationsPolicy) DeepCopyInto

func (in *TargetAllocationsPolicy) DeepCopyInto(out *TargetAllocationsPolicy)

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