Skip to content

Commit

Permalink
Graduate Counters and Lists to Beta (#3801)
Browse files Browse the repository at this point in the history
* Graduate Counters and Lists to Beta
* Creates a BETA_FEATURE_GATES for use with the CSharp and REST SDK conformance tests
These tests cannot see the runtime config of the SDK that sets the feature gate countsandlists to true by default, so we need to pass in an environment variable setting the feature gate to true.

---------

Co-authored-by: Ivy Gooch <igooch@google.com>
  • Loading branch information
Kalaiselvi84 and igooch committed Apr 29, 2024
1 parent db84735 commit 2877209
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 21 deletions.
5 changes: 4 additions & 1 deletion build/Makefile
Expand Up @@ -63,8 +63,11 @@ KIND_CONTAINER_NAME=$(KIND_PROFILE)-control-plane
# Game Server image to use while doing end-to-end tests
GS_TEST_IMAGE ?= us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31

# Enable all beta feature gates. Keep in sync with `true` (beta) entries in pkg/util/runtime/features.go:featureDefaults
BETA_FEATURE_GATES ?= "CountsAndLists=true&DisableResyncOnSDKServer=true"

# Enable all alpha feature gates. Keep in sync with `false` (alpha) entries in pkg/util/runtime/features.go:featureDefaults
ALPHA_FEATURE_GATES ?= "PlayerAllocationFilter=true&PlayerTracking=true&CountsAndLists=true&Example=true"
ALPHA_FEATURE_GATES ?= "PlayerAllocationFilter=true&PlayerTracking=true&Example=true"

# Build with Windows support
WITH_WINDOWS=1
Expand Down
24 changes: 12 additions & 12 deletions build/includes/sdk.mk
Expand Up @@ -36,7 +36,7 @@ COMMAND ?= gen
SDK_IMAGE_TAG=$(build_sdk_prefix)$(SDK_FOLDER):$(build_sdk_version)
DEFAULT_CONFORMANCE_TESTS = ready,allocate,setlabel,setannotation,gameserver,health,shutdown,watch,reserve
ALPHA_CONFORMANCE_TESTS = getplayercapacity,setplayercapacity,playerconnect,playerdisconnect,getplayercount,isplayerconnected,getconnectedplayers
# TODO: Move Counter and List tests into ALPHA_CONFORMANCE_TESTS once the they are written for all SDKs
# TODO: Move Counter and List tests into DEFAULT_CONFORMANCE_TESTS once the they are written for all SDKs
COUNTS_AND_LISTS_TESTS = getcounter,updatecounter,setcountcounter,setcapacitycounter,getlist,updatelist,addlistvalue,removelistvalue

.PHONY: test-sdks test-sdk build-sdks build-sdk gen-all-sdk-grpc gen-sdk-grpc run-all-sdk-command run-sdk-command build-example
Expand Down Expand Up @@ -168,9 +168,9 @@ run-sdk-conformance-test-node:
$(MAKE) run-sdk-conformance-test SDK_FOLDER=node GRPC_PORT=9002 HTTP_PORT=9102

run-sdk-conformance-test-go:
# run without feature flags
$(MAKE) run-sdk-conformance-test SDK_FOLDER=go GRPC_PORT=9001 HTTP_PORT=9101
# run with feature flags enabled
# run with on-by-default (Beta) feature flags enabled
$(MAKE) run-sdk-conformance-test SDK_FOLDER=go GRPC_PORT=9001 HTTP_PORT=9101 TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(COUNTS_AND_LISTS_TESTS)
# run with Alpha and Beta feature flags enabled
$(MAKE) run-sdk-conformance-test SDK_FOLDER=go GRPC_PORT=9001 HTTP_PORT=9101 FEATURE_GATES=$(ALPHA_FEATURE_GATES) TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(ALPHA_CONFORMANCE_TESTS),$(COUNTS_AND_LISTS_TESTS)

run-sdk-conformance-test-rust:
Expand All @@ -184,17 +184,17 @@ run-sdk-conformance-test-rust:
DOCKER_RUN_ARGS="$(DOCKER_RUN_ARGS) -e RUN_ASYNC=true" $(MAKE) run-sdk-conformance-test SDK_FOLDER=rust GRPC_PORT=9004 HTTP_PORT=9104 FEATURE_GATES=PlayerTracking=true TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(ALPHA_CONFORMANCE_TESTS)

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=$(ALPHA_FEATURE_GATES) TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(ALPHA_CONFORMANCE_TESTS),$(COUNTS_AND_LISTS_TESTS)
# run with Beta feature flags enabled
$(MAKE) run-sdk-conformance-test SDK_FOLDER=csharp GRPC_PORT=9005 HTTP_PORT=9105 FEATURE_GATES=$(BETA_FEATURE_GATES) TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(COUNTS_AND_LISTS_TESTS)
# run with Alpha feature flags enabled
$(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)

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)
# run without feature flags
$(MAKE) run-sdk-conformance-test SDK_FOLDER=restapi GRPC_PORT=9050 HTTP_PORT=9150
# run with feature flags enabled
$(MAKE) run-sdk-conformance-test SDK_FOLDER=restapi GRPC_PORT=9050 HTTP_PORT=9150 FEATURE_GATES=$(ALPHA_FEATURE_GATES) TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(ALPHA_CONFORMANCE_TESTS),$(COUNTS_AND_LISTS_TESTS)
# run with Beta feature flags enabled
$(MAKE) run-sdk-conformance-test SDK_FOLDER=restapi GRPC_PORT=9050 HTTP_PORT=9150 FEATURE_GATES=$(BETA_FEATURE_GATES) TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(COUNTS_AND_LISTS_TESTS)
# run with Alpha feature flags enabled
$(MAKE) run-sdk-conformance-test SDK_FOLDER=restapi GRPC_PORT=9050 HTTP_PORT=9150 FEATURE_GATES=$(ALPHA_FEATURE_GATES) TESTS=$(DEFAULT_CONFORMANCE_TESTS),$(ALPHA_CONFORMANCE_TESTS)

$(MAKE) run-sdk-command COMMAND=clean SDK_FOLDER=restapi

Expand Down
2 changes: 1 addition & 1 deletion cloudbuild.yaml
Expand Up @@ -276,7 +276,7 @@ steps:
declare -A versionsAndRegions=( [1.27]=us-east1 [1.28]=us-west1 [1.29]=europe-west1 )
# Keep in sync with (the inverse of) pkg/util/runtime/features.go:featureDefaults
featureWithGate="PlayerAllocationFilter=true&PlayerTracking=true&CountsAndLists=true&DisableResyncOnSDKServer=false&Example=true"
featureWithGate="PlayerAllocationFilter=true&PlayerTracking=true&CountsAndLists=false&DisableResyncOnSDKServer=false&Example=true"
featureWithoutGate=""
# Use this if specific feature gates can only be supported on specific Kubernetes versions.
Expand Down
2 changes: 1 addition & 1 deletion install/helm/agones/defaultfeaturegates.yaml
Expand Up @@ -15,10 +15,10 @@
# Default values for feature gates. Keep in sync with pkg/util/runtime/features.go:featureDefaults

# Beta features
CountsAndLists: true
DisableResyncOnSDKServer: true

# Alpha features
CountsAndLists: false
GKEAutopilotExtendedDurationPods: false
PlayerAllocationFilter: false
PlayerTracking: false
Expand Down
2 changes: 2 additions & 0 deletions pkg/gameserversets/controller_test.go
Expand Up @@ -340,6 +340,8 @@ func TestComputeStatus(t *testing.T) {
Count: 30,
Capacity: 55,
},
Counters: map[string]agonesv1.AggregatedCounterStatus{},
Lists: map[string]agonesv1.AggregatedListStatus{},
}

