diff --git a/api/datadoghq/v2alpha1/datadogpodautoscaler_types.go b/api/datadoghq/v2alpha1/datadogpodautoscaler_types.go index ef4253133..eddcef2b0 100644 --- a/api/datadoghq/v2alpha1/datadogpodautoscaler_types.go +++ b/api/datadoghq/v2alpha1/datadogpodautoscaler_types.go @@ -6,30 +6,537 @@ package v2alpha1 import ( + autoscalingv2 "k8s.io/api/autoscaling/v2" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. +// spec: +// targetRef: +// apiVersion: apps/v1 +// kind: Deployment +// name: test +// owner: local +// remoteVersion: 1 +// actuation: +// mode: Apply | Preview +// update: +// strategy: Auto|Disabled +// upscale: +// strategy: Max|Min|Disabled +// rules: +// - type: Pods|Percent +// value: 1 +// periodSeconds: 60 +// downscale: +// strategy: Max|Min|Disabled +// rules: +// - type: Pods|Percent +// value: 1 +// periodSeconds: 60 +// objectives: +// - type: PodResource +// resource: +// name: cpu +// value: +// type: Absolute|Utilization +// absolute: 500m +// utilization: 80 +// - type: ContainerResource +// containerResource: +// name: cpu +// value: +// type: Absolute|Utilization +// absolute: 500m +// utilization: 80 +// constraints: +// minReplicas: 1 +// maxReplicas: 10 +// containers: +// - name: "*" +// enabled: true +// requests: +// minAllowed: +// maxAllowed: + +// DatadogPodAutoscalerOwner defines the source of truth for this object (local or remote) +// +kubebuilder:validation:Enum:=Local;Remote +type DatadogPodAutoscalerOwner string + +const ( + // DatadogPodAutoscalerLocalOwner states that this `DatadogPodAutoscaler` object is created/managed outside of Datadog app. + DatadogPodAutoscalerLocalOwner DatadogPodAutoscalerOwner = "Local" + + // DatadogPodAutoscalerLocalOwner states that this `DatadogPodAutoscaler` object is created/managed in Datadog app. + DatadogPodAutoscalerRemoteOwner DatadogPodAutoscalerOwner = "Remote" +) // DatadogPodAutoscalerSpec defines the desired state of DatadogPodAutoscaler type DatadogPodAutoscalerSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster - // Important: Run "make" to regenerate code after modifying this file + // TargetRef is the reference to the resource to scale. + TargetRef autoscalingv2.CrossVersionObjectReference `json:"targetRef"` + + // Owner defines the source of truth for this object (local or remote) + // Value needs to be set when a DatadogPodAutoscaler object is created. + Owner DatadogPodAutoscalerOwner `json:"owner"` + + // RemoteVersion is the version of the .Spec currently store in this object. + // Only set if the owner is Remote. + RemoteVersion *uint64 `json:"remoteVersion,omitempty"` + + // Actuation defines how recommendations should be applied. + // +optional + // +kubebuilder:default={} + Actuation *DatadogPodAutoscalerActuation `json:"actuation,omitempty"` + + // Objectives are objectives to reach and maintain for the target resource. + // Default to a single target to maintain 80% POD CPU utilization. + // +listType=atomic + // +optional + Objectives []DatadogPodAutoscalerObjective `json:"objectives,omitempty"` + + // Constraints defines constraints that should always be respected. + Constraints *DatadogPodAutoscalerConstraints `json:"constraints,omitempty"` +} + +// DatadogPodAutoscalerOwner defines the source of truth for this object (local or remote) +// +kubebuilder:validation:Enum:=All;Manual;None +type DatadogPodAutoscalerActuationMode string + +const ( + // DatadogPodAutoscalerApplyApplyMode allows the controller to apply all recommendations (regular and manual) + DatadogPodAutoscalerApplyApplyMode DatadogPodAutoscalerActuationMode = "Apply" + + // DatadogPodAutoscalerPreviewApplyMode doesn't allow the controller to apply any recommendations + DatadogPodAutoscalerPreviewApplyMode DatadogPodAutoscalerActuationMode = "Preview" +) + +// DatadogPodAutoscalerActuation defines how recommendations should be applied. +type DatadogPodAutoscalerActuation struct { + // Mode determines recommendations that should be applied by the controller: + // - All: Apply all recommendations (regular and manual). + // - Manual: Apply only manual recommendations (recommendations manually validated by user in the Datadog app). + // - None: Prevent the controller to apply any recommendations. + // It's also possible to selectively deactivate upscale, downscale or update actions thanks to the `Upscale`, `Downscale` and `Update` fields. + // +optional + // +kubebuilder:default=All + Mode DatadogPodAutoscalerActuationMode `json:"applyMode"` + + // Update defines the policy to update target resource. + Update *DatadogPodAutoscalerUpdatePolicy `json:"update,omitempty"` + + // Upscale defines the policy to scale up the target resource. + Upscale *DatadogPodAutoscalerScalingPolicy `json:"upscale,omitempty"` + + // Downscale defines the policy to scale down the target resource. + Downscale *DatadogPodAutoscalerScalingPolicy `json:"downscale,omitempty"` +} + +// DatadogPodAutoscalerUpdateStrategy defines the mode of the update policy. +// +kubebuilder:validation:Enum:=Auto;Disabled +type DatadogPodAutoscalerUpdateStrategy string + +const ( + // DatadogPodAutoscalerAutoUpdateStrategy is the default mode. + DatadogPodAutoscalerAutoUpdateStrategy DatadogPodAutoscalerUpdateStrategy = "Auto" + + // DatadogPodAutoscalerDisabledUpdateStrategy will disable the update of the target resource. + DatadogPodAutoscalerDisabledUpdateStrategy DatadogPodAutoscalerUpdateStrategy = "Disabled" +) + +// DatadogPodAutoscalerUpdatePolicy defines the policy to update target resource. +type DatadogPodAutoscalerUpdatePolicy struct { + // Mode defines the mode of the update policy. + Strategy DatadogPodAutoscalerUpdateStrategy `json:"strategy,omitempty"` +} + +// +// Scaling policy is inspired by the HorizontalPodAutoscalerV2 +// https://github.com/kubernetes/api/blob/master/autoscaling/v2/types.go +// Copyright 2021 The Kubernetes Authors. +// + +// DatadogPodAutoscalerScalingStrategySelect is used to specify which policy should be used while scaling in a certain direction +// +kubebuilder:validation:Enum:=Max;Min;Disabled +type DatadogPodAutoscalerScalingStrategySelect string + +const ( + // DatadogPodAutoscalerMaxChangeStrategySelect selects the policy with the highest possible change. + DatadogPodAutoscalerMaxChangeStrategySelect DatadogPodAutoscalerScalingStrategySelect = "Max" + + // DatadogPodAutoscalerMinChangeStrategySelect selects the policy with the lowest possible change. + DatadogPodAutoscalerMinChangeStrategySelect DatadogPodAutoscalerScalingStrategySelect = "Min" + + // DatadogPodAutoscalerDisabledStrategySelect disables the scaling in this direction. + DatadogPodAutoscalerDisabledStrategySelect DatadogPodAutoscalerScalingStrategySelect = "Disabled" +) + +// DatadogPodAutoscalerScalingPolicy defines the policy to scale the target resource. +type DatadogPodAutoscalerScalingPolicy struct { + // Strategy is used to specify which policy should be used. + // If not set, the default value Max is used. + // +optional + Strategy *DatadogPodAutoscalerScalingStrategySelect `json:"strategy,omitempty"` + + // Rules is a list of potential scaling polices which can be used during scaling. + // At least one policy must be specified, otherwise the DatadogPodAutoscalerScalingPolicy will be discarded as invalid + // +listType=atomic + // +optional + Rules []DatadogPodAutoscalerScalingRule `json:"rules,omitempty"` + + // StabilizationWindowSeconds is the number of seconds the controller should lookback at previous recommendations + // before deciding to apply a new one. Defaults to 0. + // +optional + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=1800 + StabilizationWindowSeconds int32 `json:"stabilizationWindowSeconds,omitempty"` +} + +// DatadogPodAutoscalerScalingRuleType defines how scaling rule value should be interpreted. +// +kubebuilder:validation:Enum:=Pods;Percent +type DatadogPodAutoscalerScalingRuleType string + +const ( + // DatadogPodAutoscalerPodsScalingRuleType specifies a change in absolute number of pods compared to the starting number of PODs. + DatadogPodAutoscalerPodsScalingRuleType DatadogPodAutoscalerScalingRuleType = "Pods" + + // DatadogPodAutoscalerPercentScalingRuleType specifies a relative amount of change compared to the starting number of PODs. + DatadogPodAutoscalerPercentScalingRuleType DatadogPodAutoscalerScalingRuleType = "Percent" +) + +// DatadogPodAutoscalerScalingRule define rules for horizontal that should be true for a certain amount of time. +type DatadogPodAutoscalerScalingRule struct { + // Type is used to specify the scaling policy. + Type DatadogPodAutoscalerScalingRuleType `json:"type"` + + // Value contains the amount of change which is permitted by the policy. + // Setting it to 0 will prevent any scaling in this direction and should not be used unless Match is set to IfScalingEvent. + // +kubebuilder:validation:Minimum=0 + Value int32 `json:"value"` + + // PeriodSeconds specifies the window of time for which the policy should hold true. + // PeriodSeconds must be greater than zero and less than or equal to 1800 (30 min). + // +kubebuilder:validation:Minimum=1 + // +kubebuilder:validation:Maximum=1800 + PeriodSeconds int32 `json:"periodSeconds"` +} + +// DatadogPodAutoscalerTargetType defines the type of the target. +// +kubebuilder:validation:Enum:=PodResource;ContainerResource +type DatadogPodAutoscalerTargetType string + +const ( + // DatadogPodAutoscalerResourceTargetType allows to set POD-level resources targets. + DatadogPodAutoscalerResourceTargetType DatadogPodAutoscalerTargetType = "PodResource" + + // DatadogPodAutoscalerContainerResourceTargetType allows to set container-level resources targets. + DatadogPodAutoscalerContainerResourceTargetType DatadogPodAutoscalerTargetType = "ContainerResource" +) + +// DatadogPodAutoscalerObjective defines the objectives to reach and maintain for the target resource. +type DatadogPodAutoscalerObjective struct { + // Type sets the type of the target. + Type DatadogPodAutoscalerTargetType `json:"type"` + + // PodResource allows to set a POD-level resource target. + PodResource *DatadogPodAutoscalerResourceTarget `json:"podResource,omitempty"` + + // ContainerResource allows to set a container-level resource target. + ContainerResource *DatadogPodAutoscalerContainerResourceTarget `json:"containerResource,omitempty"` +} + +// DatadogPodAutoscalerResourceTarget defines a POD-level resource target (for instance, CPU Utilization at 80%) +// For POD-level targets, resources are the sum of all containers resources. +// Utilization is computed from sum(usage) / sum(requests). +type DatadogPodAutoscalerResourceTarget struct { + // Name is the name of the resource. + // +kubebuilder:validation:Enum:=cpu + Name corev1.ResourceName `json:"name"` + + // Value is the value of the target. + Value DatadogPodAutoscalerTargetValue `json:"value"` +} + +// DatadogPodAutoscalerContainerResourceTarget defines a Container level resource target (for instance, CPU Utilization for container named "foo" at 80%) +type DatadogPodAutoscalerContainerResourceTarget struct { + // Name is the name of the resource. + // +kubebuilder:validation:Enum:=cpu + Name corev1.ResourceName `json:"name"` + + // Value is the value of the target. + Value DatadogPodAutoscalerTargetValue `json:"value"` + + // Container is the name of the container. + Container string `json:"container"` +} + +// DatadogPodAutoscalerTargetValue defines the value of the target. +type DatadogPodAutoscalerTargetValue struct { + // Type specifies how the value is expressed (Absolute or Utilization). + Type DatadogPodAutoscalerTargetValueType `json:"type"` + + // Absolute defines the absolute value of the target (for instance 500 millicores). + Absolute *resource.Quantity `json:"absolute,omitempty"` + + // Utilization defines a percentage of the target compared to requested resource + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=100 + Utilization *int32 `json:"utilization,omitempty"` +} + +// DatadogPodAutoscalerTargetValueType specifies the type of metric being targeted, and should be either +// kubebuilder:validation:Enum:=Absolute;Utilization +type DatadogPodAutoscalerTargetValueType string + +const ( + // DatadogPodAutoscalerAbsoluteTargetValueType is the target type for absolute values + DatadogPodAutoscalerAbsoluteTargetValueType DatadogPodAutoscalerTargetValueType = "Absolute" + + // DatadogPodAutoscalerUtilizationTargetValueType declares a MetricTarget is an AverageUtilization value + DatadogPodAutoscalerUtilizationTargetValueType DatadogPodAutoscalerTargetValueType = "Utilization" +) + +// DatadogPodAutoscalerConstraints defines constraints that should always be respected. +type DatadogPodAutoscalerConstraints struct { + // MinReplicas is the lower limit for the number of POD replicas. Needs to be >= 1. Default to 1. + // +kubebuilder:validation:Minimum=1 + MinReplicas *int32 `json:"minReplicas,omitempty"` + + // MaxReplicas is the upper limit for the number of POD replicas. Needs to be >= minReplicas. + MaxReplicas int32 `json:"maxReplicas"` - // Foo is an example field of DatadogPodAutoscaler. Edit datadogpodautoscaler_types.go to remove/update - Foo string `json:"foo,omitempty"` + // Containers defines constraints for the containers. + Containers []DatadogPodAutoscalerContainerConstraints `json:"containers,omitempty"` +} + +// DatadogPodAutoscalerContainerConstraints defines constraints that should always be respected for a container. +// If no constraints are set, it enables resources scaling for all containers without any constraints. +type DatadogPodAutoscalerContainerConstraints struct { + // Name is the name of the container. Can be "*" to apply to all containers. + Name string `json:"name"` + + // Enabled false allows to disable resources autoscaling for the container. Default to true. + Enabled *bool `json:"enabled,omitempty"` + + // Requests defines the constraints for the requests of the container. + Requests *DatadogPodAutoscalerContainerResourceConstraints `json:"requests,omitempty"` +} + +type DatadogPodAutoscalerContainerResourceConstraints struct { + // MinAllowed is the lower limit for the requests of the container. + // +optional + MinAllowed corev1.ResourceList `json:"minAllowed,omitempty"` + + // MaxAllowed is the upper limit for the requests of the container. + // +optional + MaxAllowed corev1.ResourceList `json:"maxAllowed,omitempty"` } // DatadogPodAutoscalerStatus defines the observed state of DatadogPodAutoscaler type DatadogPodAutoscalerStatus struct { - // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - // Important: Run "make" to regenerate code after modifying this file + // Vertical is the status of the vertical scaling, if activated. + // +optional + Vertical *DatadogPodAutoscalerVerticalStatus `json:"vertical,omitempty"` + + // Horizontal is the status of the horizontal scaling, if activated. + // +optional + Horizontal *DatadogPodAutoscalerHorizontalStatus `json:"horizontal,omitempty"` + + // CurrentReplicas is the current number of PODs for the targetRef observed by the controller. + // +optional + CurrentReplicas *int32 `json:"currentReplicas,omitempty"` + + // Conditions describe the current state of the DatadogPodAutoscaler operations. + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + // +optional + Conditions []DatadogPodAutoscalerCondition `json:"conditions,omitempty"` +} + +// DatadogPodAutoscalerValueSource defines the source of the value used to scale the target resource. +type DatadogPodAutoscalerValueSource string + +const ( + // DatadogPodAutoscalerAutoscalingValueSource is a recommendation that comes from active autoscaling. + DatadogPodAutoscalerAutoscalingValueSource DatadogPodAutoscalerValueSource = "Autoscaling" + + // DatadogPodAutoscalerManualValueSource is a recommendation that comes from manually applying a recommendation. + DatadogPodAutoscalerManualValueSource DatadogPodAutoscalerValueSource = "Manual" + + // DatadogPodAutoscalerLocalValueSource is a recommendation that comes from local fallback. + DatadogPodAutoscalerLocalValueSource DatadogPodAutoscalerValueSource = "Local" +) + +// DatadogPodAutoscalerHorizontalStatus defines the status of the horizontal scaling +type DatadogPodAutoscalerHorizontalStatus struct { + // Target is the current target of the horizontal scaling + Target *DatadogPodAutoscalerHorizontalTargetStatus `json:"target,omitempty"` + + // LastActions are the last successful actions done by the controller + LastActions []DatadogPodAutoscalerHorizontalAction `json:"lastActions,omitempty"` +} + +// DatadogPodAutoscalerHorizontalTargetStatus defines the current target of the horizontal scaling +type DatadogPodAutoscalerHorizontalTargetStatus struct { + // Source is the source of the value used to scale the target resource + Source DatadogPodAutoscalerValueSource `json:"source"` + + // GeneratedAt is the timestamp at which the recommendation was generated + GeneratedAt metav1.Time `json:"generatedAt,omitempty"` + + // Replicas is the desired number of replicas for the resource + Replicas int32 `json:"desiredReplicas"` +} + +// DatadogPodAutoscalerHorizontalAction represents an horizontal action done by the controller +type DatadogPodAutoscalerHorizontalAction struct { + // Time is the timestamp of the action + Time metav1.Time `json:"time"` + + // FromReplicas is the number of replicas before the action + FromReplicas int32 `json:"replicas"` + + // ToReplicas is the effective number of replicas after the action + ToReplicas int32 `json:"toReplicas"` + + // RecommendedReplicas is the original number of replicas recommended by Datadog + RecommendedReplicas *int32 `json:"recommendedReplicas,omitempty"` + + // LimitedReason is the reason why the action was limited (ToReplicas != RecommendedReplicas) + LimitedReason *string `json:"limitedReason,omitempty"` +} + +// DatadogPodAutoscalerVerticalStatus defines the status of the vertical scaling +type DatadogPodAutoscalerVerticalStatus struct { + // Target is the current target of the vertical scaling + Target *DatadogPodAutoscalerVerticalTargetStatus `json:"target,omitempty"` + + // LastAction is the last successful action done by the controller + LastAction *DatadogPodAutoscalerVerticalAction `json:"lastAction,omitempty"` +} + +// DatadogPodAutoscalerVerticalTargetStatus defines the current target of the vertical scaling +type DatadogPodAutoscalerVerticalTargetStatus struct { + // Source is the source of the value used to scale the target resource + Source DatadogPodAutoscalerValueSource `json:"source"` + + // GeneratedAt is the timestamp at which the recommendation was generated + GeneratedAt metav1.Time `json:"generatedAt,omitempty"` + + // Version is the current version of the received recommendation + Version string `json:"version"` + + // Scaled is the current number of PODs having desired resources + Scaled *int32 `json:"scaled,omitempty"` + + // DesiredResources is the desired resources for containers + DesiredResources []DatadogPodAutoscalerContainerResources `json:"desiredResources"` + + // PODCPURequest is the sum of CPU requests for all containers (used for display) + PODCPURequest resource.Quantity `json:"podCPURequest"` + + // PODMemoryRequest is the sum of memory requests for all containers (used for display) + PODMemoryRequest resource.Quantity `json:"podMemoryRequest"` +} + +// DatadogPodAutoscalerVerticalActionType represents the type of action done by the controller +type DatadogPodAutoscalerVerticalActionType string + +const ( + // DatadogPodAutoscalerRolloutTriggeredVerticalActionType is the action when the controller triggers a rollout of the targetRef + DatadogPodAutoscalerRolloutTriggeredVerticalActionType DatadogPodAutoscalerVerticalActionType = "RolloutTriggered" +) + +// DatadogPodAutoscalerVerticalAction represents a vertical action done by the controller +type DatadogPodAutoscalerVerticalAction struct { + // Time is the timestamp of the action + Time metav1.Time `json:"time"` + + // Version is the recommendation version used for the action + Version string `json:"version"` + + // Type is the type of action + Type DatadogPodAutoscalerVerticalActionType `json:"type"` +} + +type DatadogPodAutoscalerContainerResources struct { + // Name is the name of the container + Name string `json:"name"` + + // Limits describes the maximum amount of compute resources allowed. + // +optional + Limits corev1.ResourceList `json:"limits,omitempty"` + + // Requests describes target resources of compute resources allowed. + // +optional + Requests corev1.ResourceList `json:"requests,omitempty"` +} + +// DatadogPodAutoscalerConditionType type use to represent a DatadogMetric condition +type DatadogPodAutoscalerConditionType string + +const ( + // DatadogPodAutoscalerErrorCondition is true when a global error is encountered processing this DatadogPodAutoscaler. + DatadogPodAutoscalerErrorCondition DatadogPodAutoscalerConditionType = "Error" + + // DatadogPodAutoscalerActiveCondition is true when the DatadogPodAutoscaler can be used for autoscaling. + DatadogPodAutoscalerActiveCondition DatadogPodAutoscalerConditionType = "Active" + + // DatadogPodAutoscalerHorizontalAbleToRecommendCondition is true when we can get horizontal recommendation from Datadog. + DatadogPodAutoscalerHorizontalAbleToRecommendCondition DatadogPodAutoscalerConditionType = "HorizontalAbleToRecommend" + + // DatadogPodAutoscalerHorizontalAbleToScaleCondition is true when horizontal scaling is working correctly. + DatadogPodAutoscalerHorizontalAbleToScaleCondition DatadogPodAutoscalerConditionType = "HorizontalAbleToScale" + + // DatadogPodAutoscalerHorizontalScalingLimitedCondition is true when horizontal scaling is limited by constraints. + DatadogPodAutoscalerHorizontalScalingLimitedCondition DatadogPodAutoscalerConditionType = "HorizontalScalingLimited" + + // DatadogPodAutoscalerVerticalAbleToRecommendCondition is true when we can ge vertical recommendation from Datadog. + DatadogPodAutoscalerVerticalAbleToRecommendCondition DatadogPodAutoscalerConditionType = "VerticalAbleToRecommend" + + // DatadogPodAutoscalerVerticalAbleToApply is true when we can rollout the targetRef to pick up new resources. + DatadogPodAutoscalerVerticalAbleToApply DatadogPodAutoscalerConditionType = "VerticalAbleToApply" +) + +// DatadogPodAutoscalerCondition describes the state of DatadogPodAutoscaler. +type DatadogPodAutoscalerCondition struct { + // Type of DatadogMetric condition. + Type DatadogPodAutoscalerConditionType `json:"type"` + + // Status of the condition, one of True, False, Unknown. + Status corev1.ConditionStatus `json:"status"` + + // Last time the condition transitioned from one status to another. + // +optional + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` + + // The reason for the condition's last transition. + // +optional + Reason string `json:"reason,omitempty"` + + // A human readable message indicating details about the transition. + // +optional + Message string `json:"message,omitempty"` } // +kubebuilder:object:root=true +// +kubebuilder:resource:shortName=dpa // +kubebuilder:subresource:status - +// +kubebuilder:printcolumn:name="Apply Mode",type="string",JSONPath=".spec.policy.applyMode" +// +kubebuilder:printcolumn:name="Active",type="string",JSONPath=".status.conditions[?(@.type=='Active')].status" +// +kubebuilder:printcolumn:name="In Error",type="string",JSONPath=".status.conditions[?(@.type=='Error')].status" +// +kubebuilder:printcolumn:name="Desired Replicas",type="integer",JSONPath=".status.horizontal.target.desiredReplicas" +// +kubebuilder:printcolumn:name="Generated",type="date",JSONPath=".status.horizontal.target.generatedAt" +// +kubebuilder:printcolumn:name="Able to Scale",type="string",JSONPath=".status.conditions[?(@.type=='HorizontalAbleToScale')].status" +// +kubebuilder:printcolumn:name="Last Scale",type="date",JSONPath=".status.horizontal.lastAction.time" +// +kubebuilder:printcolumn:name="Target CPU Req",type="string",JSONPath=".status.vertical.target.podCPURequest" +// +kubebuilder:printcolumn:name="Target Memory Req",type="string",JSONPath=".status.vertical.target.podMemoryRequest" +// +kubebuilder:printcolumn:name="Generated",type="date",JSONPath=".status.vertical.target.generatedAt" +// +kubebuilder:printcolumn:name="Able to Apply",type="string",JSONPath=".status.conditions[?(@.type=='VerticalAbleToApply')].status" +// +kubebuilder:printcolumn:name="Last Trigger",type="date",JSONPath=".status.vertical.lastAction.time" // DatadogPodAutoscaler is the Schema for the datadogpodautoscalers API type DatadogPodAutoscaler struct { metav1.TypeMeta `json:",inline"` @@ -39,7 +546,7 @@ type DatadogPodAutoscaler struct { Status DatadogPodAutoscalerStatus `json:"status,omitempty"` } -// +kubebuilder:object:root=true +//+kubebuilder:object:root=true // DatadogPodAutoscalerList contains a list of DatadogPodAutoscaler type DatadogPodAutoscalerList struct { diff --git a/api/datadoghq/v2alpha1/zz_generated.deepcopy.go b/api/datadoghq/v2alpha1/zz_generated.deepcopy.go index c5607e57d..46bb1f3df 100644 --- a/api/datadoghq/v2alpha1/zz_generated.deepcopy.go +++ b/api/datadoghq/v2alpha1/zz_generated.deepcopy.go @@ -1294,8 +1294,8 @@ func (in *DatadogPodAutoscaler) DeepCopyInto(out *DatadogPodAutoscaler) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - out.Status = in.Status + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscaler. @@ -1316,6 +1316,247 @@ func (in *DatadogPodAutoscaler) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatadogPodAutoscalerActuation) DeepCopyInto(out *DatadogPodAutoscalerActuation) { + *out = *in + if in.Update != nil { + in, out := &in.Update, &out.Update + *out = new(DatadogPodAutoscalerUpdatePolicy) + **out = **in + } + if in.Upscale != nil { + in, out := &in.Upscale, &out.Upscale + *out = new(DatadogPodAutoscalerScalingPolicy) + (*in).DeepCopyInto(*out) + } + if in.Downscale != nil { + in, out := &in.Downscale, &out.Downscale + *out = new(DatadogPodAutoscalerScalingPolicy) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerActuation. +func (in *DatadogPodAutoscalerActuation) DeepCopy() *DatadogPodAutoscalerActuation { + if in == nil { + return nil + } + out := new(DatadogPodAutoscalerActuation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatadogPodAutoscalerCondition) DeepCopyInto(out *DatadogPodAutoscalerCondition) { + *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerCondition. +func (in *DatadogPodAutoscalerCondition) DeepCopy() *DatadogPodAutoscalerCondition { + if in == nil { + return nil + } + out := new(DatadogPodAutoscalerCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatadogPodAutoscalerConstraints) DeepCopyInto(out *DatadogPodAutoscalerConstraints) { + *out = *in + if in.MinReplicas != nil { + in, out := &in.MinReplicas, &out.MinReplicas + *out = new(int32) + **out = **in + } + if in.Containers != nil { + in, out := &in.Containers, &out.Containers + *out = make([]DatadogPodAutoscalerContainerConstraints, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerConstraints. +func (in *DatadogPodAutoscalerConstraints) DeepCopy() *DatadogPodAutoscalerConstraints { + if in == nil { + return nil + } + out := new(DatadogPodAutoscalerConstraints) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatadogPodAutoscalerContainerConstraints) DeepCopyInto(out *DatadogPodAutoscalerContainerConstraints) { + *out = *in + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } + if in.Requests != nil { + in, out := &in.Requests, &out.Requests + *out = new(DatadogPodAutoscalerContainerResourceConstraints) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerContainerConstraints. +func (in *DatadogPodAutoscalerContainerConstraints) DeepCopy() *DatadogPodAutoscalerContainerConstraints { + if in == nil { + return nil + } + out := new(DatadogPodAutoscalerContainerConstraints) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatadogPodAutoscalerContainerResourceConstraints) DeepCopyInto(out *DatadogPodAutoscalerContainerResourceConstraints) { + *out = *in + if in.MinAllowed != nil { + in, out := &in.MinAllowed, &out.MinAllowed + *out = make(corev1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + if in.MaxAllowed != nil { + in, out := &in.MaxAllowed, &out.MaxAllowed + *out = make(corev1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerContainerResourceConstraints. +func (in *DatadogPodAutoscalerContainerResourceConstraints) DeepCopy() *DatadogPodAutoscalerContainerResourceConstraints { + if in == nil { + return nil + } + out := new(DatadogPodAutoscalerContainerResourceConstraints) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatadogPodAutoscalerContainerResourceTarget) DeepCopyInto(out *DatadogPodAutoscalerContainerResourceTarget) { + *out = *in + in.Value.DeepCopyInto(&out.Value) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerContainerResourceTarget. +func (in *DatadogPodAutoscalerContainerResourceTarget) DeepCopy() *DatadogPodAutoscalerContainerResourceTarget { + if in == nil { + return nil + } + out := new(DatadogPodAutoscalerContainerResourceTarget) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatadogPodAutoscalerContainerResources) DeepCopyInto(out *DatadogPodAutoscalerContainerResources) { + *out = *in + if in.Limits != nil { + in, out := &in.Limits, &out.Limits + *out = make(corev1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + if in.Requests != nil { + in, out := &in.Requests, &out.Requests + *out = make(corev1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerContainerResources. +func (in *DatadogPodAutoscalerContainerResources) DeepCopy() *DatadogPodAutoscalerContainerResources { + if in == nil { + return nil + } + out := new(DatadogPodAutoscalerContainerResources) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatadogPodAutoscalerHorizontalAction) DeepCopyInto(out *DatadogPodAutoscalerHorizontalAction) { + *out = *in + in.Time.DeepCopyInto(&out.Time) + if in.RecommendedReplicas != nil { + in, out := &in.RecommendedReplicas, &out.RecommendedReplicas + *out = new(int32) + **out = **in + } + if in.LimitedReason != nil { + in, out := &in.LimitedReason, &out.LimitedReason + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerHorizontalAction. +func (in *DatadogPodAutoscalerHorizontalAction) DeepCopy() *DatadogPodAutoscalerHorizontalAction { + if in == nil { + return nil + } + out := new(DatadogPodAutoscalerHorizontalAction) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatadogPodAutoscalerHorizontalStatus) DeepCopyInto(out *DatadogPodAutoscalerHorizontalStatus) { + *out = *in + if in.Target != nil { + in, out := &in.Target, &out.Target + *out = new(DatadogPodAutoscalerHorizontalTargetStatus) + (*in).DeepCopyInto(*out) + } + if in.LastActions != nil { + in, out := &in.LastActions, &out.LastActions + *out = make([]DatadogPodAutoscalerHorizontalAction, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerHorizontalStatus. +func (in *DatadogPodAutoscalerHorizontalStatus) DeepCopy() *DatadogPodAutoscalerHorizontalStatus { + if in == nil { + return nil + } + out := new(DatadogPodAutoscalerHorizontalStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatadogPodAutoscalerHorizontalTargetStatus) DeepCopyInto(out *DatadogPodAutoscalerHorizontalTargetStatus) { + *out = *in + in.GeneratedAt.DeepCopyInto(&out.GeneratedAt) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerHorizontalTargetStatus. +func (in *DatadogPodAutoscalerHorizontalTargetStatus) DeepCopy() *DatadogPodAutoscalerHorizontalTargetStatus { + if in == nil { + return nil + } + out := new(DatadogPodAutoscalerHorizontalTargetStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DatadogPodAutoscalerList) DeepCopyInto(out *DatadogPodAutoscalerList) { *out = *in @@ -1348,9 +1589,113 @@ func (in *DatadogPodAutoscalerList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatadogPodAutoscalerObjective) DeepCopyInto(out *DatadogPodAutoscalerObjective) { + *out = *in + if in.PodResource != nil { + in, out := &in.PodResource, &out.PodResource + *out = new(DatadogPodAutoscalerResourceTarget) + (*in).DeepCopyInto(*out) + } + if in.ContainerResource != nil { + in, out := &in.ContainerResource, &out.ContainerResource + *out = new(DatadogPodAutoscalerContainerResourceTarget) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerObjective. +func (in *DatadogPodAutoscalerObjective) DeepCopy() *DatadogPodAutoscalerObjective { + if in == nil { + return nil + } + out := new(DatadogPodAutoscalerObjective) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatadogPodAutoscalerResourceTarget) DeepCopyInto(out *DatadogPodAutoscalerResourceTarget) { + *out = *in + in.Value.DeepCopyInto(&out.Value) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerResourceTarget. +func (in *DatadogPodAutoscalerResourceTarget) DeepCopy() *DatadogPodAutoscalerResourceTarget { + if in == nil { + return nil + } + out := new(DatadogPodAutoscalerResourceTarget) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatadogPodAutoscalerScalingPolicy) DeepCopyInto(out *DatadogPodAutoscalerScalingPolicy) { + *out = *in + if in.Strategy != nil { + in, out := &in.Strategy, &out.Strategy + *out = new(DatadogPodAutoscalerScalingStrategySelect) + **out = **in + } + if in.Rules != nil { + in, out := &in.Rules, &out.Rules + *out = make([]DatadogPodAutoscalerScalingRule, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerScalingPolicy. +func (in *DatadogPodAutoscalerScalingPolicy) DeepCopy() *DatadogPodAutoscalerScalingPolicy { + if in == nil { + return nil + } + out := new(DatadogPodAutoscalerScalingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatadogPodAutoscalerScalingRule) DeepCopyInto(out *DatadogPodAutoscalerScalingRule) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerScalingRule. +func (in *DatadogPodAutoscalerScalingRule) DeepCopy() *DatadogPodAutoscalerScalingRule { + if in == nil { + return nil + } + out := new(DatadogPodAutoscalerScalingRule) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DatadogPodAutoscalerSpec) DeepCopyInto(out *DatadogPodAutoscalerSpec) { *out = *in + out.TargetRef = in.TargetRef + if in.RemoteVersion != nil { + in, out := &in.RemoteVersion, &out.RemoteVersion + *out = new(uint64) + **out = **in + } + if in.Actuation != nil { + in, out := &in.Actuation, &out.Actuation + *out = new(DatadogPodAutoscalerActuation) + (*in).DeepCopyInto(*out) + } + if in.Objectives != nil { + in, out := &in.Objectives, &out.Objectives + *out = make([]DatadogPodAutoscalerObjective, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Constraints != nil { + in, out := &in.Constraints, &out.Constraints + *out = new(DatadogPodAutoscalerConstraints) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerSpec. @@ -1366,6 +1711,28 @@ func (in *DatadogPodAutoscalerSpec) DeepCopy() *DatadogPodAutoscalerSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DatadogPodAutoscalerStatus) DeepCopyInto(out *DatadogPodAutoscalerStatus) { *out = *in + if in.Vertical != nil { + in, out := &in.Vertical, &out.Vertical + *out = new(DatadogPodAutoscalerVerticalStatus) + (*in).DeepCopyInto(*out) + } + if in.Horizontal != nil { + in, out := &in.Horizontal, &out.Horizontal + *out = new(DatadogPodAutoscalerHorizontalStatus) + (*in).DeepCopyInto(*out) + } + if in.CurrentReplicas != nil { + in, out := &in.CurrentReplicas, &out.CurrentReplicas + *out = new(int32) + **out = **in + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]DatadogPodAutoscalerCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerStatus. @@ -1378,6 +1745,117 @@ func (in *DatadogPodAutoscalerStatus) DeepCopy() *DatadogPodAutoscalerStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatadogPodAutoscalerTargetValue) DeepCopyInto(out *DatadogPodAutoscalerTargetValue) { + *out = *in + if in.Absolute != nil { + in, out := &in.Absolute, &out.Absolute + x := (*in).DeepCopy() + *out = &x + } + if in.Utilization != nil { + in, out := &in.Utilization, &out.Utilization + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerTargetValue. +func (in *DatadogPodAutoscalerTargetValue) DeepCopy() *DatadogPodAutoscalerTargetValue { + if in == nil { + return nil + } + out := new(DatadogPodAutoscalerTargetValue) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatadogPodAutoscalerUpdatePolicy) DeepCopyInto(out *DatadogPodAutoscalerUpdatePolicy) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerUpdatePolicy. +func (in *DatadogPodAutoscalerUpdatePolicy) DeepCopy() *DatadogPodAutoscalerUpdatePolicy { + if in == nil { + return nil + } + out := new(DatadogPodAutoscalerUpdatePolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatadogPodAutoscalerVerticalAction) DeepCopyInto(out *DatadogPodAutoscalerVerticalAction) { + *out = *in + in.Time.DeepCopyInto(&out.Time) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerVerticalAction. +func (in *DatadogPodAutoscalerVerticalAction) DeepCopy() *DatadogPodAutoscalerVerticalAction { + if in == nil { + return nil + } + out := new(DatadogPodAutoscalerVerticalAction) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatadogPodAutoscalerVerticalStatus) DeepCopyInto(out *DatadogPodAutoscalerVerticalStatus) { + *out = *in + if in.Target != nil { + in, out := &in.Target, &out.Target + *out = new(DatadogPodAutoscalerVerticalTargetStatus) + (*in).DeepCopyInto(*out) + } + if in.LastAction != nil { + in, out := &in.LastAction, &out.LastAction + *out = new(DatadogPodAutoscalerVerticalAction) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerVerticalStatus. +func (in *DatadogPodAutoscalerVerticalStatus) DeepCopy() *DatadogPodAutoscalerVerticalStatus { + if in == nil { + return nil + } + out := new(DatadogPodAutoscalerVerticalStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatadogPodAutoscalerVerticalTargetStatus) DeepCopyInto(out *DatadogPodAutoscalerVerticalTargetStatus) { + *out = *in + in.GeneratedAt.DeepCopyInto(&out.GeneratedAt) + if in.Scaled != nil { + in, out := &in.Scaled, &out.Scaled + *out = new(int32) + **out = **in + } + if in.DesiredResources != nil { + in, out := &in.DesiredResources, &out.DesiredResources + *out = make([]DatadogPodAutoscalerContainerResources, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + out.PODCPURequest = in.PODCPURequest.DeepCopy() + out.PODMemoryRequest = in.PODMemoryRequest.DeepCopy() +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatadogPodAutoscalerVerticalTargetStatus. +func (in *DatadogPodAutoscalerVerticalTargetStatus) DeepCopy() *DatadogPodAutoscalerVerticalTargetStatus { + if in == nil { + return nil + } + out := new(DatadogPodAutoscalerVerticalTargetStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DeploymentStatus) DeepCopyInto(out *DeploymentStatus) { *out = *in diff --git a/api/datadoghq/v2alpha1/zz_generated.openapi.go b/api/datadoghq/v2alpha1/zz_generated.openapi.go index 9dfdc495f..8257f2b78 100644 --- a/api/datadoghq/v2alpha1/zz_generated.openapi.go +++ b/api/datadoghq/v2alpha1/zz_generated.openapi.go @@ -1130,7 +1130,7 @@ func schema_datadog_operator_api_datadoghq_v2alpha1_NetworkPolicyConfig(ref comm return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "NetworkPolicyConfig provides Network Policy configuration for the agents.", + Description: "NetworkPolicyConfig provides Network Actuation configuration for the agents.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "create": { diff --git a/config/crd/bases/v1/datadoghq.com_datadogpodautoscalers.yaml b/config/crd/bases/v1/datadoghq.com_datadogpodautoscalers.yaml index 7cc05c9e8..c5d8a6ec9 100644 --- a/config/crd/bases/v1/datadoghq.com_datadogpodautoscalers.yaml +++ b/config/crd/bases/v1/datadoghq.com_datadogpodautoscalers.yaml @@ -617,7 +617,44 @@ spec: storage: true subresources: status: {} - - name: v2alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.policy.applyMode + name: Apply Mode + type: string + - jsonPath: .status.conditions[?(@.type=='Active')].status + name: Active + type: string + - jsonPath: .status.conditions[?(@.type=='Error')].status + name: In Error + type: string + - jsonPath: .status.horizontal.target.desiredReplicas + name: Desired Replicas + type: integer + - jsonPath: .status.horizontal.target.generatedAt + name: Generated + type: date + - jsonPath: .status.conditions[?(@.type=='HorizontalAbleToScale')].status + name: Able to Scale + type: string + - jsonPath: .status.horizontal.lastAction.time + name: Last Scale + type: date + - jsonPath: .status.vertical.target.podCPURequest + name: Target CPU Req + type: string + - jsonPath: .status.vertical.target.podMemoryRequest + name: Target Memory Req + type: string + - jsonPath: .status.vertical.target.generatedAt + name: Generated + type: date + - jsonPath: .status.conditions[?(@.type=='VerticalAbleToApply')].status + name: Able to Apply + type: string + - jsonPath: .status.vertical.lastAction.time + name: Last Trigger + type: date + name: v2alpha1 schema: openAPIV3Schema: description: DatadogPodAutoscaler is the Schema for the datadogpodautoscalers API @@ -642,12 +679,501 @@ spec: spec: description: DatadogPodAutoscalerSpec defines the desired state of DatadogPodAutoscaler properties: - foo: - description: Foo is an example field of DatadogPodAutoscaler. Edit datadogpodautoscaler_types.go to remove/update - type: string - type: object - status: - description: DatadogPodAutoscalerStatus defines the observed state of DatadogPodAutoscaler + actuation: + default: {} + description: Actuation defines how recommendations should be applied. + properties: + applyMode: + default: All + description: |- + Mode determines recommendations that should be applied by the controller: + - All: Apply all recommendations (regular and manual). + - Manual: Apply only manual recommendations (recommendations manually validated by user in the Datadog app). + - None: Prevent the controller to apply any recommendations. + It's also possible to selectively deactivate upscale, downscale or update actions thanks to the `Upscale`, `Downscale` and `Update` fields. + enum: + - All + - Manual + - None + type: string + downscale: + description: Downscale defines the policy to scale down the target resource. + properties: + rules: + description: |- + Rules is a list of potential scaling polices which can be used during scaling. + At least one policy must be specified, otherwise the DatadogPodAutoscalerScalingPolicy will be discarded as invalid + items: + description: DatadogPodAutoscalerScalingRule define rules for horizontal that should be true for a certain amount of time. + properties: + periodSeconds: + description: |- + PeriodSeconds specifies the window of time for which the policy should hold true. + PeriodSeconds must be greater than zero and less than or equal to 1800 (30 min). + format: int32 + maximum: 1800 + minimum: 1 + type: integer + type: + description: Type is used to specify the scaling policy. + enum: + - Pods + - Percent + type: string + value: + description: |- + Value contains the amount of change which is permitted by the policy. + Setting it to 0 will prevent any scaling in this direction and should not be used unless Match is set to IfScalingEvent. + format: int32 + minimum: 0 + type: integer + required: + - periodSeconds + - type + - value + type: object + type: array + x-kubernetes-list-type: atomic + stabilizationWindowSeconds: + description: |- + StabilizationWindowSeconds is the number of seconds the controller should lookback at previous recommendations + before deciding to apply a new one. Defaults to 0. + format: int32 + maximum: 1800 + minimum: 0 + type: integer + strategy: + description: |- + Strategy is used to specify which policy should be used. + If not set, the default value Max is used. + enum: + - Max + - Min + - Disabled + type: string + type: object + update: + description: Update defines the policy to update target resource. + properties: + strategy: + description: Mode defines the mode of the update policy. + enum: + - Auto + - Disabled + type: string + type: object + upscale: + description: Upscale defines the policy to scale up the target resource. + properties: + rules: + description: |- + Rules is a list of potential scaling polices which can be used during scaling. + At least one policy must be specified, otherwise the DatadogPodAutoscalerScalingPolicy will be discarded as invalid + items: + description: DatadogPodAutoscalerScalingRule define rules for horizontal that should be true for a certain amount of time. + properties: + periodSeconds: + description: |- + PeriodSeconds specifies the window of time for which the policy should hold true. + PeriodSeconds must be greater than zero and less than or equal to 1800 (30 min). + format: int32 + maximum: 1800 + minimum: 1 + type: integer + type: + description: Type is used to specify the scaling policy. + enum: + - Pods + - Percent + type: string + value: + description: |- + Value contains the amount of change which is permitted by the policy. + Setting it to 0 will prevent any scaling in this direction and should not be used unless Match is set to IfScalingEvent. + format: int32 + minimum: 0 + type: integer + required: + - periodSeconds + - type + - value + type: object + type: array + x-kubernetes-list-type: atomic + stabilizationWindowSeconds: + description: |- + StabilizationWindowSeconds is the number of seconds the controller should lookback at previous recommendations + before deciding to apply a new one. Defaults to 0. + format: int32 + maximum: 1800 + minimum: 0 + type: integer + strategy: + description: |- + Strategy is used to specify which policy should be used. + If not set, the default value Max is used. + enum: + - Max + - Min + - Disabled + type: string + type: object + type: object + constraints: + description: Constraints defines constraints that should always be respected. + properties: + containers: + description: Containers defines constraints for the containers. + items: + description: |- + DatadogPodAutoscalerContainerConstraints defines constraints that should always be respected for a container. + If no constraints are set, it enables resources scaling for all containers without any constraints. + properties: + enabled: + description: Enabled false allows to disable resources autoscaling for the container. Default to true. + type: boolean + name: + description: Name is the name of the container. Can be "*" to apply to all containers. + type: string + requests: + description: Requests defines the constraints for the requests of the container. + properties: + maxAllowed: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: MaxAllowed is the upper limit for the requests of the container. + type: object + minAllowed: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: MinAllowed is the lower limit for the requests of the container. + type: object + type: object + required: + - name + type: object + type: array + maxReplicas: + description: MaxReplicas is the upper limit for the number of POD replicas. Needs to be >= minReplicas. + format: int32 + type: integer + minReplicas: + description: MinReplicas is the lower limit for the number of POD replicas. Needs to be >= 1. Default to 1. + format: int32 + minimum: 1 + type: integer + required: + - maxReplicas + type: object + objectives: + description: |- + Objectives are objectives to reach and maintain for the target resource. + Default to a single target to maintain 80% POD CPU utilization. + items: + description: DatadogPodAutoscalerObjective defines the objectives to reach and maintain for the target resource. + properties: + containerResource: + description: ContainerResource allows to set a container-level resource target. + properties: + container: + description: Container is the name of the container. + type: string + name: + description: Name is the name of the resource. + enum: + - cpu + type: string + value: + description: Value is the value of the target. + properties: + absolute: + anyOf: + - type: integer + - type: string + description: Absolute defines the absolute value of the target (for instance 500 millicores). + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: + description: Type specifies how the value is expressed (Absolute or Utilization). + type: string + utilization: + description: Utilization defines a percentage of the target compared to requested resource + format: int32 + maximum: 100 + minimum: 0 + type: integer + required: + - type + type: object + required: + - container + - name + - value + type: object + podResource: + description: PodResource allows to set a POD-level resource target. + properties: + name: + description: Name is the name of the resource. + enum: + - cpu + type: string + value: + description: Value is the value of the target. + properties: + absolute: + anyOf: + - type: integer + - type: string + description: Absolute defines the absolute value of the target (for instance 500 millicores). + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: + description: Type specifies how the value is expressed (Absolute or Utilization). + type: string + utilization: + description: Utilization defines a percentage of the target compared to requested resource + format: int32 + maximum: 100 + minimum: 0 + type: integer + required: + - type + type: object + required: + - name + - value + type: object + type: + description: Type sets the type of the target. + enum: + - PodResource + - ContainerResource + type: string + required: + - type + type: object + type: array + x-kubernetes-list-type: atomic + owner: + description: |- + Owner defines the source of truth for this object (local or remote) + Value needs to be set when a DatadogPodAutoscaler object is created. + enum: + - Local + - Remote + type: string + remoteVersion: + description: |- + RemoteVersion is the version of the .Spec currently store in this object. + Only set if the owner is Remote. + format: int64 + type: integer + targetRef: + description: TargetRef is the reference to the resource to scale. + properties: + apiVersion: + description: apiVersion is the API version of the referent + type: string + kind: + description: 'kind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'name is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + required: + - kind + - name + type: object + required: + - owner + - targetRef + type: object + status: + description: DatadogPodAutoscalerStatus defines the observed state of DatadogPodAutoscaler + properties: + conditions: + description: Conditions describe the current state of the DatadogPodAutoscaler operations. + items: + description: DatadogPodAutoscalerCondition describes the state of DatadogPodAutoscaler. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status to another. + format: date-time + type: string + message: + description: A human readable message indicating details about the transition. + type: string + reason: + description: The reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of DatadogMetric condition. + type: string + required: + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + currentReplicas: + description: CurrentReplicas is the current number of PODs for the targetRef observed by the controller. + format: int32 + type: integer + horizontal: + description: Horizontal is the status of the horizontal scaling, if activated. + properties: + lastActions: + description: LastActions are the last successful actions done by the controller + items: + description: DatadogPodAutoscalerHorizontalAction represents an horizontal action done by the controller + properties: + limitedReason: + description: LimitedReason is the reason why the action was limited (ToReplicas != RecommendedReplicas) + type: string + recommendedReplicas: + description: RecommendedReplicas is the original number of replicas recommended by Datadog + format: int32 + type: integer + replicas: + description: FromReplicas is the number of replicas before the action + format: int32 + type: integer + time: + description: Time is the timestamp of the action + format: date-time + type: string + toReplicas: + description: ToReplicas is the effective number of replicas after the action + format: int32 + type: integer + required: + - replicas + - time + - toReplicas + type: object + type: array + target: + description: Target is the current target of the horizontal scaling + properties: + desiredReplicas: + description: Replicas is the desired number of replicas for the resource + format: int32 + type: integer + generatedAt: + description: GeneratedAt is the timestamp at which the recommendation was generated + format: date-time + type: string + source: + description: Source is the source of the value used to scale the target resource + type: string + required: + - desiredReplicas + - source + type: object + type: object + vertical: + description: Vertical is the status of the vertical scaling, if activated. + properties: + lastAction: + description: LastAction is the last successful action done by the controller + properties: + time: + description: Time is the timestamp of the action + format: date-time + type: string + type: + description: Type is the type of action + type: string + version: + description: Version is the recommendation version used for the action + type: string + required: + - time + - type + - version + type: object + target: + description: Target is the current target of the vertical scaling + properties: + desiredResources: + description: DesiredResources is the desired resources for containers + items: + properties: + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: Limits describes the maximum amount of compute resources allowed. + type: object + name: + description: Name is the name of the container + type: string + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: Requests describes target resources of compute resources allowed. + type: object + required: + - name + type: object + type: array + generatedAt: + description: GeneratedAt is the timestamp at which the recommendation was generated + format: date-time + type: string + podCPURequest: + anyOf: + - type: integer + - type: string + description: PODCPURequest is the sum of CPU requests for all containers (used for display) + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + podMemoryRequest: + anyOf: + - type: integer + - type: string + description: PODMemoryRequest is the sum of memory requests for all containers (used for display) + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + scaled: + description: Scaled is the current number of PODs having desired resources + format: int32 + type: integer + source: + description: Source is the source of the value used to scale the target resource + type: string + version: + description: Version is the current version of the received recommendation + type: string + required: + - desiredResources + - podCPURequest + - podMemoryRequest + - source + - version + type: object + type: object type: object type: object served: true diff --git a/config/crd/bases/v1/datadoghq.com_datadogpodautoscalers_v2alpha1.json b/config/crd/bases/v1/datadoghq.com_datadogpodautoscalers_v2alpha1.json index c0c2fe66c..266a5c809 100644 --- a/config/crd/bases/v1/datadoghq.com_datadogpodautoscalers_v2alpha1.json +++ b/config/crd/bases/v1/datadoghq.com_datadogpodautoscalers_v2alpha1.json @@ -17,15 +17,731 @@ "additionalProperties": false, "description": "DatadogPodAutoscalerSpec defines the desired state of DatadogPodAutoscaler", "properties": { - "foo": { - "description": "Foo is an example field of DatadogPodAutoscaler. Edit datadogpodautoscaler_types.go to remove/update", + "actuation": { + "additionalProperties": false, + "default": {}, + "description": "Actuation defines how recommendations should be applied.", + "properties": { + "applyMode": { + "default": "All", + "description": "Mode determines recommendations that should be applied by the controller:\n- All: Apply all recommendations (regular and manual).\n- Manual: Apply only manual recommendations (recommendations manually validated by user in the Datadog app).\n- None: Prevent the controller to apply any recommendations.\nIt's also possible to selectively deactivate upscale, downscale or update actions thanks to the `Upscale`, `Downscale` and `Update` fields.", + "enum": [ + "All", + "Manual", + "None" + ], + "type": "string" + }, + "downscale": { + "additionalProperties": false, + "description": "Downscale defines the policy to scale down the target resource.", + "properties": { + "rules": { + "description": "Rules is a list of potential scaling polices which can be used during scaling.\nAt least one policy must be specified, otherwise the DatadogPodAutoscalerScalingPolicy will be discarded as invalid", + "items": { + "additionalProperties": false, + "description": "DatadogPodAutoscalerScalingRule define rules for horizontal that should be true for a certain amount of time.", + "properties": { + "periodSeconds": { + "description": "PeriodSeconds specifies the window of time for which the policy should hold true.\nPeriodSeconds must be greater than zero and less than or equal to 1800 (30 min).", + "format": "int32", + "maximum": 1800, + "minimum": 1, + "type": "integer" + }, + "type": { + "description": "Type is used to specify the scaling policy.", + "enum": [ + "Pods", + "Percent" + ], + "type": "string" + }, + "value": { + "description": "Value contains the amount of change which is permitted by the policy.\nSetting it to 0 will prevent any scaling in this direction and should not be used unless Match is set to IfScalingEvent.", + "format": "int32", + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "periodSeconds", + "type", + "value" + ], + "type": "object" + }, + "type": "array", + "x-kubernetes-list-type": "atomic" + }, + "stabilizationWindowSeconds": { + "description": "StabilizationWindowSeconds is the number of seconds the controller should lookback at previous recommendations\nbefore deciding to apply a new one. Defaults to 0.", + "format": "int32", + "maximum": 1800, + "minimum": 0, + "type": "integer" + }, + "strategy": { + "description": "Strategy is used to specify which policy should be used.\nIf not set, the default value Max is used.", + "enum": [ + "Max", + "Min", + "Disabled" + ], + "type": "string" + } + }, + "type": "object" + }, + "update": { + "additionalProperties": false, + "description": "Update defines the policy to update target resource.", + "properties": { + "strategy": { + "description": "Mode defines the mode of the update policy.", + "enum": [ + "Auto", + "Disabled" + ], + "type": "string" + } + }, + "type": "object" + }, + "upscale": { + "additionalProperties": false, + "description": "Upscale defines the policy to scale up the target resource.", + "properties": { + "rules": { + "description": "Rules is a list of potential scaling polices which can be used during scaling.\nAt least one policy must be specified, otherwise the DatadogPodAutoscalerScalingPolicy will be discarded as invalid", + "items": { + "additionalProperties": false, + "description": "DatadogPodAutoscalerScalingRule define rules for horizontal that should be true for a certain amount of time.", + "properties": { + "periodSeconds": { + "description": "PeriodSeconds specifies the window of time for which the policy should hold true.\nPeriodSeconds must be greater than zero and less than or equal to 1800 (30 min).", + "format": "int32", + "maximum": 1800, + "minimum": 1, + "type": "integer" + }, + "type": { + "description": "Type is used to specify the scaling policy.", + "enum": [ + "Pods", + "Percent" + ], + "type": "string" + }, + "value": { + "description": "Value contains the amount of change which is permitted by the policy.\nSetting it to 0 will prevent any scaling in this direction and should not be used unless Match is set to IfScalingEvent.", + "format": "int32", + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "periodSeconds", + "type", + "value" + ], + "type": "object" + }, + "type": "array", + "x-kubernetes-list-type": "atomic" + }, + "stabilizationWindowSeconds": { + "description": "StabilizationWindowSeconds is the number of seconds the controller should lookback at previous recommendations\nbefore deciding to apply a new one. Defaults to 0.", + "format": "int32", + "maximum": 1800, + "minimum": 0, + "type": "integer" + }, + "strategy": { + "description": "Strategy is used to specify which policy should be used.\nIf not set, the default value Max is used.", + "enum": [ + "Max", + "Min", + "Disabled" + ], + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "constraints": { + "additionalProperties": false, + "description": "Constraints defines constraints that should always be respected.", + "properties": { + "containers": { + "description": "Containers defines constraints for the containers.", + "items": { + "additionalProperties": false, + "description": "DatadogPodAutoscalerContainerConstraints defines constraints that should always be respected for a container.\nIf no constraints are set, it enables resources scaling for all containers without any constraints.", + "properties": { + "enabled": { + "description": "Enabled false allows to disable resources autoscaling for the container. Default to true.", + "type": "boolean" + }, + "name": { + "description": "Name is the name of the container. Can be \"*\" to apply to all containers.", + "type": "string" + }, + "requests": { + "additionalProperties": false, + "description": "Requests defines the constraints for the requests of the container.", + "properties": { + "maxAllowed": { + "additionalProperties": false, + "description": "MaxAllowed is the upper limit for the requests of the container.", + "properties": { + "cpu": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ], + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$" + }, + "memory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ], + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$" + } + }, + "type": "object" + }, + "minAllowed": { + "additionalProperties": false, + "description": "MinAllowed is the lower limit for the requests of the container.", + "properties": { + "cpu": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ], + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$" + }, + "memory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ], + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "required": [ + "name" + ], + "type": "object" + }, + "type": "array" + }, + "maxReplicas": { + "description": "MaxReplicas is the upper limit for the number of POD replicas. Needs to be \u003e= minReplicas.", + "format": "int32", + "type": "integer" + }, + "minReplicas": { + "description": "MinReplicas is the lower limit for the number of POD replicas. Needs to be \u003e= 1. Default to 1.", + "format": "int32", + "minimum": 1, + "type": "integer" + } + }, + "required": [ + "maxReplicas" + ], + "type": "object" + }, + "objectives": { + "description": "Objectives are objectives to reach and maintain for the target resource.\nDefault to a single target to maintain 80% POD CPU utilization.", + "items": { + "additionalProperties": false, + "description": "DatadogPodAutoscalerObjective defines the objectives to reach and maintain for the target resource.", + "properties": { + "containerResource": { + "additionalProperties": false, + "description": "ContainerResource allows to set a container-level resource target.", + "properties": { + "container": { + "description": "Container is the name of the container.", + "type": "string" + }, + "name": { + "description": "Name is the name of the resource.", + "enum": [ + "cpu" + ], + "type": "string" + }, + "value": { + "additionalProperties": false, + "description": "Value is the value of the target.", + "properties": { + "absolute": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "description": "Absolute defines the absolute value of the target (for instance 500 millicores).", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + }, + "type": { + "description": "Type specifies how the value is expressed (Absolute or Utilization).", + "type": "string" + }, + "utilization": { + "description": "Utilization defines a percentage of the target compared to requested resource", + "format": "int32", + "maximum": 100, + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "type" + ], + "type": "object" + } + }, + "required": [ + "container", + "name", + "value" + ], + "type": "object" + }, + "podResource": { + "additionalProperties": false, + "description": "PodResource allows to set a POD-level resource target.", + "properties": { + "name": { + "description": "Name is the name of the resource.", + "enum": [ + "cpu" + ], + "type": "string" + }, + "value": { + "additionalProperties": false, + "description": "Value is the value of the target.", + "properties": { + "absolute": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "description": "Absolute defines the absolute value of the target (for instance 500 millicores).", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + }, + "type": { + "description": "Type specifies how the value is expressed (Absolute or Utilization).", + "type": "string" + }, + "utilization": { + "description": "Utilization defines a percentage of the target compared to requested resource", + "format": "int32", + "maximum": 100, + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "type" + ], + "type": "object" + } + }, + "required": [ + "name", + "value" + ], + "type": "object" + }, + "type": { + "description": "Type sets the type of the target.", + "enum": [ + "PodResource", + "ContainerResource" + ], + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + }, + "type": "array", + "x-kubernetes-list-type": "atomic" + }, + "owner": { + "description": "Owner defines the source of truth for this object (local or remote)\nValue needs to be set when a DatadogPodAutoscaler object is created.", + "enum": [ + "Local", + "Remote" + ], "type": "string" + }, + "remoteVersion": { + "description": "RemoteVersion is the version of the .Spec currently store in this object.\nOnly set if the owner is Remote.", + "format": "int64", + "type": "integer" + }, + "targetRef": { + "additionalProperties": false, + "description": "TargetRef is the reference to the resource to scale.", + "properties": { + "apiVersion": { + "description": "apiVersion is the API version of the referent", + "type": "string" + }, + "kind": { + "description": "kind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "name": { + "description": "name is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "type": "string" + } + }, + "required": [ + "kind", + "name" + ], + "type": "object" } }, + "required": [ + "owner", + "targetRef" + ], "type": "object" }, "status": { + "additionalProperties": false, "description": "DatadogPodAutoscalerStatus defines the observed state of DatadogPodAutoscaler", + "properties": { + "conditions": { + "description": "Conditions describe the current state of the DatadogPodAutoscaler operations.", + "items": { + "additionalProperties": false, + "description": "DatadogPodAutoscalerCondition describes the state of DatadogPodAutoscaler.", + "properties": { + "lastTransitionTime": { + "description": "Last time the condition transitioned from one status to another.", + "format": "date-time", + "type": "string" + }, + "message": { + "description": "A human readable message indicating details about the transition.", + "type": "string" + }, + "reason": { + "description": "The reason for the condition's last transition.", + "type": "string" + }, + "status": { + "description": "Status of the condition, one of True, False, Unknown.", + "type": "string" + }, + "type": { + "description": "Type of DatadogMetric condition.", + "type": "string" + } + }, + "required": [ + "status", + "type" + ], + "type": "object" + }, + "type": "array", + "x-kubernetes-list-map-keys": [ + "type" + ], + "x-kubernetes-list-type": "map" + }, + "currentReplicas": { + "description": "CurrentReplicas is the current number of PODs for the targetRef observed by the controller.", + "format": "int32", + "type": "integer" + }, + "horizontal": { + "additionalProperties": false, + "description": "Horizontal is the status of the horizontal scaling, if activated.", + "properties": { + "lastActions": { + "description": "LastActions are the last successful actions done by the controller", + "items": { + "additionalProperties": false, + "description": "DatadogPodAutoscalerHorizontalAction represents an horizontal action done by the controller", + "properties": { + "limitedReason": { + "description": "LimitedReason is the reason why the action was limited (ToReplicas != RecommendedReplicas)", + "type": "string" + }, + "recommendedReplicas": { + "description": "RecommendedReplicas is the original number of replicas recommended by Datadog", + "format": "int32", + "type": "integer" + }, + "replicas": { + "description": "FromReplicas is the number of replicas before the action", + "format": "int32", + "type": "integer" + }, + "time": { + "description": "Time is the timestamp of the action", + "format": "date-time", + "type": "string" + }, + "toReplicas": { + "description": "ToReplicas is the effective number of replicas after the action", + "format": "int32", + "type": "integer" + } + }, + "required": [ + "replicas", + "time", + "toReplicas" + ], + "type": "object" + }, + "type": "array" + }, + "target": { + "additionalProperties": false, + "description": "Target is the current target of the horizontal scaling", + "properties": { + "desiredReplicas": { + "description": "Replicas is the desired number of replicas for the resource", + "format": "int32", + "type": "integer" + }, + "generatedAt": { + "description": "GeneratedAt is the timestamp at which the recommendation was generated", + "format": "date-time", + "type": "string" + }, + "source": { + "description": "Source is the source of the value used to scale the target resource", + "type": "string" + } + }, + "required": [ + "desiredReplicas", + "source" + ], + "type": "object" + } + }, + "type": "object" + }, + "vertical": { + "additionalProperties": false, + "description": "Vertical is the status of the vertical scaling, if activated.", + "properties": { + "lastAction": { + "additionalProperties": false, + "description": "LastAction is the last successful action done by the controller", + "properties": { + "time": { + "description": "Time is the timestamp of the action", + "format": "date-time", + "type": "string" + }, + "type": { + "description": "Type is the type of action", + "type": "string" + }, + "version": { + "description": "Version is the recommendation version used for the action", + "type": "string" + } + }, + "required": [ + "time", + "type", + "version" + ], + "type": "object" + }, + "target": { + "additionalProperties": false, + "description": "Target is the current target of the vertical scaling", + "properties": { + "desiredResources": { + "description": "DesiredResources is the desired resources for containers", + "items": { + "additionalProperties": false, + "properties": { + "limits": { + "additionalProperties": false, + "description": "Limits describes the maximum amount of compute resources allowed.", + "properties": { + "cpu": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ], + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$" + }, + "memory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ], + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$" + } + }, + "type": "object" + }, + "name": { + "description": "Name is the name of the container", + "type": "string" + }, + "requests": { + "additionalProperties": false, + "description": "Requests describes target resources of compute resources allowed.", + "properties": { + "cpu": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ], + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$" + }, + "memory": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ], + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$" + } + }, + "type": "object" + } + }, + "required": [ + "name" + ], + "type": "object" + }, + "type": "array" + }, + "generatedAt": { + "description": "GeneratedAt is the timestamp at which the recommendation was generated", + "format": "date-time", + "type": "string" + }, + "podCPURequest": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "description": "PODCPURequest is the sum of CPU requests for all containers (used for display)", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + }, + "podMemoryRequest": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ], + "description": "PODMemoryRequest is the sum of memory requests for all containers (used for display)", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + }, + "scaled": { + "description": "Scaled is the current number of PODs having desired resources", + "format": "int32", + "type": "integer" + }, + "source": { + "description": "Source is the source of the value used to scale the target resource", + "type": "string" + }, + "version": { + "description": "Version is the current version of the received recommendation", + "type": "string" + } + }, + "required": [ + "desiredResources", + "podCPURequest", + "podMemoryRequest", + "source", + "version" + ], + "type": "object" + } + }, + "type": "object" + } + }, "type": "object" } }, diff --git a/test/e2e/go.mod b/test/e2e/go.mod index 1d07a4e72..46a0a2d91 100644 --- a/test/e2e/go.mod +++ b/test/e2e/go.mod @@ -1,8 +1,8 @@ module github.com/DataDog/datadog-operator/e2e -go 1.22 +go 1.22.0 -toolchain go1.22.7 +toolchain go1.23.4 require ( github.com/DataDog/datadog-agent/test/new-e2e v0.55.2