v1alpha1

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the datadoghq v1alpha1 API group +k8s:deepcopy-gen=package,register +groupName=datadoghq.com

Package v1alpha1 contains API Schema definitions for the datadoghq v1alpha1 API group +kubebuilder:object:generate=true +groupName=datadoghq.com

Package v1alpha1 contains API Schema definitions for the datadoghq v1alpha1 API group +k8s:deepcopy-gen=package,register +groupName=datadoghq.com

Index

Constants

View Source
const (
	// ConditionReasonSuccessfulGetScale Condition when the target's scale can be retrieved
	ConditionReasonSuccessfulGetScale = "SucceededGetScale"
	// ConditionReasonScalingDisabled Condition when scaling is disable for the target
	ConditionReasonScalingDisabled = "ScalingDisabled"
	// ConditionReasonSuccessfulScale Condition reason for Succeeded Rescale
	ConditionReasonSuccessfulScale = "SuccessfulScale"
	// ConditionReasonFailedScale Condition reason for Failed Rescale
	ConditionReasonFailedScale = "FailedScale"
	// ConditionReasonReadyForScale Condition reason when the target is ready to be Scaled
	ConditionReasonReadyForScale = "ReadyForScale"
	// ConditionReasonFailedUpdateReplicasStatus Condition when unable to scale and update the target's status
	ConditionReasonFailedUpdateReplicasStatus = "FailedUpdateReplicas"
	// ConditionReasonBackOffDownscale Condition when downscaling is forbidden
	ConditionReasonBackOffDownscale = "BackoffDownscale"
	// ConditionReasonBackOffUpscale Condition when upscaling is forbidden
	ConditionReasonBackOffUpscale = "BackoffUpscale"
	// ConditionReasonBackOff Condition when scaling is forbidden
	ConditionReasonBackOff = "BackoffBoth"
	// ConditionReasonFailedGetExternalMetrics Condition when the External Metrics Server does not serve a metric
	ConditionReasonFailedGetExternalMetrics = "FailedGetExternalMetric"
	// ConditionReasonFailedGetResourceMetric Condition when the Resource Metrics Server does not serve a metric
	ConditionReasonFailedGetResourceMetric = "FailedGetResourceMetric"
	// ConditionValidMetricFound Condition when a valid metric is retrieved
	ConditionValidMetricFound = "ValidMetricFound"
	// ReasonFailedSpecCheck Reason when the spec of the WPA is incorrect
	ReasonFailedSpecCheck = "FailedSpecCheck"
	// ReasonNotScaling Reason when not scaling
	ReasonNotScaling = "NotScaling"
	// ReasonScaling Reason when scaling
	ReasonScaling = "Scaling"
	// ReasonFailedScale Reason when unable to scale
	ReasonFailedScale = "FailedScale"
	// ReasonFailedUpdateReplicasStatus Reason when unable to scale and update the target's status
	ReasonFailedUpdateReplicasStatus = "FailedUpdateReplicas"
	// ReasonFailedUpdateStatus Reason when the status can't be updated
	ReasonFailedUpdateStatus = "FailedUpdateStatus"
	// ReasonFailedProcessWPA Reason when the WPA can't be processed
	ReasonFailedProcessWPA = "FailedProcessWPA"
	// ReasonDatadogMonitorOK Reason when the DatadogMonitor associated with a WPA is in a OK state.
	ReasonDatadogMonitorOK = "DatadogMonitorOK"
	// ReasonDatadogMonitorNotOK Reason when the DatadogMonitor associated with a WPA is not in a OK state.
	ReasonDatadogMonitorNotOK = "DatadogMonitorNotOK"
	// ReasonFailedGetDatadogMonitor Reason when the DatadogMonitor associated with a WPA is not found.
	ReasonFailedGetDatadogMonitor = "FailedGetDatadogMonitor"
)
View Source
const ScalingBlocked autoscalingv2.HorizontalPodAutoscalerConditionType = "ScalingBlocked"

ScalingBlocked represents a given WPA's lifecycle will depend on the associated Datadog Monitor's state

View Source
const WatermarkPodAutoscalerStatusAboveHighWatermark autoscalingv2.HorizontalPodAutoscalerConditionType = "AboveHighWatermark"

WatermarkPodAutoscalerStatusAboveHighWatermark ConditionType used when the value is above the high watermark

View Source
const WatermarkPodAutoscalerStatusBelowLowWatermark autoscalingv2.HorizontalPodAutoscalerConditionType = "BelowLowWatermark"

WatermarkPodAutoscalerStatusBelowLowWatermark ConditionType used when the value is below the low watermark

View Source
const WatermarkPodAutoscalerStatusConvergeToWatermark autoscalingv2.HorizontalPodAutoscalerConditionType = "ConvergeToWatermark"

WatermarkPodAutoscalerStatusConvergeToWatermark ConditionType used when the value is within bound and we're trying to converge to the one of the watermarks

View Source
const WatermarkPodAutoscalerStatusDryRunCondition autoscalingv2.HorizontalPodAutoscalerConditionType = "DryRun"

WatermarkPodAutoscalerStatusDryRunCondition ConditionType used when the WPA is in dry run mode

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "datadoghq.com", Version: "v1alpha1"}

	// 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
)
View Source
var (
	// SchemeGroupVersion is group version used to register these objects
	SchemeGroupVersion = schema.GroupVersion{Group: "datadoghq.com", Version: "v1alpha1"}
)

Functions

func CheckWPAValidity

func CheckWPAValidity(wpa *WatermarkPodAutoscaler) error

CheckWPAValidity use to check the validty of a WatermarkPodAutoscaler return nil if valid, else an error

func IsDefaultWatermarkPodAutoscaler

func IsDefaultWatermarkPodAutoscaler(wpa *WatermarkPodAutoscaler) bool

IsDefaultWatermarkPodAutoscaler is used to know if a WatermarkPodAutoscaler has default values

func NewBool

func NewBool(b bool) *bool

NewBool returns pointer to a new bool value instance

func NewInt32

func NewInt32(i int32) *int32

NewInt32 return a pointer to an int32.

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

Types

type ConvergeTowardsWatermarkType added in v0.6.0

type ConvergeTowardsWatermarkType string

ConvergeTowardsWatermarkType indicates the direction to converge to while in stable regime (when the value is between watermarks).

var (
	// ConvergeUpwards will suggest downscaling the target for a value to converge towards it's High Watermark.
	// +optional
	ConvergeUpwards ConvergeTowardsWatermarkType = "highwatermark"
	// ConvergeUpwards will suggest upscaling the target for a value to converge towards it's Low Watermark.
	// +optional
	ConvergeDownwards ConvergeTowardsWatermarkType = "lowwatermark"
)

type CrossVersionObjectReference

type CrossVersionObjectReference struct {
	// Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds"
	Kind string `json:"kind"`
	// Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names
	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. +k8s:openapi-gen=true

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 ExternalMetricSource

type ExternalMetricSource struct {
	// metricName is the name of the metric in question.
	MetricName string `json:"metricName"`

	// metricSelector is used to identify a specific time series
	// within a given metric.
	// +optional
	MetricSelector *metav1.LabelSelector `json:"metricSelector,omitempty"`

	HighWatermark *resource.Quantity `json:"highWatermark,omitempty"`
	LowWatermark  *resource.Quantity `json:"lowWatermark,omitempty"`
}

ExternalMetricSource indicates how to scale on a metric not associated with any Kubernetes object (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster). Exactly one "target" type should be set. +k8s:openapi-gen=true

func (*ExternalMetricSource) DeepCopy

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

func (*ExternalMetricSource) DeepCopyInto

func (in *ExternalMetricSource) DeepCopyInto(out *ExternalMetricSource)

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

type MetricSourceType

type MetricSourceType string

MetricSourceType indicates the type of metric.

var (
	// ExternalMetricSourceType is a global metric that is not associated
	// with any Kubernetes object. It allows autoscaling based on information
	// coming from components running outside of cluster
	// (for example length of queue in cloud messaging service, or
	// QPS from loadbalancer running outside of cluster).
	ExternalMetricSourceType MetricSourceType = "External"

	// ResourceMetricSourceType is a resource metric known to Kubernetes, as
	// specified in requests and limits, describing each pod in the current
	// scale target (e.g. CPU or memory).  Such metrics are built in to
	// Kubernetes, and have special scaling options on top of those available
	// to normal per-pod metrics (the "pods" source).
	ResourceMetricSourceType MetricSourceType = "Resource"
)

type MetricSpec

type MetricSpec struct {
	// type is the type of metric source.  It should be one of "Object",
	// "Pods" or "Resource", each mapping to a matching field in the object.
	Type MetricSourceType `json:"type"`
	// external refers to a global metric that is not associated
	// with any Kubernetes object. It allows autoscaling based on information
	// coming from components running outside of cluster
	// (for example length of queue in cloud messaging service, or
	// QPS from loadbalancer running outside of cluster).
	// +optional
	External *ExternalMetricSource `json:"external,omitempty"`
	// resource refers to a resource metric (such as those specified in
	// requests and limits) known to Kubernetes describing each pod in the
	// current scale target (e.g. CPU or memory). Such metrics are built in to
	// Kubernetes, and have special scaling options on top of those available
	// to normal per-pod metrics using the "pods" source.
	// +optional
	Resource *ResourceMetricSource `json:"resource,omitempty"`
}

MetricSpec specifies how to scale based on a single metric (only `type` and one other matching field should be set at once). +k8s:openapi-gen=true

func (*MetricSpec) DeepCopy

func (in *MetricSpec) DeepCopy() *MetricSpec

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

func (*MetricSpec) DeepCopyInto

func (in *MetricSpec) DeepCopyInto(out *MetricSpec)

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

type ResourceMetricSource

type ResourceMetricSource struct {
	// name is the name of the resource in question.
	Name v1.ResourceName `json:"name"`

	// metricSelector is used to identify a specific time series
	// within a given metric.
	// +optional
	MetricSelector *metav1.LabelSelector `json:"metricSelector,omitempty"`

	HighWatermark *resource.Quantity `json:"highWatermark,omitempty"`
	LowWatermark  *resource.Quantity `json:"lowWatermark,omitempty"`
}

ResourceMetricSource indicates how to scale on a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). The values will be averaged together before being compared to the target. Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. Only one "target" type should be set. +k8s:openapi-gen=true

func (*ResourceMetricSource) DeepCopy

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

func (*ResourceMetricSource) DeepCopyInto

func (in *ResourceMetricSource) DeepCopyInto(out *ResourceMetricSource)

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

type WatermarkPodAutoscaler

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

	Spec   WatermarkPodAutoscalerSpec   `json:"spec,omitempty"`
	Status WatermarkPodAutoscalerStatus `json:"status,omitempty"`
}

WatermarkPodAutoscaler is the Schema for the watermarkpodautoscalers API +kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:printcolumn:name="scaling active",type="string",JSONPath=".status.conditions[?(@.type==\"ScalingActive\")].status" +kubebuilder:printcolumn:name="condition",type="string",JSONPath=".status.lastConditionType" +kubebuilder:printcolumn:name="condition state",type="string",JSONPath=".status.lastConditionState" +kubebuilder:printcolumn:name="value",type="string",JSONPath=".status.currentMetrics[*].external.currentValue.." +kubebuilder:printcolumn:name="high watermark",type="string",JSONPath=".spec.metrics[*].external.highWatermark.." +kubebuilder:printcolumn:name="low watermark",type="string",JSONPath=".spec.metrics[*].external.lowWatermark.." +kubebuilder:printcolumn:name="age",type="date",JSONPath=".metadata.creationTimestamp" +kubebuilder:printcolumn:name="min replicas",type="integer",JSONPath=".spec.minReplicas" +kubebuilder:printcolumn:name="max replicas",type="integer",JSONPath=".spec.maxReplicas" +kubebuilder:printcolumn:name="dry-run",type="string",JSONPath=".status.conditions[?(@.type==\"DryRun\")].status" +kubebuilder:printcolumn:name="last scale",type="date",JSONPath=".status.lastScaleTime" +kubebuilder:printcolumn:name="scale count",type="integer",priority=1,JSONPath=".status.scalingEventsCount" +kubebuilder:resource:path=watermarkpodautoscalers,shortName=wpa +k8s:openapi-gen=true +genclient

func DefaultWatermarkPodAutoscaler

func DefaultWatermarkPodAutoscaler(wpa *WatermarkPodAutoscaler) *WatermarkPodAutoscaler

DefaultWatermarkPodAutoscaler sets the default in the WPA

func (*WatermarkPodAutoscaler) DeepCopy

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

func (*WatermarkPodAutoscaler) DeepCopyInto

func (in *WatermarkPodAutoscaler) DeepCopyInto(out *WatermarkPodAutoscaler)

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

func (*WatermarkPodAutoscaler) DeepCopyObject

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

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

type WatermarkPodAutoscalerList

type WatermarkPodAutoscalerList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	// +listType=set
	Items []WatermarkPodAutoscaler `json:"items"`
}

WatermarkPodAutoscalerList contains a list of WatermarkPodAutoscaler +kubebuilder:object:root=true

func (*WatermarkPodAutoscalerList) DeepCopy

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

func (*WatermarkPodAutoscalerList) DeepCopyInto

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

func (*WatermarkPodAutoscalerList) DeepCopyObject

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

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

type WatermarkPodAutoscalerSpec

type WatermarkPodAutoscalerSpec struct {
	// part of HorizontalController, see comments in the k8s repo: pkg/controller/podautoscaler/horizontal.go
	// +kubebuilder:validation:Minimum=1
	DownscaleForbiddenWindowSeconds int32 `json:"downscaleForbiddenWindowSeconds,omitempty"`

	// +kubebuilder:validation:Minimum=1
	UpscaleForbiddenWindowSeconds int32 `json:"upscaleForbiddenWindowSeconds,omitempty"`

	// Percentage of replicas that can be added in an upscale event.
	// Parameter used to be a float, in order to support the transition seamlessly, we validate that it is [0;100] in the code.
	// ScaleUpLimitFactor == 0 means that upscaling will not be allowed for the target.
	ScaleUpLimitFactor *resource.Quantity `json:"scaleUpLimitFactor,omitempty"`

	// +kubebuilder:validation:Minimum=0
	UpscaleDelayAboveWatermarkSeconds int32 `json:"upscaleDelayAboveWatermarkSeconds,omitempty"`

	// Percentage of replicas that can be removed in an downscale event.
	// Parameter used to be a float, in order to support the transition seamlessly, we validate that it is [0;100[ in the code.
	// ScaleDownLimitFactor == 0 means that downscaling will not be allowed for the target.
	ScaleDownLimitFactor *resource.Quantity `json:"scaleDownLimitFactor,omitempty"`

	// +kubebuilder:validation:Minimum=0
	DownscaleDelayBelowWatermarkSeconds int32 `json:"downscaleDelayBelowWatermarkSeconds,omitempty"`

	// Number of replicas to scale by at a time. When set, replicas added or removed must be a multiple of this parameter.
	// Allows for special scaling patterns, for instance when an application requires a certain number of pods in multiple
	// +kubebuilder:validation:Minimum=1
	ReplicaScalingAbsoluteModulo *int32 `json:"replicaScalingAbsoluteModulo,omitempty"`

	// Try to make the usage converge towards High Watermark to save resources. This will slowly downscale by `ReplicaScalingAbsoluteModulo`
	// if the predicted usage stays bellow the high watermarks.
	ConvergeTowardsWatermark ConvergeTowardsWatermarkType `json:"convergeTowardsWatermark,omitempty"`

	// Parameter used to be a float, in order to support the transition seamlessly, we validate that it is ]0;1[ in the code.
	Tolerance resource.Quantity `json:"tolerance,omitempty"`

	// computed values take the # of replicas into account
	Algorithm string `json:"algorithm,omitempty"`

	// Whether planned scale changes are actually applied
	DryRun bool `json:"dryRun,omitempty"`

	// Zero is a value that can lead to undesired outcomes, unless explicitly set the WPA will not take action if the value retrieved is 0.
	TolerateZero bool `json:"tolerateZero,omitempty"`

	// part of HorizontalPodAutoscalerSpec, see comments in the k8s-1.10.8 repo: staging/src/k8s.io/api/autoscaling/v1/types.go
	// reference to scaled resource; horizontal pod autoscaler will learn the current resource consumption
	// and will set the desired number of pods by using its Scale subresource.
	ScaleTargetRef CrossVersionObjectReference `json:"scaleTargetRef"`
	// specifications that will be used to calculate the desired replica count
	// +optional
	// +listType=atomic
	Metrics []MetricSpec `json:"metrics,omitempty"`
	// +kubebuilder:validation:Minimum=1
	MinReplicas *int32 `json:"minReplicas,omitempty"`
	// MinAvailableReplicaPercentage indicates the minimum percentage of replicas that need to be available in order for the
	// controller to autoscale the target.
	// +kubebuilder:validation:Maximum=100
	MinAvailableReplicaPercentage int32 `json:"minAvailableReplicaPercentage,omitempty"`
	// +kubebuilder:validation:Minimum=1
	MaxReplicas int32 `json:"maxReplicas,omitempty"`
	// +kubebuilder:validation:Minimum=1
	ReadinessDelaySeconds int32 `json:"readinessDelaySeconds,omitempty"`
}

WatermarkPodAutoscalerSpec defines the desired state of WatermarkPodAutoscaler +k8s:openapi-gen=true

func (*WatermarkPodAutoscalerSpec) DeepCopy

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

func (*WatermarkPodAutoscalerSpec) DeepCopyInto

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

type WatermarkPodAutoscalerStatus

type WatermarkPodAutoscalerStatus struct {
	ObservedGeneration *int64       `json:"observedGeneration,omitempty"`
	LastScaleTime      *metav1.Time `json:"lastScaleTime,omitempty"`
	ScalingEventsCount int32        `json:"scalingEventsCount,omitempty"`
	CurrentReplicas    int32        `json:"currentReplicas"`
	DesiredReplicas    int32        `json:"desiredReplicas"`
	// +optional
	// +listType=atomic
	CurrentMetrics []autoscalingv2.MetricStatus `json:"currentMetrics,omitempty"`
	// +optional
	// +listType=atomic
	Conditions []autoscalingv2.HorizontalPodAutoscalerCondition `json:"conditions,omitempty"`

	// LastConditionType correspond to the last condition type updated in the WPA status during the WPA reconcile state.
	LastConditionType string `json:"lastConditionType,omitempty"`
	// LastConditionType correspond to the last condition state (True,False) updated in the WPA status during the WPA reconcile state.
	LastConditionState string `json:"lastConditionState,omitempty"`
}

WatermarkPodAutoscalerStatus defines the observed state of WatermarkPodAutoscaler +k8s:openapi-gen=true

func (*WatermarkPodAutoscalerStatus) DeepCopy

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

func (*WatermarkPodAutoscalerStatus) DeepCopyInto

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

Directories

Path Synopsis
Package test contains a set of test helper functions.
Package test contains a set of test helper functions.

Jump to

Keyboard shortcuts

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