assert.Equal(t, expected, computeStatus(list))
Expand Down
17 changes: 11 additions & 6 deletions pkg/util/runtime/features.go
Expand Up @@ -31,16 +31,19 @@ const (
////////////////
// Beta features

////////////////
// Alpha features

// FeatureCountsAndLists is a feature flag that enables/disables counts and lists feature
// FeatureCountsAndLists is a feature flag that enables counts and lists feature
// (a generic implenetation of the player tracking feature).
FeatureCountsAndLists Feature = "CountsAndLists"

////////////////
// Alpha features

// FeatureDisableResyncOnSDKServer is a feature flag to enable/disable resync on SDK server.
FeatureDisableResyncOnSDKServer Feature = "DisableResyncOnSDKServer"

////////////////
// Alpha features

// FeatureGKEAutopilotExtendedDurationPods enables the use of Extended Duration pods
// when Agones is running on Autopilot. Available on 1.28+ only.
FeatureGKEAutopilotExtendedDurationPods = "GKEAutopilotExtendedDurationPods"
Expand Down Expand Up @@ -83,22 +86,24 @@ var (
// * move from `false` to `true` in `featureDefaults`.
// * move from `false` to `true` in install/helm/agones/defaultfeaturegates.yaml
// * remove from `ALPHA_FEATURE_GATES` in build/Makefile
// * add to `BETA_FEATURE_GATES` in build/Makefile
// * invert in the e2e-runner config in cloudbuild.yaml
// * change the value in site/content/en/docs/Guides/feature-stages.md.
// * Ensure that the features in each file are organized categorically and alphabetically.
//
// To promote a feature from beta->GA:
// * remove all places consuming the feature gate and fold logic to true
// * consider cleanup - often folding a gate to true allows refactoring
// * consider cleanup - often folding a gate to true allows refactoring
// * invert the "new alpha feature" steps above
// * remove from `BETA_FEATURE_GATES` in build/Makefile
//
// In each of these, keep the feature sorted by descending maturity then alphabetical
featureDefaults = map[Feature]bool{
// Beta features
FeatureCountsAndLists: true,
FeatureDisableResyncOnSDKServer: true,

// Alpha features
FeatureCountsAndLists: false,
FeatureGKEAutopilotExtendedDurationPods: false,
FeaturePlayerAllocationFilter: false,
FeaturePlayerTracking: false,
Expand Down
13 changes: 13 additions & 0 deletions site/content/en/docs/Guides/feature-stages.md
Expand Up @@ -24,6 +24,7 @@ that can be found in the [Helm configuration]({{< ref "/docs/Installation/Instal

The current set of `alpha` and `beta` feature gates:

{{% feature expiryVersion="1.41.0" %}}
| Feature Name | Gate | Default | Stage | Since |
|-----------------------------------------------------------------------------------------------------------------------------|------------------------------------|----------|---------|--------|
| [DisableResyncOnSDKServer](https://github.com/googleforgames/agones/issues/3377) | `DisableResyncOnSDKServer` | Enabled | `Beta` | 1.40.0 |
Expand All @@ -34,7 +35,19 @@ The current set of `alpha` and `beta` feature gates:
| Example Gate (not in use) | `Example` | Disabled | None | 0.13.0 |

[fleet-updates]: {{% relref "./fleet-updates.md#notifying-gameservers-on-fleet-updatedownscale" %}}
{{% /feature %}}
{{% feature publishVersion="1.41.0" %}}
| Feature Name | Gate | Default | Stage | Since |
|-----------------------------------------------------------------------------------------------------------------------------|------------------------------------|----------|---------|--------|
| [CountsAndLists](https://github.com/googleforgames/agones/issues/2716) | `CountsAndLists` | Enabled | `Beta` | 1.41.0 |
| [DisableResyncOnSDKServer](https://github.com/googleforgames/agones/issues/3377) | `DisableResyncOnSDKServer` | Enabled | `Beta` | 1.40.0 |
| [Support for Extended Duration Pods on GKE Autopilot (*1.28+ only*)](https://github.com/googleforgames/agones/issues/3386) | `GKEAutopilotExtendedDurationPods` | Disabled | `Alpha` | 1.37.0 |
| [GameServer player capacity filtering on GameServerAllocations](https://github.com/googleforgames/agones/issues/1239) | `PlayerAllocationFilter` | Disabled | `Alpha` | 1.14.0 |
| [Player Tracking]({{< ref "/docs/Guides/player-tracking.md" >}}) | `PlayerTracking` | Disabled | `Alpha` | 1.6.0 |
| Example Gate (not in use) | `Example` | Disabled | None | 0.13.0 |

[fleet-updates]: {{% relref "./fleet-updates.md#notifying-gameservers-on-fleet-updatedownscale" %}}
{{% /feature %}}

{{< alert title="Note" color="info" >}}
If you aren't sure if Feature Flags have been set correctly, have a look at the
Expand Down

0 comments on commit 2877209

Please sign in to comment.