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

improve globalRecommendedHPABehavior to be similar to the default one #328

Open
sanposhiho opened this issue Feb 14, 2024 · 1 comment
Open
Labels
kind/feature New feature or request

Comments

@sanposhiho
Copy link
Collaborator

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,
			},
		},
	},
}
@sanposhiho sanposhiho added the kind/feature New feature or request label Feb 14, 2024
@sanposhiho sanposhiho changed the title improve globalRecommendedHPABehavior to prevent crazy scaling up improve globalRecommendedHPABehavior to be similar to the default one Feb 14, 2024
@sanposhiho
Copy link
Collaborator Author

sanposhiho commented Feb 14, 2024

If you just change the implementation only, the integration tests would fail.
https://github.com/mercari/tortoise/blob/main/controllers/tortoise_controller_test.go

You have to understand our e2e tests and eventually modify the test cases.
See https://github.com/mercari/tortoise/blob/main/docs/contributor-guide.md#e2e-tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant