Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesvien authored Apr 4, 2024
2 parents a3f0074 + efbc412 commit 19b10cf
Show file tree
Hide file tree
Showing 12 changed files with 1,641 additions and 423 deletions.
2 changes: 1 addition & 1 deletion build/includes/sdk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ run-sdk-conformance-test-csharp:
# run without feature flags
$(MAKE) run-sdk-conformance-test SDK_FOLDER=csharp GRPC_PORT=9005 HTTP_PORT=9105
# run with feature flags enabled
$(MAKE) run-sdk-conformance-test SDK_FOLDER=csharp GRPC_PORT=9005 HTTP_PORT=9105 FEATURE_GATES=PlayerTracking=true TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(ALPHA_CONFORMANCE_TESTS)
$(MAKE) run-sdk-conformance-test SDK_FOLDER=csharp GRPC_PORT=9005 HTTP_PORT=9105 FEATURE_GATES=$(ALPHA_FEATURE_GATES) TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(ALPHA_CONFORMANCE_TESTS),$(COUNTS_AND_LISTS_TESTS)

run-sdk-conformance-test-rest:
# (note: the restapi folder doesn't use GRPC_PORT but run-sdk-conformance-no-build defaults it, so we supply a unique value here)
Expand Down
1 change: 1 addition & 0 deletions install/helm/agones/templates/crds/fleet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ spec:
order:
type: string
description: Ascending or Descending sort order. Default is "Ascending" so remove smaller available capacity first. "Descending" would remove larger available capacity first.
default: Ascending
enum:
- Ascending
- Descending
Expand Down
1 change: 1 addition & 0 deletions install/yaml/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ spec:
order:
type: string
description: Ascending or Descending sort order. Default is "Ascending" so remove smaller available capacity first. "Descending" would remove larger available capacity first.
default: Ascending
enum:
- Ascending
- Descending
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/agones/v1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ type Priority struct {
Key string `json:"key"`
// Order: Sort by "Ascending" or "Descending". "Descending" a bigger available capacity is preferred.
// "Ascending" would be smaller available capacity is preferred.
// The default sort order is "Ascending"
Order string `json:"order"`
}

Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/allocation/v1/gameserverallocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,12 @@ func (gsa *GameServerAllocation) ApplyDefaults() {
gsa.Spec.Scheduling = apis.Packed
}

for i := range gsa.Spec.Priorities {
if len(gsa.Spec.Priorities[i].Order) == 0 {
gsa.Spec.Priorities[i].Order = agonesv1.GameServerPriorityAscending
}
}

if len(gsa.Spec.Selectors) == 0 {
gsa.Spec.Required.ApplyDefaults()

Expand Down
12 changes: 11 additions & 1 deletion pkg/apis/allocation/v1/gameserverallocation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,19 @@ func TestGameServerAllocationApplyDefaults(t *testing.T) {

assert.Equal(t, apis.Packed, gsa.Spec.Scheduling)

gsa = &GameServerAllocation{Spec: GameServerAllocationSpec{Scheduling: apis.Distributed}}
priorities := []agonesv1.Priority{
{Type: agonesv1.GameServerPriorityList},
{Type: agonesv1.GameServerPriorityCounter},
}
expectedPrioritiesWithDefault := []agonesv1.Priority{
{Type: agonesv1.GameServerPriorityList, Order: agonesv1.GameServerPriorityAscending},
{Type: agonesv1.GameServerPriorityCounter, Order: agonesv1.GameServerPriorityAscending},
}

gsa = &GameServerAllocation{Spec: GameServerAllocationSpec{Scheduling: apis.Distributed, Priorities: priorities}}
gsa.ApplyDefaults()
assert.Equal(t, apis.Distributed, gsa.Spec.Scheduling)
assert.Equal(t, expectedPrioritiesWithDefault, gsa.Spec.Priorities)

runtime.FeatureTestMutex.Lock()
defer runtime.FeatureTestMutex.Unlock()
Expand Down
Loading

0 comments on commit 19b10cf

Please sign in to comment.