Closed
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{})
}
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 thepollingInterval
. -
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.