Skip to content

Conversation

Juanadelacuesta
Copy link
Member

@Juanadelacuesta Juanadelacuesta commented Aug 12, 2025

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.

@Juanadelacuesta Juanadelacuesta marked this pull request as draft August 13, 2025 15:02
… test and account for vertical scaling where direction is none
@Juanadelacuesta Juanadelacuesta marked this pull request as ready for review September 5, 2025 14:54
tgross
tgross previously approved these changes Sep 8, 2025
Copy link
Member

@tgross tgross left a 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.

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//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")
Copy link
Member

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?

Copy link
Member Author

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)
Copy link
Member

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?

Copy link
Member Author

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)
}
}
}
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

@gulducat gulducat left a 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

Comment on lines -440 to +460
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)
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

@gulducat gulducat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@Juanadelacuesta Juanadelacuesta merged commit 05b5f7a into main Sep 12, 2025
33 checks passed
@Juanadelacuesta Juanadelacuesta deleted the NOJIRA-ent-updates branch September 12, 2025 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants