Skip to content

Conversation

@michaelawyu
Copy link
Contributor

Description of your changes

This PR is part of the PRs that implement the Fleet workload scheduling.

It features the scaffolding for scheduler framework.

I have:

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

N/A.

To accommodate the uncertainties forward, and considering the fact that there is no easy way to fake a controller runtime manager, this PR does not include unit test (sanity check) for NewFramework(). Tests will be checked in with future PRs.

Special notes for your reviewer

Copy link
Contributor

@zhiying-lin zhiying-lin left a comment

Choose a reason for hiding this comment

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

minor comments, others LGTM :)

Handle

// RunSchedulerCycleFor performs scheduling for a policy snapshot.
RunSchedulingCycleFor(ctx context.Context, policy *fleetv1.ClusterPolicySnapshot, resources *fleetv1.ClusterResourceSnapshot) (result ctrl.Result, err error)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
RunSchedulingCycleFor(ctx context.Context, policy *fleetv1.ClusterPolicySnapshot, resources *fleetv1.ClusterResourceSnapshot) (result ctrl.Result, err error)
RunSchedulingCycleForPlacement(ctx context.Context, policy *fleetv1.ClusterPolicySnapshot, resources *fleetv1.ClusterResourceSnapshot) (result ctrl.Result, err error)

changed to RunSchedulingCycleForPlacement?

Copy link
Contributor Author

Choose a reason for hiding this comment

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


const (
// eventRecorderNameTemplate is the template used to format event recorder name for a scheduler framework.
eventRecorderNameTemplate = "scheduler-framework-%s"
Copy link
Contributor

Choose a reason for hiding this comment

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

is this event msg readable for user?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Ryan! Ah, this isn't the event message, but the name of the event recorder in use by the scheduler framework.


// Handle is an interface which allows plugins to access some shared structs (e.g., client, manager)
// and set themselves up with the scheduler framework (e.g., sign up for an informer).
type Handle interface {
Copy link
Contributor

Choose a reason for hiding this comment

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

In general, I think interface name is better to be a noun while the function name is a verb. ie

type Writer interface {
Write(p []byte) (n int, err error)
}

We have the exact opposite pattern here.

Copy link
Contributor Author

@michaelawyu michaelawyu Jun 15, 2023

Choose a reason for hiding this comment

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

The name is also from Kubernetes; Handler would be a little bit weird, it's really more of a handle that allows plugins to touch the framework (in a limited manner).

@michaelawyu michaelawyu force-pushed the scheduler-framework-logic branch from 26ca9c7 to 2271a50 Compare June 16, 2023 05:44
@michaelawyu
Copy link
Contributor Author

Hi Ryan! I took the liberty to merge this PR first; if you have any further concerns about it, please let me know.

@michaelawyu michaelawyu merged commit 0d7827a into Azure:main Jun 16, 2023
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