Skip to content

A Scaler interface for push based events Β #820

Closed
@ahmelsayed

Description

This is a RFC for adding a push based scaler interface that looks like this

type PushScaler interface {
	Scaler

	Start(ctx context.Context, active chan<- struct{})
}

scaler.go

Use-Case

For event sources that support a streaming client. This allows KEDA to connect as a client to an endpoint that can stream "isActive" requests per scaledObject.

Specification

  • active updates from the push scaler reset the cooldownPeriod. They just skip the pollingInterval.

  • provide a generic GRPC implementation

service ExternalPushScaler {
    rpc StreamScaleRequests(ScaledObjectRef) returns (stream activeResponse) {}
}

this can be used in the scaled object with

...
spec:
  triggers:
    - type: external-push
      metadata:
        address: grpc-server-address:port

Few remarks:

I have been back and forth on the signature or Start().

	Start(ctx context.Context, active chan<- struct{})
// vs
	Start(ctx context.Context, active func())

it seems that a callback is simpler for this scenario, but I haven't seen a lot of go code with callbacks like that, so I'm not sure if it's something that's avoided.

Metadata

Assignees

No one assigned

    Labels

    featureAll issues for new features that have been committed toscaler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions