Skip to content

Commit

Permalink
test: add additional unit tests for cluster affinity scheduler plugin (
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelawyu authored Aug 1, 2024
1 parent 61c14c1 commit 0c49256
Show file tree
Hide file tree
Showing 3 changed files with 1,165 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const (

envLabelName = "env"
envLabelValue1 = "prod"
envLabelValue2 = "canary"

nodeCountPropertyValue1 = "3"

Expand Down
3 changes: 2 additions & 1 deletion pkg/scheduler/framework/plugins/clusteraffinity/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ func retrieveResourceUsageFrom(cluster *clusterv1beta1.MemberCluster, name strin
//
// As a pre-defined rule, all the resource properties are assigned a label name of the format
// `[PREFIX]/[CAPACITY_TYPE]-[RESOURCE_NAME]`; for example, the allocatable CPU capacity of a
// a cluster has the label name, `resources.kubernetes-fleet.io/allocatable-cpu`.
// a cluster has the label name, `resources.kubernetes-fleet.io/allocatable-cpu`. Note that at
// this point of process, the prefix has been removed.
segs := strings.Split(name, "-")
if len(segs) != 2 || len(segs[0]) == 0 || len(segs[1]) == 0 {
return nil, fmt.Errorf("invalid resource property name: %s", name)
Expand Down
Loading

0 comments on commit 0c49256

Please sign in to comment.