-
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
refactor liklus scaler #6433
base: main
Are you sure you want to change the base?
refactor liklus scaler #6433
Conversation
Signed-off-by: Omer Aplatony <[email protected]>
cfe52d7
to
56f8d4a
Compare
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.
great work! just a few minor details below
pkg/scalers/liiklus_scaler.go
Outdated
switch { | ||
case config.TriggerMetadata["topic"] == "": | ||
case meta.Topic == "": | ||
return nil, ErrLiiklusNoTopic | ||
case config.TriggerMetadata["address"] == "": | ||
case meta.Address == "": | ||
return nil, ErrLiiklusNoAddress | ||
case config.TriggerMetadata["group"] == "": | ||
case meta.Group == "": | ||
return nil, ErrLiiklusNoGroup | ||
} |
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.
I think this should be safe to remove because Topic
, Address
, and Group
are not marked as optional
in the field tags so the TypedConfig
parsing will throw an error
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.
Yes, I agree. fixed in: 4934fd0
pkg/scalers/liiklus_scaler_test.go
Outdated
if err != nil { | ||
t.Fatal("Could not parse metadata:", err) | ||
} | ||
meta.triggerIndex = testData.triggerIndex |
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.
tests shouldn't modify the meta from parseLiiklusMetadata
activationLagThreshold: activationLagThreshold, | ||
triggerIndex: config.TriggerIndex, | ||
}, nil | ||
return meta, nil |
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.
I think this is the place that should populate meta.triggerIndex
return meta, nil | |
meta.triggerIndex = config.TriggerIndex | |
return meta, nil |
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.
Added in: 4934fd0
Signed-off-by: Omer Aplatony <[email protected]>
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.
Are these const still required?
const (
defaultLiiklusLagThreshold int64 = 10
defaultLiiklusActivationLagThreshold int64 = 0
)
const (
liiklusLagThresholdMetricName = "lagThreshold"
liiklusActivationLagThresholdMetricName = "activationLagThreshold"
)
I only use them in _test.go, so I believe they can be removed. |
Signed-off-by: Omer Aplatony <[email protected]>
Provide a description of what has been changed
Checklist
Fixes #
Relates to #5797