From 28772093eef42e4183926596b3019602f15a6e73 Mon Sep 17 00:00:00 2001 From: Kalaiselvim <117940852+Kalaiselvi84@users.noreply.github.com> Date: Mon, 29 Apr 2024 16:14:46 +0000 Subject: [PATCH] Graduate Counters and Lists to Beta (#3801) * 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 --- build/Makefile | 5 +++- build/includes/sdk.mk | 24 +++++++++---------- cloudbuild.yaml | 2 +- install/helm/agones/defaultfeaturegates.yaml | 2 +- pkg/gameserversets/controller_test.go | 2 ++ pkg/util/runtime/features.go | 17 ++++++++----- site/content/en/docs/Guides/feature-stages.md | 13 ++++++++++ 7 files changed, 44 insertions(+), 21 deletions(-) diff --git a/build/Makefile b/build/Makefile index 5f5eb8e91c..d08ca52241 100644 --- a/build/Makefile +++ b/build/Makefile @@ -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 diff --git a/build/includes/sdk.mk b/build/includes/sdk.mk index 17bb9b25df..f220331a1b 100644 --- a/build/includes/sdk.mk +++ b/build/includes/sdk.mk @@ -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 @@ -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: @@ -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 diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 77bf0fe82a..cee6bcd06b 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -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. diff --git a/install/helm/agones/defaultfeaturegates.yaml b/install/helm/agones/defaultfeaturegates.yaml index 1641eb59f6..09997cc46c 100644 --- a/install/helm/agones/defaultfeaturegates.yaml +++ b/install/helm/agones/defaultfeaturegates.yaml @@ -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 diff --git a/pkg/gameserversets/controller_test.go b/pkg/gameserversets/controller_test.go index bb1b09ff2c..c5ccb04b18 100644 --- a/pkg/gameserversets/controller_test.go +++ b/pkg/gameserversets/controller_test.go @@ -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)) diff --git a/pkg/util/runtime/features.go b/pkg/util/runtime/features.go index 76aca57fa0..f4a3e56037 100644 --- a/pkg/util/runtime/features.go +++ b/pkg/util/runtime/features.go @@ -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" @@ -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, diff --git a/site/content/en/docs/Guides/feature-stages.md b/site/content/en/docs/Guides/feature-stages.md index 16650e4165..aa7b4e5688 100644 --- a/site/content/en/docs/Guides/feature-stages.md +++ b/site/content/en/docs/Guides/feature-stages.md @@ -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 | @@ -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