Skip to content

Conversation

bhperry
Copy link
Contributor

@bhperry bhperry commented May 22, 2025

Enhancement proposal for making PlacementDecision scores easily visible to consumers, and supporting different sort orders in the decisions.

Signed-off-by: Ben Perry <bhperry94@gmail.com>
@openshift-ci openshift-ci bot requested review from deads2k and qiujian16 May 22, 2025 16:54
@bhperry
Copy link
Contributor Author

bhperry commented May 22, 2025

/assign @haoqing0110 @qiujian16


## Proposal

Add `SortBy` to `PlacementSpec` to configure the sort order for PlacementDecision. This field
Copy link
Member

Choose a reason for hiding this comment

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

one of the issue with sorting by score is that if the score changed to frequently, the decision result will be updated frequently also. We need to think about some approach to avoid that, or at least some document to notice users.

Copy link
Contributor Author

@bhperry bhperry May 27, 2025

Choose a reason for hiding this comment

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

Including that note in the description of SortBy: Score perhaps?

What is the main concern with decision results updating frequently? Including score in the decision results will result in the same number of updates (although not reordering without SortBy). In terms of API pressure, OCM already creates events for each score update. Are there expensive reconcilers that run on update to PlacementDecision?

Copy link
Member

@qiujian16 qiujian16 left a comment

Choose a reason for hiding this comment

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

looks good in general.

Signed-off-by: Ben Perry <bhperry94@gmail.com>
@qiujian16
Copy link
Member

/approve

Copy link

openshift-ci bot commented Aug 11, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bhperry, qiujian16

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@qiujian16
Copy link
Member

@haoqing0110 @bhperry are we fine to merge this?

// SortBy sets the sort order for decisions.
// It can be "Name", "Score", or "", where "" is "Name" by default.
// If sortBy is "Name", decisions will be orderd alphanumerically by cluster name
// If sortBy is "Score", decisions will be ordered numerically in descending order by score,
Copy link
Member

@haoqing0110 haoqing0110 Aug 11, 2025

Choose a reason for hiding this comment

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

As mentioned above, need to notice user that when sortBy is "Score", the placement decision will trigger an update when score changes. Since today we didn't control the frequency of how user update the AddonPlacmentScore, that means if the score changed too frequently, the decision result will be updated frequently also. Need to set an appropriate score update frequency.

Copy link
Member

@haoqing0110 haoqing0110 Aug 11, 2025

Choose a reason for hiding this comment

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

Defining the time (eg. every 1 minutes) to reschedule the placement might be a way to avoid the pressure on API server, but as the above discussed, the update of the score is uncontrollable, so perhaps the best way for now is just add some notice to the user.

Copy link
Member

Choose a reason for hiding this comment

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

it might make sense to define a rateLimit, such as MaxUpdatePerMinute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants