Skip to content

Commit

Permalink
Move SDKGracefulTermination To Stable (#3231)
Browse files Browse the repository at this point in the history
* Update label-pr.yml

* Revert "Update label-pr.yml"

* Revert "Revert "Update label-pr.yml""

* Revert "Update label-pr.yml"

* Revert "Revert "Update label-pr.yml""

* Move SDKGracefulTermination To Stable

* small fix

---------

Co-authored-by: Mark Mandel <markmandel@google.com>
  • Loading branch information
Kalaiselvi84 and markmandel committed Jun 23, 2023
1 parent ee00620 commit de35cdb
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 28 deletions.
4 changes: 2 additions & 2 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,10 @@ steps:
region=${versionsAndRegions[$version]}
if [ $cloudProduct = generic ]
then
featureWithGate="CustomFasSyncInterval=false&SDKGracefulTermination=false&StateAllocationFilter=false&PlayerAllocationFilter=true&PlayerTracking=true&ResetMetricsOnDelete=false&PodHostname=false&SplitControllerAndExtensions=false&FleetAllocationOverflow=true&Example=true"
featureWithGate="CustomFasSyncInterval=false&StateAllocationFilter=false&PlayerAllocationFilter=true&PlayerTracking=true&ResetMetricsOnDelete=false&PodHostname=false&SplitControllerAndExtensions=false&FleetAllocationOverflow=true&Example=true"
testCluster="standard-e2e-test-cluster-${version//./-}"
else
featureWithGate="CustomFasSyncInterval=false&SDKGracefulTermination=false&StateAllocationFilter=false&PlayerAllocationFilter=true&PlayerTracking=true&ResetMetricsOnDelete=false&PodHostname=false&SplitControllerAndExtensions=true&FleetAllocationOverflow=true&Example=true"
featureWithGate="CustomFasSyncInterval=false&StateAllocationFilter=false&PlayerAllocationFilter=true&PlayerTracking=true&ResetMetricsOnDelete=false&PodHostname=false&SplitControllerAndExtensions=true&FleetAllocationOverflow=true&Example=true"
testCluster="gke-autopilot-e2e-test-cluster-${version//./-}"
fi
featureWithoutGate=""
Expand Down
4 changes: 1 addition & 3 deletions cmd/sdk-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,7 @@ func main() {
if err := s.WaitForConnection(ctx); err != nil {
logger.WithError(err).Fatalf("Sidecar networking failure")
}
if runtime.FeatureEnabled(runtime.FeatureSDKGracefulTermination) {
ctx = s.NewSDKServerContext(ctx)
}
ctx = s.NewSDKServerContext(ctx)
go func() {
err := s.Run(ctx)
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion install/helm/agones/defaultfeaturegates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
CustomFasSyncInterval: true
PodHostname: true
ResetMetricsOnDelete: true
SDKGracefulTermination: true
SplitControllerAndExtensions: true
StateAllocationFilter: true

Expand Down
4 changes: 2 additions & 2 deletions pkg/sdkserver/sdkserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ func (s *SDKServer) updateState(ctx context.Context) error {
s.logger.Debug("GameServerState being shutdown. Skipping update.")

// Explicitly update gsStateChannel if current state is Shutdown since sendGameServerUpdate will not triggered.
if runtime.FeatureEnabled(runtime.FeatureSDKGracefulTermination) && s.gsState == agonesv1.GameServerStateShutdown && gs.Status.State != agonesv1.GameServerStateShutdown {
if s.gsState == agonesv1.GameServerStateShutdown && gs.Status.State != agonesv1.GameServerStateShutdown {
go func() {
s.gsStateChannel <- agonesv1.GameServerStateShutdown
}()
Expand Down Expand Up @@ -840,7 +840,7 @@ func (s *SDKServer) sendGameServerUpdate(gs *agonesv1.GameServer) {
}
}

if runtime.FeatureEnabled(runtime.FeatureSDKGracefulTermination) && gs.Status.State == agonesv1.GameServerStateShutdown {
if gs.Status.State == agonesv1.GameServerStateShutdown {
// Wrap this in a go func(), just in case pushing to this channel deadlocks since there is only one instance of
// a receiver. In theory, This could leak goroutines a bit, but since we're shuttling down everything anyway,
// it shouldn't matter.
Expand Down
9 changes: 0 additions & 9 deletions pkg/sdkserver/sdkserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1362,9 +1362,6 @@ func TestSDKServerGracefulTerminationInterrupt(t *testing.T) {
agruntime.FeatureTestMutex.Lock()
defer agruntime.FeatureTestMutex.Unlock()

err := agruntime.ParseFeatures(string(agruntime.FeatureSDKGracefulTermination) + "=true")
require.NoError(t, err, "Can not parse FeatureSDKGracefulTermination feature")

m := agtesting.NewMocks()
fakeWatch := watch.NewFake()
m.AgonesClient.AddWatchReactor("gameservers", k8stesting.DefaultWatchReactor(fakeWatch, nil))
Expand Down Expand Up @@ -1430,9 +1427,6 @@ func TestSDKServerGracefulTerminationShutdown(t *testing.T) {
agruntime.FeatureTestMutex.Lock()
defer agruntime.FeatureTestMutex.Unlock()

err := agruntime.ParseFeatures(string(agruntime.FeatureSDKGracefulTermination) + "=true")
require.NoError(t, err, "Can not parse FeatureSDKGracefulTermination feature")

m := agtesting.NewMocks()
fakeWatch := watch.NewFake()
m.AgonesClient.AddWatchReactor("gameservers", k8stesting.DefaultWatchReactor(fakeWatch, nil))
Expand Down Expand Up @@ -1498,9 +1492,6 @@ func TestSDKServerGracefulTerminationGameServerStateChannel(t *testing.T) {
agruntime.FeatureTestMutex.Lock()
defer agruntime.FeatureTestMutex.Unlock()

err := agruntime.ParseFeatures(string(agruntime.FeatureSDKGracefulTermination) + "=true")
require.NoError(t, err, "Can not parse FeatureSDKGracefulTermination feature")

m := agtesting.NewMocks()
fakeWatch := watch.NewFake()
m.AgonesClient.AddWatchReactor("gameservers", k8stesting.DefaultWatchReactor(fakeWatch, nil))
Expand Down
4 changes: 0 additions & 4 deletions pkg/util/runtime/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ const (
// FeatureCustomFasSyncInterval is a feature flag that enables a custom FleetAutoscaler resync interval
FeatureCustomFasSyncInterval Feature = "CustomFasSyncInterval"

// FeatureSDKGracefulTermination is a feature flag that enables SDK to support gracefulTermination
FeatureSDKGracefulTermination Feature = "SDKGracefulTermination"

// FeatureSplitControllerAndExtensions is a feature flag that will split agones-controller into two deployments
FeatureSplitControllerAndExtensions Feature = "SplitControllerAndExtensions"

Expand Down Expand Up @@ -110,7 +107,6 @@ var (
FeatureCustomFasSyncInterval: true,
FeaturePodHostname: true,
FeatureResetMetricsOnDelete: true,
FeatureSDKGracefulTermination: true,
FeatureSplitControllerAndExtensions: true,
FeatureStateAllocationFilter: true,

Expand Down
4 changes: 2 additions & 2 deletions site/content/en/docs/Guides/Client SDKs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ from Kubernetes when the backing Pod goes into Termination state.
Be aware that if you use a variation of `System.exit(0)` after calling SDK.Shutdown(), your game server container may
restart for a brief period, inline with our [Health Checking]({{% ref "/docs/Guides/health-checking.md#health-failure-strategy" %}}) policies.

If the `SDKGracefulTermination` alpha feature is enabled, when the SDK server receives the TERM signal before calling SDK.Shutdown(),
the SDK server would stay alive for the period of the terminationGracePeriodSeconds until SDK.Shutdown() has been called
If the SDK server receives a TERM signal before calling SDK.Shutdown(),
the SDK server will stay alive for the period of the `terminationGracePeriodSeconds` until `SDK.Shutdown()` has been called.

### Configuration Retrieval

Expand Down
1 change: 0 additions & 1 deletion site/content/en/docs/Guides/feature-stages.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ The current set of `alpha` and `beta` feature gates:
| [Custom resync period for FleetAutoscaler](https://github.com/googleforgames/agones/issues/1955) | `CustomFasSyncInterval` | Enabled | `Beta` | 1.25.0 |
| [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 |
| [Graceful Termination for GameServer SDK](https://github.com/googleforgames/agones/pull/2205) | `SDKGracefulTermination` | Enabled | `Beta` | 1.18.0 |
| [Split `agones-controller` ](https://github.com/googleforgames/agones/issues/2797) | `SplitControllerAndExtensions` | Enabled | `Beta` | 1.32.0 |
| [GameServer state filtering on GameServerAllocations](https://github.com/googleforgames/agones/issues/1239) | `StateAllocationFilter` | Enabled | `Beta` | 1.26.0 |
| [GameServer player capacity filtering on GameServerAllocations](https://github.com/googleforgames/agones/issues/1239) | `PlayerAllocationFilter` | Disabled | `Alpha` | 1.14.0 |
Expand Down
2 changes: 1 addition & 1 deletion site/content/en/docs/Guides/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ For example:
$ kubectl logs -n agones-system agones-controller-7575dc59-7p2rg | head
{"filename":"/home/agones/logs/agones-controller-20220615_211540.log","message":"logging to file","numbackups":99,"severity":"info","source":"main","time":"2022-06-15T21:15:40.309349789Z"}
{"logLevel":"info","message":"Setting LogLevel configuration","severity":"info","source":"main","time":"2022-06-15T21:15:40.309403296Z"}
{"ctlConf":{"MinPort":7000,"MaxPort":8000,"SidecarImage":"gcr.io/agones-images/agones-sdk:1.23.0","SidecarCPURequest":"30m","SidecarCPULimit":"0","SidecarMemoryRequest":"0","SidecarMemoryLimit":"0","SdkServiceAccount":"agones-sdk","AlwaysPullSidecar":false,"PrometheusMetrics":true,"Stackdriver":false,"StackdriverLabels":"","KeyFile":"/home/agones/certs/server.key","CertFile":"/home/agones/certs/server.crt","KubeConfig":"","GCPProjectID":"","NumWorkers":100,"APIServerSustainedQPS":400,"APIServerBurstQPS":500,"LogDir":"/home/agones/logs","LogLevel":"info","LogSizeLimitMB":10000},"featureGates":"CustomFasSyncInterval=false\u0026Example=true\u0026NodeExternalDNS=true\u0026PlayerAllocationFilter=false\u0026PlayerTracking=false\u0026SDKGracefulTermination=false\u0026StateAllocationFilter=false","message":"starting gameServer operator...","severity":"info","source":"main","time":"2022-06-15T21:15:40.309528802Z","version":"1.23.0"}
{"ctlConf":{"MinPort":7000,"MaxPort":8000,"SidecarImage":"gcr.io/agones-images/agones-sdk:1.23.0","SidecarCPURequest":"30m","SidecarCPULimit":"0","SidecarMemoryRequest":"0","SidecarMemoryLimit":"0","SdkServiceAccount":"agones-sdk","AlwaysPullSidecar":false,"PrometheusMetrics":true,"Stackdriver":false,"StackdriverLabels":"","KeyFile":"/home/agones/certs/server.key","CertFile":"/home/agones/certs/server.crt","KubeConfig":"","GCPProjectID":"","NumWorkers":100,"APIServerSustainedQPS":400,"APIServerBurstQPS":500,"LogDir":"/home/agones/logs","LogLevel":"info","LogSizeLimitMB":10000},"featureGates":"CustomFasSyncInterval=false\u0026Example=true\u0026NodeExternalDNS=true\u0026PlayerAllocationFilter=false\u0026PlayerTracking=false\u0026StateAllocationFilter=false","message":"starting gameServer operator...","severity":"info","source":"main","time":"2022-06-15T21:15:40.309528802Z","version":"1.23.0"}
...
```

Expand Down
3 changes: 0 additions & 3 deletions test/e2e/gameserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1204,9 +1204,6 @@ func TestPlayerConnectAndDisconnect(t *testing.T) {
}

func TestGracefulShutdown(t *testing.T) {
if !runtime.FeatureEnabled(runtime.FeatureSDKGracefulTermination) {
t.SkipNow()
}
t.Parallel()

log := e2eframework.TestLogger(t)
Expand Down

0 comments on commit de35cdb

Please sign in to comment.