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

A Scaler interface for push based events #820

Closed
2 tasks
ahmelsayed opened this issue May 16, 2020 · 6 comments
Closed
2 tasks

A Scaler interface for push based events #820

ahmelsayed opened this issue May 16, 2020 · 6 comments
Labels
feature All issues for new features that have been committed to scaler

Comments

@ahmelsayed
Copy link
Contributor

ahmelsayed commented May 16, 2020

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.

@ahmelsayed ahmelsayed added needs-discussion feature-request All issues for new features that have not been committed to labels May 16, 2020
@zroubalik
Copy link
Member

Looking good! I like this idea.

As for the signature, I'd prefer to use "the standard" go way, ie. with chan. But maybe you'll find other (better) ways during the implementation.

@tomkerkhove
Copy link
Member

Do I still have some time to review this or am I too late?

(out on holiday)

@ahmelsayed
Copy link
Contributor Author

sure, I still need to update the docs as well. Will wait for your review

@tomkerkhove
Copy link
Member

It looks good to me but we’ll need good documentation that cover the use-case as it might not be clear what to expect or when to use it.

Maybe even document an example scenario.

@tomkerkhove tomkerkhove added feature All issues for new features that have been committed to scaler and removed feature-request All issues for new features that have not been committed to needs-discussion labels Jun 1, 2020
zroubalik pushed a commit that referenced this issue Jun 16, 2020
* Add PushScaler interface and impl external-push scaler

Closes #820

Signed-off-by: Ahmed ElSayed <ahmels@microsoft.com>

* pass metadata to scaler

Signed-off-by: Ahmed ElSayed <ahmels@microsoft.com>

* add section for breaking changes in the CHANGELOG

Signed-off-by: Ahmed ElSayed <ahmels@microsoft.com>

* use correct protoc-gen-go version

Signed-off-by: Ahmed ElSayed <ahmels@microsoft.com>
zroubalik pushed a commit to zroubalik/keda that referenced this issue Jun 17, 2020
* Add PushScaler interface and impl external-push scaler

Closes kedacore#820

Signed-off-by: Ahmed ElSayed <ahmels@microsoft.com>

* pass metadata to scaler

Signed-off-by: Ahmed ElSayed <ahmels@microsoft.com>

* add section for breaking changes in the CHANGELOG

Signed-off-by: Ahmed ElSayed <ahmels@microsoft.com>

* use correct protoc-gen-go version

Signed-off-by: Ahmed ElSayed <ahmels@microsoft.com>
@zroubalik
Copy link
Member

Merged

zroubalik pushed a commit to zroubalik/keda that referenced this issue Jul 7, 2020
* Add PushScaler interface and impl external-push scaler

Closes kedacore#820

Signed-off-by: Ahmed ElSayed <ahmels@microsoft.com>

* pass metadata to scaler

Signed-off-by: Ahmed ElSayed <ahmels@microsoft.com>

* add section for breaking changes in the CHANGELOG

Signed-off-by: Ahmed ElSayed <ahmels@microsoft.com>

* use correct protoc-gen-go version

Signed-off-by: Ahmed ElSayed <ahmels@microsoft.com>
@tomkerkhove
Copy link
Member

Reopening as we don't have docs merged for it yet kedacore/keda-docs#193

@tomkerkhove tomkerkhove reopened this Jul 27, 2020
zroubalik pushed a commit that referenced this issue Aug 6, 2020
* Add PushScaler interface and impl external-push scaler

Closes #820

Signed-off-by: Ahmed ElSayed <ahmels@microsoft.com>

* pass metadata to scaler

Signed-off-by: Ahmed ElSayed <ahmels@microsoft.com>

* add section for breaking changes in the CHANGELOG

Signed-off-by: Ahmed ElSayed <ahmels@microsoft.com>

* use correct protoc-gen-go version

Signed-off-by: Ahmed ElSayed <ahmels@microsoft.com>
@renovate renovate bot mentioned this issue Jul 2, 2021
1 task
SpiritZhou pushed a commit to SpiritZhou/keda that referenced this issue Jul 18, 2023
…edacore#820)

Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature All issues for new features that have been committed to scaler
Projects
None yet
Development

No branches or pull requests

3 participants