-
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
Declarative scaler config #5676
Declarative scaler config #5676
Conversation
68cc5fb
to
0b74762
Compare
29f482f
to
f89b6cf
Compare
f89b6cf
to
83b0a63
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.
Could this be used to generate scalers' schema? |
we may need another set of field tags but I think it should be possible |
83b0a63
to
aa277c2
Compare
just fyi, I started refactoring auth params config so I will mark this as |
6a6c9b0
to
a80d471
Compare
Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
a80d471
to
43b6c10
Compare
/run-e2e |
I think we can give it a try, ptal @kedacore/keda-core-contributors after this merges, I will try to tackle the scalers one by one, would you like to divide and conquer @dttung2905? |
Absolutely, since there are many scalers, we can divide amongst ourselves and other community members who are interested as well. We can create a separate issue to track completion progress once this PR is merged 🤘 |
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.
Thanks @wozniakjan for spending times on making this changes, it's not an easy feat at all.
I have 1 minor comment in my first pass going through the PR. Will probably go through it during the weekend when I have time 😄
Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
fb88e5b
to
5236489
Compare
* rename 'parsingOrder' tag to 'order' * rename 'exclusive' tag to 'exclusiveSet' * improve parsing 'order' tag behaviour + additional coverage Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
5236489
to
07676ba
Compare
/run-e2e prometheus |
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, great job!
@dttung2905 let me know once you are done with reviews, so we can merge this :) |
Its all good for me now. Thanks @zroubalik |
Various scaler configurations are inconsistent in implementation as discussed in #5037. There has been a great effort in improving the situation with
getParameterFromConfigV2()
in #5228 (with further enhancements in #5319 and #5314).There are likely always going to be some situations that require imperative parsing of the provided configs and the helper
getParameterFromConfigV2()
, but for the majority of cases, I believe we can implement an even more generic, more convenient and declarative algorithm, similar for example to the API of well knownjson.Unmarshal()
.My desired goal is to allow each scaler to define the configuration struct with proper field tags to fine-tune the parsing algorithm, call a single helper method
TypedConfig()
defined onScalerConfig
struct and consume unmarshalled typed config without the need for explicit typecasting.Example:
Where the
MyConfigXYZ
is an arbitrary structure with fields containing properly formattedkeda
tag. Callers can controltriggerMetadata
,resolvedEnv
,authParams
, and which map has a precedenceoptional
ordeprecated
default
valuename
as a key to the mapenum
exclusive
The algorithm is based on go
reflections
and dynamic parsing of a structure, natively supportsslices
andmaps
andurl.Values
so it might eventually supersede helpers inpkg/util/parse_string.go
PR structure
Checklist
Relates to #5037