Skip to content

improve globalRecommendedHPABehavior to be similar to the default one #328

@sanposhiho

Description

@sanposhiho

https://github.com/mercari/tortoise/blob/main/pkg/hpa/service.go#L279-L298

var globalRecommendedHPABehavior = &v2.HorizontalPodAutoscalerBehavior{
	ScaleUp: &v2.HPAScalingRules{
		Policies: []v2.HPAScalingPolicy{
			{
				Type:          v2.PercentScalingPolicy,
				Value:         100,
				PeriodSeconds: 60,
			},
		},
	},
	ScaleDown: &v2.HPAScalingRules{
		Policies: []v2.HPAScalingPolicy{
			{
				Type:          v2.PercentScalingPolicy,
				Value:         2,
				PeriodSeconds: 90,
			},
		},
	},
}

Change the above current behaviour to the following, which is more similar to the default
https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#default-behavior

var globalRecommendedHPABehavior = &v2.HorizontalPodAutoscalerBehavior{
	ScaleUp: &v2.HPAScalingRules{
		Policies: []v2.HPAScalingPolicy{
			{
				Type:          v2.PercentScalingPolicy,
				Value:         100,
				PeriodSeconds: 60,
			},
			{ // added.
				Type:          v2.PodsScalingPolicy,
				Value:         4,
				PeriodSeconds: 60,
			},
		},
	},
	ScaleDown: &v2.HPAScalingRules{
		Policies: []v2.HPAScalingPolicy{
			{
				Type:          v2.PercentScalingPolicy,
				Value:         2,
				PeriodSeconds: 90,
			},
		},
	},
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions