-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add support when JetStream cluster not on kubernetes #4102
Conversation
Semgrep found 6 use net.JoinHostPort instead of fmt.Sprintf($XX, nodeHostname) Created by sprintf-host-port. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unit tests are faling:
=== RUN TestNATSJetStreamIsActive
nats_jetstream_scaler_test.go:262: Expected error for 'Fail - Bad leader name (clustered)' but got success
nats_jetstream_scaler_test.go:266: Expected 'Fail - Bad leader name (clustered)' 'isActive=false', got 'true'
--- FAIL: TestNATSJetStreamIsActive (0.01s)
=== RUN TestNewNATSJetStreamScaler
--- PASS: TestNewNATSJetStreamScaler (0.00s)
=== RUN TestNATSJetStreamGetMetrics
nats_jetstream_scaler_test.go:318: Expected error for 'Fail - Bad leader name (clustered)' but got success
--- FAIL: TestNATSJetStreamGetMetrics (0.17s)
you can test this locally by running the individual test or make test
Also Static checks are failing because of the use of deprecated package.
0718c0c
to
dbc8463
Compare
@zroubalik the failing unit tests probably no longer relevant because the changes don't use the consumer leader name as monitoring url anymore. Should I remove the test? or is there any other use case where bad leader name is unfavorable? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mfadhlika yeah, sorry for the delay I missed the notification. Please update the unit tests to reflect the new behavior and also extend the coverage if possible.
@mfadhlika any update on this please? |
@zroubalik sorry, been busy past couple weeks. I'll try to update this weekend |
25c7f9b
to
c02f62b
Compare
/run-e2e nats* |
Signed-off-by: Muhammad Fadhlika <git@fadhlika.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@mfadhlika thanks a lot for the contibution!
Signed-off-by: Muhammad Fadhlika <git@fadhlika.com>
This change seems to have broken the scaler on kubernetes. I'm thinking we need to put the test that was removed back and get these changes working with that. I'll do some troubleshooting. |
@rayjanoka I did read your PR before working on this. All I did is replacing node monitoring url from |
hmm I don't see
|
I see, I use https://github.com/nats-io/nats-server/blob/main/server/route.go#LL1705C2-L1709C3 |
So maybe we can add back the old way and make it backward compatible...? I think I get this error because it can't find
and maybe we can make the testing include my use case... |
I agree we should make it backward compatible, should we look for |
yes, I think fallback is good if |
I'm trying to use NATS Jetstream scaler, previously I workaround the lack of NATS Jetstream scaler by using Prometheus in middle of NATS and Keda. I run into issue with the NATS Jetstream scaler because our stack use 3 VMs for NATS Jetstream cluster and round robin load balancer.
Currently the scaler assume NATS node always have
<node>.<monitoringURL>
as URL for the node, which is not the case when NATS cluster is not on kubernetes.<monitoringURL>/varz
endpoint respond withBecause the scaler assume it's on kubernetes, it splits url by
. (dot)
and take first item as node and we get172.nats.company.internal:8222
for thenatsJetStreamMonitoringNodeURL
as shown in code.This PR only works if monitoring port of all node is the same as
monitoringEndpoint
Checklist
Fixes #4101