Skip to content

Commit

Permalink
Disable resync on SDK Server (#3508)
Browse files Browse the repository at this point in the history
* Disable resync on SDK Server

* added Alpha feature

* review changes
  • Loading branch information
Kalaiselvi84 authored Nov 18, 2023
1 parent 04ef87f commit 0b08fae
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ KIND_CONTAINER_NAME=$(KIND_PROFILE)-control-plane
GS_TEST_IMAGE ?= us-docker.pkg.dev/agones-images/examples/simple-game-server:0.22

# 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&FleetAllocationOverflow=true&Example=true"
ALPHA_FEATURE_GATES ?= "PlayerAllocationFilter=true&PlayerTracking=true&CountsAndLists=true&FleetAllocationOverflow=true&DisableResyncOnSDKServer=true&Example=true"

# Build with Windows support
WITH_WINDOWS=1
Expand Down
4 changes: 2 additions & 2 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,10 @@ steps:
region=${versionsAndRegions[$version]}
if [ $cloudProduct = generic ]
then
featureWithGate="PlayerAllocationFilter=true&PlayerTracking=true&ResetMetricsOnDelete=false&PodHostname=false&SplitControllerAndExtensions=false&FleetAllocationOverflow=true&CountsAndLists=true&Example=true"
featureWithGate="PlayerAllocationFilter=true&PlayerTracking=true&ResetMetricsOnDelete=false&PodHostname=false&SplitControllerAndExtensions=false&FleetAllocationOverflow=true&CountsAndLists=true&DisableResyncOnSDKServer=true&Example=true"
testCluster="standard-e2e-test-cluster-${version//./-}"
else
featureWithGate="PlayerAllocationFilter=true&PlayerTracking=true&ResetMetricsOnDelete=false&PodHostname=false&SplitControllerAndExtensions=true&FleetAllocationOverflow=true&CountsAndLists=true&Example=true"
featureWithGate="PlayerAllocationFilter=true&PlayerTracking=true&ResetMetricsOnDelete=false&PodHostname=false&SplitControllerAndExtensions=true&FleetAllocationOverflow=true&CountsAndLists=true&DisableResyncOnSDKServer=true&Example=true"
testCluster="gke-autopilot-e2e-test-cluster-${version//./-}"
fi
featureWithoutGate=""
Expand Down
1 change: 1 addition & 0 deletions install/helm/agones/defaultfeaturegates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ SplitControllerAndExtensions: true
PlayerAllocationFilter: false
PlayerTracking: false
FleetAllocationOverflow: false
DisableResyncOnSDKServer: false

# Pre-Alpha features
CountsAndLists: false
Expand Down
6 changes: 5 additions & 1 deletion pkg/sdkserver/sdkserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,17 @@ type SDKServer struct {
func NewSDKServer(gameServerName, namespace string, kubeClient kubernetes.Interface,
agonesClient versioned.Interface) (*SDKServer, error) {
mux := http.NewServeMux()
resync := 30 * time.Second
if runtime.FeatureEnabled(runtime.FeatureDisableResyncOnSDKServer) {
resync = 0
}

// limit the informer to only working with the gameserver that the sdk is attached to
tweakListOptions := func(opts *metav1.ListOptions) {
s1 := fields.OneTermEqualSelector("metadata.name", gameServerName)
opts.FieldSelector = s1.String()
}
factory := externalversions.NewSharedInformerFactoryWithOptions(agonesClient, 30*time.Second, externalversions.WithNamespace(namespace), externalversions.WithTweakListOptions(tweakListOptions))
factory := externalversions.NewSharedInformerFactoryWithOptions(agonesClient, resync, externalversions.WithNamespace(namespace), externalversions.WithTweakListOptions(tweakListOptions))
gameServers := factory.Agones().V1().GameServers()

s := &SDKServer{
Expand Down
10 changes: 7 additions & 3 deletions pkg/util/runtime/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ const (

// FeatureExample is an example feature gate flag, used for testing and demonstrative purposes
FeatureExample Feature = "Example"

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

var (
Expand Down Expand Up @@ -103,9 +106,10 @@ var (
FeatureSplitControllerAndExtensions: true,

// Alpha features
FeaturePlayerAllocationFilter: false,
FeaturePlayerTracking: false,
FeatureFleetAllocateOverflow: false,
FeatureFleetAllocateOverflow: false,
FeaturePlayerAllocationFilter: false,
FeaturePlayerTracking: false,
FeatureDisableResyncOnSDKServer: false,

// Pre-Alpha features
FeatureCountsAndLists: false,
Expand Down
14 changes: 14 additions & 0 deletions site/content/en/docs/Guides/feature-stages.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,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.37.0" %}}
| Feature Name | Gate | Default | Stage | Since |
|-----------------------------------------------------------------------------------------------------------------------|--------------------------------|----------|---------|--------|
| [GameServer Stable Network ID]({{% ref "/docs/Reference/gameserver.md#stable-network-id" %}}) | `PodHostname` | Enabled | `Beta` | 1.32.0 |
Expand All @@ -34,7 +35,20 @@ The current set of `alpha` and `beta` feature gates:
| [Player Tracking]({{< ref "/docs/Guides/player-tracking.md" >}}) | `PlayerTracking` | Disabled | `Alpha` | 1.6.0 |
| [Allocated GameServers are notified on relevant Fleet Updates][fleet-updates] | `FleetAllocationOverflow` | Disabled | `Alpha` | 1.32.0 |
| Example Gate (not in use) | `Example` | Disabled | None | 0.13.0 |
{{% /feature %}}

{{% feature publishVersion="1.37.0" %}}
| Feature Name | Gate | Default | Stage | Since |
|-----------------------------------------------------------------------------------------------------------------------|--------------------------------|----------|---------|--------|
| [GameServer Stable Network ID]({{% ref "/docs/Reference/gameserver.md#stable-network-id" %}}) | `PodHostname` | Enabled | `Beta` | 1.32.0 |
| [Reset Metric Export on Fleet / Autoscaler deletion]({{% relref "./metrics.md#dropping-metric-labels" %}}) | `ResetMetricsOnDelete` | Enabled | `Beta` | 1.32.0 |
| [Split `agones-controller` ](https://github.com/googleforgames/agones/issues/2797) | `SplitControllerAndExtensions` | Enabled | `Beta` | 1.32.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 |
| [Allocated GameServers are notified on relevant Fleet Updates][fleet-updates] | `FleetAllocationOverflow` | Disabled | `Alpha` | 1.32.0 |
| [DisableResyncOnSDKServer](https://github.com/googleforgames/agones/issues/3377) | `DisableResyncOnSDKServer` | Disabled | `Alpha` | 1.37.0 |
| Example Gate (not in use) | `Example` | Disabled | None | 0.13.0 |
{{% /feature %}}

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

Expand Down

0 comments on commit 0b08fae

Please sign in to comment.