-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: scheduler plugins (2/): add topology spread constraints plugin …
…logic (#430)
- Loading branch information
1 parent
36b3987
commit 18e9459
Showing
10 changed files
with
696 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
Copyright (c) Microsoft Corporation. | ||
Licensed under the MIT license. | ||
*/ | ||
|
||
package framework | ||
|
||
import ( | ||
fleetv1beta1 "go.goms.io/fleet/apis/placement/v1beta1" | ||
) | ||
|
||
// prepareScheduledOrBoundMap returns a map that allows quick lookup of whether a cluster | ||
// already has a binding of the scheduled or bound state relevant to the current scheduling | ||
// cycle. | ||
func prepareScheduledOrBoundMap(scheduledOrBoundBindings ...[]*fleetv1beta1.ClusterResourceBinding) map[string]bool { | ||
scheduledOrBound := make(map[string]bool) | ||
|
||
for _, bindingSet := range scheduledOrBoundBindings { | ||
for _, binding := range bindingSet { | ||
scheduledOrBound[binding.Spec.TargetCluster] = true | ||
} | ||
} | ||
|
||
return scheduledOrBound | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.