@@ -23,6 +23,7 @@ import (
23
23
routev1 "github.com/openshift/api/route/v1"
24
24
prometheusv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
25
25
appsv1 "k8s.io/api/apps/v1"
26
+ autoscalingv2 "k8s.io/api/autoscaling/v2"
26
27
corev1 "k8s.io/api/core/v1"
27
28
networkingv1 "k8s.io/api/networking/v1"
28
29
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -225,6 +226,16 @@ type RuntimeComponentAutoScaling struct {
225
226
// Target average CPU utilization, represented as a percentage of requested CPU, over all the pods.
226
227
// +operator-sdk:csv:customresourcedefinitions:order=3,type=spec,displayName="Target CPU Utilization Percentage",xDescriptors="urn:alm:descriptor:com.tectonic.ui:number"
227
228
TargetCPUUtilizationPercentage * int32 `json:"targetCPUUtilizationPercentage,omitempty"`
229
+
230
+ // Target average Memory utilization, represented as a percentage of requested memory, over all the pods.
231
+ // +operator-sdk:csv:customresourcedefinitions:order=4,type=spec,displayName="Target Memory Utilization Percentage",xDescriptors="urn:alm:descriptor:com.tectonic.ui:number"
232
+ TargetMemoryUtilizationPercentage * int32 `json:"targetMemoryUtilizationPercentage,omitempty"`
233
+
234
+ // Specifications used for replica count calculation
235
+ Metrics []autoscalingv2.MetricSpec `json:"metrics,omitempty"`
236
+
237
+ // Scaling behavior of the target. If not set, the default HPAScalingRules for scale up and scale down are used.
238
+ Behavior * autoscalingv2.HorizontalPodAutoscalerBehavior `json:"behavior,omitempty"`
228
239
}
229
240
230
241
// Configures parameters for the network service of pods.
@@ -762,6 +773,21 @@ func (a *RuntimeComponentAutoScaling) GetTargetCPUUtilizationPercentage() *int32
762
773
return a .TargetCPUUtilizationPercentage
763
774
}
764
775
776
+ // GetTargetMemoryUtilizationPercentage returns target memory usage
777
+ func (a * RuntimeComponentAutoScaling ) GetTargetMemoryUtilizationPercentage () * int32 {
778
+ return a .TargetMemoryUtilizationPercentage
779
+ }
780
+
781
+ // GetMetrics returns metrics for resource utilization
782
+ func (a * RuntimeComponentAutoScaling ) GetMetrics () []autoscalingv2.MetricSpec {
783
+ return a .Metrics
784
+ }
785
+
786
+ // GetHorizontalPodAutoscalerBehavior returns behavior configures the scaling behavior of the target
787
+ func (a * RuntimeComponentAutoScaling ) GetHorizontalPodAutoscalerBehavior () * autoscalingv2.HorizontalPodAutoscalerBehavior {
788
+ return a .Behavior
789
+ }
790
+
765
791
// GetSize returns persistent volume size
766
792
func (s * RuntimeComponentStorage ) GetSize () string {
767
793
return s .Size
0 commit comments