-
Notifications
You must be signed in to change notification settings - Fork 92
Condition the OSS code to migrate the changes to ent #1146
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
Conversation
1f0b67e
to
f316c89
Compare
f316c89
to
d01f41e
Compare
10de3f0
to
e96c2a6
Compare
…idation for nil policy
b0df528
to
28d22f7
Compare
760aae8
to
8765b8f
Compare
256e733
to
158d587
Compare
… test and account for vertical scaling where direction is none
46afada
to
5b0e999
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.
LGTM. I've left a few questions but nothing critical if you've got a handle on it.
policy/handler_test.go
Outdated
must.Eq(t, tt.wantAction.Count, result.action.Count) | ||
must.NotNil(t, result.handler) | ||
must.Eq(t, tt.wantHandler.check.Name, result.handler.check.Name) | ||
//must.Eq(t, tt.wantHandler.check.Name, result.handler.check.Name) |
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.
//must.Eq(t, tt.wantHandler.check.Name, result.handler.check.Name) |
sdk/policy.go
Outdated
func (p *ScalingPolicy) Validate() error { | ||
if p == nil { | ||
return nil | ||
return errors.New("empty policy") |
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.
Just double-checking, but this looks like a behavior change? The relationship between sdk.ScalingPolicy
and scaling.policy
block has been a little fuzzy for me... but the default is for it to be nil, isn't it?
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.
you are right, let's revert this one
for source, handlers := range m.handlers { | ||
for id := range handlers { | ||
m.stopHandler(source, id) | ||
delete(handlers, id) |
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.
This looks like a behavior change as well?
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 realised it was missing, I will fix the comments
delete(handlers, id) | ||
} | ||
} | ||
} |
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.
This doesn't include delete(m.handlers, source)
call that stopHandlers
does. Should we remove the source if len(handlers) == 0
after stopping by type?
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.
This function is meant to replace the one that would stop all the vertical workers that where in charge of the recommendations in case of an invalid license, Im not usre removing the source is needed here.
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.
few more questions for ya
h.log.Debug("check selected", "name", winner.handler.check.Name, | ||
"direction", winner.action.Direction, "count", winner.action.Count) | ||
h.log.Debug("check selected", "direction", winner.action.Direction, | ||
"count", winner.action.Count) |
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.
why drop name
from this log?
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 dont remember, I think it was too long and made the logs too verbose
…heck for nil policy
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!
In order to migrate the policy worker redesign into the ent version, some parts of the code needed to be rearranged. This PR does it, plus addressing a missing deletion clean up when stoping the handlers.