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

make PollingInterval configurable to speed up autoscaling reaction time #1184

Open
lx1036 opened this issue Oct 29, 2024 · 0 comments
Open

Comments

@lx1036
Copy link

lx1036 commented Oct 29, 2024

Proposal

When create a HTTPScaledObject, operator will create a ScaledObject or skip creation, the ScaledObject PollingInterval field is a const 15:

const (
	soPollingInterval = 15

)

func NewScaledObject(
	namespace string,
	name string,
	labels map[string]string,
	annotations map[string]string,
	workloadRef v1alpha1.ScaleTargetRef,
	scalerAddress string,
	minReplicas *int32,
	maxReplicas *int32,
	cooldownPeriod *int32,
) *kedav1alpha1.ScaledObject {
	return &kedav1alpha1.ScaledObject{
		TypeMeta: metav1.TypeMeta{
			APIVersion: kedav1alpha1.SchemeGroupVersion.Identifier(),
			Kind:       ObjectKind(&kedav1alpha1.ScaledObject{}),
		},
		ObjectMeta: metav1.ObjectMeta{
			Namespace:   namespace,
			Name:        name,
			Labels:      labels,
			Annotations: annotations,
		},
		Spec: kedav1alpha1.ScaledObjectSpec{
			ScaleTargetRef: &kedav1alpha1.ScaleTarget{
				APIVersion: workloadRef.APIVersion,
				Kind:       workloadRef.Kind,
				Name:       workloadRef.Name,
			},
			PollingInterval: ptr.To[int32](soPollingInterval),
			CooldownPeriod:  cooldownPeriod,
			MinReplicaCount: minReplicas,
			MaxReplicaCount: maxReplicas,
			Advanced: &kedav1alpha1.AdvancedConfig{
				RestoreToOriginalReplicaCount: true,
			},
			Triggers: []kedav1alpha1.ScaleTriggers{
				{
					Type: soTriggerType,
					Metadata: map[string]string{
						ScalerAddressKey:    scalerAddress,
						HTTPScaledObjectKey: name,
					},
				},
			},
		},
	}

It should be configurable like CooldownPeriod field, so When I speed up autoscaling reaction time, I can set PollingInterval=1, Keda external scaler get metrics every 1s.

Use-Case

No response

Is this a feature you are interested in implementing yourself?

Yes

Anything else?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To Triage
Development

No branches or pull requests

1 participant