Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some typo in evpa and remove useless variable #553

Merged
merged 1 commit into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pkg/controller/evpa/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ const (
DefaultComponentScaleDownStabWindowSeconds = int32(43200)
DefaultComponentScaleUpStabWindowSeconds = int32(150)

// DefaultScaleDownCPUUtilPercentageThreshold defines the cpu scaledown threshold,,
// DefaultScaleDownCPUUtilPercentageThreshold defines the cpu scaledown threshold,
// If the ratio of actual used cpu resources divided by request resources is less than DefaultScaleDownCPUUtilPercentageThreshold,
// it will trigger cpu scaledown.
DefaultScaleDownCPUUtilPercentageThreshold = int32(35)
// DefaultScaleUpCPUUtilPercentageThreshold defines the cpu scaleup threshold,,
// DefaultScaleUpCPUUtilPercentageThreshold defines the cpu scaleup threshold,
// If the ratio of actual used cpu resources divided by limit resources is greater than DefaultScaleUpCPUUtilPercentageThreshold,
// it will trigger cpu scaleup.
DefaultScaleUpCPUUtilPercentageThreshold = int32(95)
// DefaultScaleDownMemoryUtilPercentageThreshold defines the memory scaledown threshold,,
// DefaultScaleDownMemoryUtilPercentageThreshold defines the memory scaledown threshold,
// If the ratio of actual used memory resources divided by request resources is less than DefaultScaleDownMemoryUtilPercentageThreshold,
// it will trigger memory scaledown.
DefaultScaleDownMemoryUtilPercentageThreshold = int32(40)
// DefaultScaleUpMemoryUtilPercentageThreshold defines the memory scaleup threshold,,
// DefaultScaleUpMemoryUtilPercentageThreshold defines the memory scaleup threshold,
// If the ratio of actual used cpu resources divided by limit resources is greater than DefaultScaleUpCPUUtilPercentageThreshold,
// it will trigger memory scaleup.
DefaultScaleUpMemoryUtilPercentageThreshold = int32(95)
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/evpa/effective_vpa_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ func defaultingEVPA(evpa *autoscalingapi.EffectiveVerticalPodAutoscaler) error {
}

// scale down
defaultScaleDownpMode := vpatypes.ContainerScalingModeAuto
defaultScaleDownMode := vpatypes.ContainerScalingModeAuto
defaultComponentScaleDownStabWindowSeconds := DefaultComponentScaleDownStabWindowSeconds
defaultScaleDownCPUUtilPercentageThreshold := DefaultScaleDownCPUUtilPercentageThreshold
defaultScaleDownMemoryUtilPercentageThreshold := DefaultScaleDownMemoryUtilPercentageThreshold
Expand All @@ -333,15 +333,15 @@ func defaultingEVPA(evpa *autoscalingapi.EffectiveVerticalPodAutoscaler) error {
},
}
defaultScaleDownPolicy := autoscalingapi.ContainerScalingPolicy{
ScaleMode: &defaultScaleDownpMode,
ScaleMode: &defaultScaleDownMode,
StabilizationWindowSeconds: &defaultComponentScaleDownStabWindowSeconds,
MetricThresholds: defaultScaleDownThresholds,
}
if containerPolicy.ScaleDownPolicy == nil {
containerPolicy.ScaleDownPolicy = &defaultScaleDownPolicy
} else {
if containerPolicy.ScaleDownPolicy.ScaleMode == nil {
containerPolicy.ScaleDownPolicy.ScaleMode = &defaultScaleUpMode
containerPolicy.ScaleDownPolicy.ScaleMode = &defaultScaleDownMode
}
if containerPolicy.ScaleDownPolicy.StabilizationWindowSeconds == nil {
containerPolicy.ScaleDownPolicy.StabilizationWindowSeconds = &defaultComponentScaleDownStabWindowSeconds
Expand Down
3 changes: 1 addition & 2 deletions pkg/recommendation/recommender/base/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ func (br *BaseRecommender) Filter(ctx *framework.RecommendationContext) error {

// IsIdentitySupported check whether object identity fit resource selector.
func IsIdentitySupported(identity framework.ObjectIdentity, selectors []analysisapi.ResourceSelector) bool {
supported := false
for _, selector := range selectors {
if len(selector.Name) == 0 {
if selector.Kind == identity.Kind && selector.APIVersion == identity.APIVersion {
Expand All @@ -45,5 +44,5 @@ func IsIdentitySupported(identity framework.ObjectIdentity, selectors []analysis
}
}

return supported
return false
}