From 0fc353258cb9fa2e9636da0636548ef8d13eb48d Mon Sep 17 00:00:00 2001 From: Mark Mandel Date: Sat, 22 Apr 2023 04:27:56 -0700 Subject: [PATCH] Allocated GameServers updated on Fleet update (#3101) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Allocated GameServers updated on Fleet update Functional implementation and testing of applying labels and/or annotations to any `Allocated` `GameServers` that are overflowed past the configured replica count. Next ➡️ write some guides to close out the ticket. Work on #2682 * Review updates. --- examples/fleet.yaml | 11 + pkg/apis/agones/v1/fleet.go | 4 +- pkg/gameserversets/allocation_overflow.go | 162 + .../allocation_overflow_test.go | 203 + pkg/gameserversets/controller.go | 76 +- pkg/gameserversets/gameserversets.go | 23 + pkg/util/runtime/features.go | 12 +- site/content/en/docs/Guides/feature-stages.md | 1 + .../Reference/agones_crd_api_reference.html | 5908 +++++++++-------- site/content/en/docs/Reference/fleet.md | 15 + test/e2e/fleet_test.go | 97 + test/e2e/framework/framework.go | 24 + 12 files changed, 3650 insertions(+), 2886 deletions(-) create mode 100644 pkg/gameserversets/allocation_overflow.go create mode 100644 pkg/gameserversets/allocation_overflow_test.go diff --git a/examples/fleet.yaml b/examples/fleet.yaml index 8d3e5caa7a..85137185d7 100644 --- a/examples/fleet.yaml +++ b/examples/fleet.yaml @@ -50,6 +50,17 @@ spec: maxSurge: 25% # the amount to decrements GameServers by. Defaults to 25% maxUnavailable: 25% + # [Stage:Alpha] + # [FeatureFlag:FleetAllocationOverflow] + # Labels and/or Annotations to apply to overflowing GameServers when the number of Allocated GameServers is more + # than the desired replicas on the underlying `GameServerSet` + # Commented out since Alpha, and disabled by default + # allocationOverflow: + # labels: + # mykey: myvalue + # version: "" # empty an existing label value + # annotations: + # otherkey: setthisvalue template: # GameServer metadata metadata: diff --git a/pkg/apis/agones/v1/fleet.go b/pkg/apis/agones/v1/fleet.go index 0131fcf967..db06b7b635 100644 --- a/pkg/apis/agones/v1/fleet.go +++ b/pkg/apis/agones/v1/fleet.go @@ -62,8 +62,8 @@ type FleetSpec struct { Replicas int32 `json:"replicas"` // [Stage: Alpha] // [FeatureFlag:FleetAllocationOverflow] - // Labels and Annotations to apply to GameServers when the number of Allocated GameServers drops below - // the desired replicas on the underlying `GameServerSet` + // Labels and/or Annotations to apply to overflowing GameServers when the number of Allocated GameServers is more + // than the desired replicas on the underlying `GameServerSet` // +optional AllocationOverflow *AllocationOverflow `json:"allocationOverflow,omitempty"` // Deployment strategy diff --git a/pkg/gameserversets/allocation_overflow.go b/pkg/gameserversets/allocation_overflow.go new file mode 100644 index 0000000000..f4d9249507 --- /dev/null +++ b/pkg/gameserversets/allocation_overflow.go @@ -0,0 +1,162 @@ +// Copyright 2023 Google LLC All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package gameserversets + +import ( + "context" + "time" + + "agones.dev/agones/pkg/apis/agones" + agonesv1 "agones.dev/agones/pkg/apis/agones/v1" + "agones.dev/agones/pkg/client/clientset/versioned" + getterv1 "agones.dev/agones/pkg/client/clientset/versioned/typed/agones/v1" + "agones.dev/agones/pkg/client/informers/externalversions" + listerv1 "agones.dev/agones/pkg/client/listers/agones/v1" + "agones.dev/agones/pkg/gameservers" + "agones.dev/agones/pkg/util/logfields" + "agones.dev/agones/pkg/util/runtime" + "agones.dev/agones/pkg/util/workerqueue" + "github.com/heptiolabs/healthcheck" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + k8serrors "k8s.io/apimachinery/pkg/api/errors" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/cache" +) + +// AllocationOverflowController watches `GameServerSets`, and those with configured +// AllocationOverflow settings, will the relevant labels and annotations to `GameServers` attached to the given +// `GameServerSet` +type AllocationOverflowController struct { + baseLogger *logrus.Entry + counter *gameservers.PerNodeCounter + gameServerSynced cache.InformerSynced + gameServerGetter getterv1.GameServersGetter + gameServerLister listerv1.GameServerLister + gameServerSetSynced cache.InformerSynced + gameServerSetLister listerv1.GameServerSetLister + workerqueue *workerqueue.WorkerQueue +} + +// NewAllocatorOverflowController returns a new AllocationOverflowController +func NewAllocatorOverflowController( + health healthcheck.Handler, + counter *gameservers.PerNodeCounter, + agonesClient versioned.Interface, + agonesInformerFactory externalversions.SharedInformerFactory) *AllocationOverflowController { + gameServers := agonesInformerFactory.Agones().V1().GameServers() + gameServerSet := agonesInformerFactory.Agones().V1().GameServerSets() + gsSetInformer := gameServerSet.Informer() + + c := &AllocationOverflowController{ + counter: counter, + gameServerSynced: gameServers.Informer().HasSynced, + gameServerGetter: agonesClient.AgonesV1(), + gameServerLister: gameServers.Lister(), + gameServerSetSynced: gsSetInformer.HasSynced, + gameServerSetLister: gameServerSet.Lister(), + } + + c.baseLogger = runtime.NewLoggerWithType(c) + c.baseLogger.Debug("Created!") + c.workerqueue = workerqueue.NewWorkerQueueWithRateLimiter(c.syncGameServerSet, c.baseLogger, logfields.GameServerSetKey, agones.GroupName+".GameServerSetController", workerqueue.FastRateLimiter(3*time.Second)) + health.AddLivenessCheck("gameserverset-allocationoverflow-workerqueue", c.workerqueue.Healthy) + + gsSetInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ + UpdateFunc: func(oldObj, newObj interface{}) { + newGss := newObj.(*agonesv1.GameServerSet) + + // Only process if there is an AllocationOverflow, and it has labels or annotations. + if newGss.Spec.AllocationOverflow == nil { + return + } else if len(newGss.Spec.AllocationOverflow.Labels) == 0 && len(newGss.Spec.AllocationOverflow.Annotations) == 0 { + return + } + if newGss.Status.AllocatedReplicas > newGss.Spec.Replicas { + c.workerqueue.Enqueue(newGss) + } + }, + }) + + return c +} + +// Run this controller. Will block until stop is closed. +func (c *AllocationOverflowController) Run(ctx context.Context) error { + c.baseLogger.Debug("Wait for cache sync") + if !cache.WaitForCacheSync(ctx.Done(), c.gameServerSynced, c.gameServerSetSynced) { + return errors.New("failed to wait for caches to sync") + } + + c.workerqueue.Run(ctx, 1) + return nil +} + +// syncGameServerSet checks to see if there are overflow Allocated GameServers and applied the labels and/or +// annotations to the requisite number of GameServers needed to alert the underlying system. +func (c *AllocationOverflowController) syncGameServerSet(ctx context.Context, key string) error { + // Convert the namespace/name string into a distinct namespace and name + namespace, name, err := cache.SplitMetaNamespaceKey(key) + if err != nil { + // don't return an error, as we don't want this retried + runtime.HandleError(loggerForGameServerSetKey(c.baseLogger, key), errors.Wrapf(err, "invalid resource key")) + return nil + } + + gsSet, err := c.gameServerSetLister.GameServerSets(namespace).Get(name) + if err != nil { + if k8serrors.IsNotFound(err) { + loggerForGameServerSetKey(c.baseLogger, key).Debug("GameServerSet is no longer available for syncing") + return nil + } + return errors.Wrapf(err, "error retrieving GameServerSet %s from namespace %s", name, namespace) + } + + // just in case something changed, double check to avoid panics and/or sending work to the K8s API that we don't + // need to + if gsSet.Spec.AllocationOverflow == nil { + return nil + } + if gsSet.Status.AllocatedReplicas <= gsSet.Spec.Replicas { + return nil + } + + overflow := gsSet.Status.AllocatedReplicas - gsSet.Spec.Replicas + + list, err := ListGameServersByGameServerSetOwner(c.gameServerLister, gsSet) + if err != nil { + return err + } + + matches, rest := gsSet.Spec.AllocationOverflow.CountMatches(list) + if matches >= overflow { + return nil + } + + rest = sortGameServersByStrategy(gsSet.Spec.Scheduling, rest, c.counter.Counts()) + rest = rest[:(overflow - matches)] + + opts := v1.UpdateOptions{} + for _, gs := range rest { + gsCopy := gs.DeepCopy() + gsSet.Spec.AllocationOverflow.Apply(gsCopy) + + if _, err := c.gameServerGetter.GameServers(gs.ObjectMeta.Namespace).Update(ctx, gsCopy, opts); err != nil { + return errors.Wrapf(err, "error updating GameServer %s with overflow labels and/or annotations", gs.ObjectMeta.Name) + } + } + + return nil +} diff --git a/pkg/gameserversets/allocation_overflow_test.go b/pkg/gameserversets/allocation_overflow_test.go new file mode 100644 index 0000000000..ffde7cf8b8 --- /dev/null +++ b/pkg/gameserversets/allocation_overflow_test.go @@ -0,0 +1,203 @@ +// Copyright 2023 Google LLC All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package gameserversets + +import ( + "context" + "fmt" + "testing" + "time" + + agonesv1 "agones.dev/agones/pkg/apis/agones/v1" + "agones.dev/agones/pkg/gameservers" + agtesting "agones.dev/agones/pkg/testing" + "github.com/heptiolabs/healthcheck" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + k8stesting "k8s.io/client-go/testing" +) + +func TestAllocationOverflowControllerWatchGameServers(t *testing.T) { + t.Parallel() + + gsSet := defaultFixture() + gsSet.Status.Replicas = gsSet.Spec.Replicas + gsSet.Status.ReadyReplicas = gsSet.Spec.Replicas + c, m := newFakeAllocationOverflowController() + + received := make(chan string, 10) + defer close(received) + + gsSetWatch := watch.NewFake() + m.AgonesClient.AddWatchReactor("gameserversets", k8stesting.DefaultWatchReactor(gsSetWatch, nil)) + + c.workerqueue.SyncHandler = func(_ context.Context, name string) error { + received <- name + return nil + } + + ctx, cancel := agtesting.StartInformers(m, c.gameServerSetSynced) + defer cancel() + + go func() { + err := c.Run(ctx) + require.NoError(t, err) + }() + + change := func() string { + select { + case result := <-received: + return result + case <-time.After(3 * time.Second): + require.FailNow(t, "timeout occurred") + } + return "" + } + + nochange := func() { + select { + case <-received: + assert.Fail(t, "Should be no value") + case <-time.After(time.Second): + } + } + + gsSetWatch.Add(gsSet.DeepCopy()) + nochange() + + // update with no allocation overflow + require.Nil(t, gsSet.Spec.AllocationOverflow) + gsSet.Spec.Replicas++ + gsSetWatch.Modify(gsSet.DeepCopy()) + nochange() + + // update with no labels or annotations + gsSet.Spec.AllocationOverflow = &agonesv1.AllocationOverflow{} + gsSet.Spec.Replicas++ + gsSetWatch.Modify(gsSet.DeepCopy()) + nochange() + + // update with allocation <= replicas (and a label) + gsSet.Spec.AllocationOverflow.Labels = map[string]string{"colour": "green"} + gsSet.Status.AllocatedReplicas = 2 + gsSetWatch.Modify(gsSet.DeepCopy()) + nochange() + + // update with allocation > replicas + gsSet.Status.AllocatedReplicas = 20 + gsSetWatch.Modify(gsSet.DeepCopy()) + require.Equal(t, fmt.Sprintf("%s/%s", gsSet.ObjectMeta.Namespace, gsSet.ObjectMeta.Name), change()) + + // delete + gsSetWatch.Delete(gsSet.DeepCopy()) + nochange() +} + +func TestAllocationOverflowSyncGameServerSet(t *testing.T) { + t.Parallel() + + // setup fictures. + setup := func(gs func(server *agonesv1.GameServer)) (*agonesv1.GameServerSet, *AllocationOverflowController, agtesting.Mocks) { + gsSet := defaultFixture() + gsSet.Status.AllocatedReplicas = 5 + gsSet.Status.Replicas = 3 + gsSet.Spec.Replicas = 3 + gsSet.Spec.AllocationOverflow = &agonesv1.AllocationOverflow{Labels: map[string]string{"colour": "green"}} + list := createGameServers(gsSet, 5) + for i := range list { + list[i].Status.State = agonesv1.GameServerStateAllocated + gs(&list[i]) + } + + c, m := newFakeAllocationOverflowController() + m.AgonesClient.AddReactor("list", "gameserversets", func(action k8stesting.Action) (bool, runtime.Object, error) { + return true, &agonesv1.GameServerSetList{Items: []agonesv1.GameServerSet{*gsSet}}, nil + }) + m.AgonesClient.AddReactor("list", "gameservers", func(action k8stesting.Action) (bool, runtime.Object, error) { + return true, &agonesv1.GameServerList{Items: list}, nil + }) + return gsSet, c, m + } + + // run the sync process + run := func(c *AllocationOverflowController, m agtesting.Mocks, gsSet *agonesv1.GameServerSet, update func(action k8stesting.Action) (bool, runtime.Object, error)) func() { + m.AgonesClient.AddReactor("update", "gameservers", update) + ctx, cancel := agtesting.StartInformers(m, c.gameServerSetSynced, c.gameServerSynced) + err := c.syncGameServerSet(ctx, gsSet.ObjectMeta.Namespace+"/"+gsSet.ObjectMeta.Name) + require.NoError(t, err) + return cancel + } + + t.Run("labels are applied", func(t *testing.T) { + gsSet, c, m := setup(func(_ *agonesv1.GameServer) {}) + count := 0 + cancel := run(c, m, gsSet, func(action k8stesting.Action) (bool, runtime.Object, error) { + ua := action.(k8stesting.UpdateAction) + gs := ua.GetObject().(*agonesv1.GameServer) + require.Equal(t, gs.Status.State, agonesv1.GameServerStateAllocated) + require.Equal(t, "green", gs.ObjectMeta.Labels["colour"]) + + count++ + return true, nil, nil + }) + defer cancel() + require.Equal(t, 2, count) + }) + + t.Run("Labels are already set", func(t *testing.T) { + gsSet, c, m := setup(func(gs *agonesv1.GameServer) { + gs.ObjectMeta.Labels["colour"] = "green" + }) + cancel := run(c, m, gsSet, func(action k8stesting.Action) (bool, runtime.Object, error) { + require.Fail(t, "should not update") + return true, nil, nil + }) + defer cancel() + }) + + t.Run("one label is set", func(t *testing.T) { + set := false + gsSet, c, m := setup(func(gs *agonesv1.GameServer) { + // just make one as already set + if !set { + gs.ObjectMeta.Labels["colour"] = "green" + set = true + } + }) + + count := 0 + cancel := run(c, m, gsSet, func(action k8stesting.Action) (bool, runtime.Object, error) { + ua := action.(k8stesting.UpdateAction) + gs := ua.GetObject().(*agonesv1.GameServer) + require.Equal(t, gs.Status.State, agonesv1.GameServerStateAllocated) + require.Equal(t, "green", gs.ObjectMeta.Labels["colour"]) + + count++ + return true, nil, nil + }) + defer cancel() + require.Equal(t, 1, count) + }) +} + +// newFakeAllocationOverflowController returns a controller, backed by the fake Clientset +func newFakeAllocationOverflowController() (*AllocationOverflowController, agtesting.Mocks) { + m := agtesting.NewMocks() + counter := gameservers.NewPerNodeCounter(m.KubeInformerFactory, m.AgonesInformerFactory) + c := NewAllocatorOverflowController(healthcheck.NewHandler(), counter, m.AgonesClient, m.AgonesInformerFactory) + return c, m +} diff --git a/pkg/gameserversets/controller.go b/pkg/gameserversets/controller.go index 37314cde99..52cf100899 100644 --- a/pkg/gameserversets/controller.go +++ b/pkg/gameserversets/controller.go @@ -72,20 +72,21 @@ type Extensions struct { apiHooks agonesv1.APIHooks } -// Controller is a the GameServerSet controller +// Controller is a GameServerSet controller type Controller struct { - baseLogger *logrus.Entry - counter *gameservers.PerNodeCounter - crdGetter apiextclientv1.CustomResourceDefinitionInterface - gameServerGetter getterv1.GameServersGetter - gameServerLister listerv1.GameServerLister - gameServerSynced cache.InformerSynced - gameServerSetGetter getterv1.GameServerSetsGetter - gameServerSetLister listerv1.GameServerSetLister - gameServerSetSynced cache.InformerSynced - workerqueue *workerqueue.WorkerQueue - recorder record.EventRecorder - stateCache *gameServerStateCache + baseLogger *logrus.Entry + counter *gameservers.PerNodeCounter + crdGetter apiextclientv1.CustomResourceDefinitionInterface + gameServerGetter getterv1.GameServersGetter + gameServerLister listerv1.GameServerLister + gameServerSynced cache.InformerSynced + gameServerSetGetter getterv1.GameServerSetsGetter + gameServerSetLister listerv1.GameServerSetLister + gameServerSetSynced cache.InformerSynced + workerqueue *workerqueue.WorkerQueue + recorder record.EventRecorder + stateCache *gameServerStateCache + allocationController *AllocationOverflowController } // NewController returns a new gameserverset crd controller @@ -123,6 +124,10 @@ func NewController( eventBroadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")}) c.recorder = eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: "gameserverset-controller"}) + if runtime.FeatureEnabled(runtime.FeatureFleetAllocateOverflow) { + c.allocationController = NewAllocatorOverflowController(health, counter, agonesClient, agonesInformerFactory) + } + gsSetInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: c.workerqueue.Enqueue, UpdateFunc: func(oldObj, newObj interface{}) { @@ -178,6 +183,14 @@ func (c *Controller) Run(ctx context.Context, workers int) error { return errors.New("failed to wait for caches to sync") } + if runtime.FeatureEnabled(runtime.FeatureFleetAllocateOverflow) { + go func() { + if err := c.allocationController.Run(ctx); err != nil { + c.baseLogger.WithError(err).Error("error running allocation overflow controller") + } + }() + } + c.workerqueue.Run(ctx, workers) return nil } @@ -216,7 +229,7 @@ func (ext *Extensions) updateValidationHandler(review admissionv1.AdmissionRevie Details: &details, } - loggerForGameServerSet(newGss, ext.baseLogger).WithField("review", review).Debug("Invalid GameServerSet update") + loggerForGameServerSet(ext.baseLogger, newGss).WithField("review", review).Debug("Invalid GameServerSet update") return review, nil } @@ -251,7 +264,7 @@ func (ext *Extensions) creationValidationHandler(review admissionv1.AdmissionRev Details: &details, } - loggerForGameServerSet(newGss, ext.baseLogger).WithField("review", review).Debug("Invalid GameServerSet update") + loggerForGameServerSet(ext.baseLogger, newGss).WithField("review", review).Debug("Invalid GameServerSet update") return review, nil } return review, nil @@ -280,18 +293,6 @@ func (c *Controller) gameServerEventHandler(obj interface{}) { c.workerqueue.EnqueueImmediately(gsSet) } -func loggerForGameServerSetKey(key string, logger *logrus.Entry) *logrus.Entry { - return logfields.AugmentLogEntry(logger, logfields.GameServerSetKey, key) -} - -func loggerForGameServerSet(gsSet *agonesv1.GameServerSet, logger *logrus.Entry) *logrus.Entry { - gsSetName := "NilGameServerSet" - if gsSet != nil { - gsSetName = gsSet.Namespace + "/" + gsSet.Name - } - return loggerForGameServerSetKey(gsSetName, logger).WithField("gss", gsSet) -} - // syncGameServer synchronises the GameServers for the Set, // making sure there are aways as many GameServers as requested func (c *Controller) syncGameServerSet(ctx context.Context, key string) error { @@ -299,14 +300,14 @@ func (c *Controller) syncGameServerSet(ctx context.Context, key string) error { namespace, name, err := cache.SplitMetaNamespaceKey(key) if err != nil { // don't return an error, as we don't want this retried - runtime.HandleError(loggerForGameServerSetKey(key, c.baseLogger), errors.Wrapf(err, "invalid resource key")) + runtime.HandleError(loggerForGameServerSetKey(c.baseLogger, key), errors.Wrapf(err, "invalid resource key")) return nil } gsSet, err := c.gameServerSetLister.GameServerSets(namespace).Get(name) if err != nil { if k8serrors.IsNotFound(err) { - loggerForGameServerSetKey(key, c.baseLogger).Debug("GameServerSet is no longer available for syncing") + loggerForGameServerSetKey(c.baseLogger, key).Debug("GameServerSet is no longer available for syncing") return nil } return errors.Wrapf(err, "error retrieving GameServerSet %s from namespace %s", name, namespace) @@ -342,7 +343,7 @@ func (c *Controller) syncGameServerSet(ctx context.Context, key string) error { fields[key] = v.(int) + 1 } - loggerForGameServerSet(gsSet, c.baseLogger). + loggerForGameServerSet(c.baseLogger, gsSet). WithField("targetReplicaCount", gsSet.Spec.Replicas). WithField("numServersToAdd", numServersToAdd). WithField("numServersToDelete", len(toDelete)). @@ -359,13 +360,13 @@ func (c *Controller) syncGameServerSet(ctx context.Context, key string) error { if numServersToAdd > 0 { if err := c.addMoreGameServers(ctx, gsSet, numServersToAdd); err != nil { - loggerForGameServerSet(gsSet, c.baseLogger).WithError(err).Warning("error adding game servers") + loggerForGameServerSet(c.baseLogger, gsSet).WithError(err).Warning("error adding game servers") } } if len(toDelete) > 0 { if err := c.deleteGameServers(ctx, gsSet, toDelete); err != nil { - loggerForGameServerSet(gsSet, c.baseLogger).WithError(err).Warning("error deleting game servers") + loggerForGameServerSet(c.baseLogger, gsSet).WithError(err).Warning("error deleting game servers") } } @@ -476,12 +477,7 @@ func computeReconciliationAction(strategy apis.SchedulingStrategy, list []*agone } if deleteCount > 0 { - if strategy == apis.Packed { - potentialDeletions = sortGameServersByLeastFullNodes(potentialDeletions, counts) - } else { - potentialDeletions = sortGameServersByNewFirst(potentialDeletions) - } - + potentialDeletions = sortGameServersByStrategy(strategy, potentialDeletions, counts) toDelete = append(toDelete, potentialDeletions[0:deleteCount]...) } @@ -495,7 +491,7 @@ func computeReconciliationAction(strategy apis.SchedulingStrategy, list []*agone // addMoreGameServers adds diff more GameServers to the set func (c *Controller) addMoreGameServers(ctx context.Context, gsSet *agonesv1.GameServerSet, count int) error { - loggerForGameServerSet(gsSet, c.baseLogger).WithField("count", count).Debug("Adding more gameservers") + loggerForGameServerSet(c.baseLogger, gsSet).WithField("count", count).Debug("Adding more gameservers") return parallelize(newGameServersChannel(count, gsSet), maxCreationParalellism, func(gs *agonesv1.GameServer) error { gs, err := c.gameServerGetter.GameServers(gs.Namespace).Create(ctx, gs, metav1.CreateOptions{}) @@ -510,7 +506,7 @@ func (c *Controller) addMoreGameServers(ctx context.Context, gsSet *agonesv1.Gam } func (c *Controller) deleteGameServers(ctx context.Context, gsSet *agonesv1.GameServerSet, toDelete []*agonesv1.GameServer) error { - loggerForGameServerSet(gsSet, c.baseLogger).WithField("diff", len(toDelete)).Debug("Deleting gameservers") + loggerForGameServerSet(c.baseLogger, gsSet).WithField("diff", len(toDelete)).Debug("Deleting gameservers") return parallelize(gameServerListToChannel(toDelete), maxDeletionParallelism, func(gs *agonesv1.GameServer) error { // We should not delete the gameservers directly buy set their state to shutdown and let the gameserver controller to delete diff --git a/pkg/gameserversets/gameserversets.go b/pkg/gameserversets/gameserversets.go index 3d4eef24a2..03fd8c1e24 100644 --- a/pkg/gameserversets/gameserversets.go +++ b/pkg/gameserversets/gameserversets.go @@ -17,14 +17,37 @@ package gameserversets import ( "sort" + "agones.dev/agones/pkg/apis" agonesv1 "agones.dev/agones/pkg/apis/agones/v1" listerv1 "agones.dev/agones/pkg/client/listers/agones/v1" "agones.dev/agones/pkg/gameservers" + "agones.dev/agones/pkg/util/logfields" "github.com/pkg/errors" + "github.com/sirupsen/logrus" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" ) +func loggerForGameServerSetKey(log *logrus.Entry, key string) *logrus.Entry { + return logfields.AugmentLogEntry(log, logfields.GameServerSetKey, key) +} + +func loggerForGameServerSet(log *logrus.Entry, gsSet *agonesv1.GameServerSet) *logrus.Entry { + gsSetName := "NilGameServerSet" + if gsSet != nil { + gsSetName = gsSet.Namespace + "/" + gsSet.Name + } + return loggerForGameServerSetKey(log, gsSetName).WithField("gss", gsSet) +} + +// sortGameServersByStrategy will sort by least full nodes when Packed, and newest first when Distributed +func sortGameServersByStrategy(strategy apis.SchedulingStrategy, list []*agonesv1.GameServer, counts map[string]gameservers.NodeCount) []*agonesv1.GameServer { + if strategy == apis.Packed { + return sortGameServersByLeastFullNodes(list, counts) + } + return sortGameServersByNewFirst(list) +} + // sortGameServersByLeastFullNodes sorts the list of gameservers by which gameservers reside on the least full nodes func sortGameServersByLeastFullNodes(list []*agonesv1.GameServer, count map[string]gameservers.NodeCount) []*agonesv1.GameServer { sort.Slice(list, func(i, j int) bool { diff --git a/pkg/util/runtime/features.go b/pkg/util/runtime/features.go index 7a5d09baef..cdee73cbe3 100644 --- a/pkg/util/runtime/features.go +++ b/pkg/util/runtime/features.go @@ -60,16 +60,16 @@ const ( // FeaturePodHostname enables the Pod Hostname being assigned the name of the GameServer FeaturePodHostname = "PodHostname" + // FeatureFleetAllocateOverflow enables setting labels and/or annotations on Allocated GameServers + // if the desired number of the underlying GameServerSet drops below the number of Allocated GameServers. + FeatureFleetAllocateOverflow = "FleetAllocationOverflow" + // FeatureSplitControllerAndExtensions is a feature flag that will split agones-controller into two deployments FeatureSplitControllerAndExtensions = "SplitControllerAndExtensions" //////////////// // "Pre"-Alpha features - // FeatureFleetAllocateOverflow enables setting labels and/or annotations on Allocated GameServers - // if the desired number of the underlying GameServerSet drops below the number of Allocated GameServers - FeatureFleetAllocateOverflow = "FleetAllocationOverflow" - // FeatureCountsAndLists is a feature flag that enables/disables counts and lists feature // (a generic implenetation of the player tracking feature). FeatureCountsAndLists Feature = "CountsAndLists" @@ -119,11 +119,11 @@ var ( FeaturePlayerTracking: false, FeatureResetMetricsOnDelete: false, FeaturePodHostname: false, + FeatureFleetAllocateOverflow: false, FeatureSplitControllerAndExtensions: false, // Pre-Alpha features - FeatureCountsAndLists: false, - FeatureFleetAllocateOverflow: false, + FeatureCountsAndLists: false, // Example feature FeatureExample: false, diff --git a/site/content/en/docs/Guides/feature-stages.md b/site/content/en/docs/Guides/feature-stages.md index 3b10feeb78..898fab158f 100644 --- a/site/content/en/docs/Guides/feature-stages.md +++ b/site/content/en/docs/Guides/feature-stages.md @@ -35,6 +35,7 @@ The current set of `alpha` and `beta` feature gates: | [Reset Metric Export on Fleet / Autoscaler deletion]({{% relref "./metrics.md#dropping-metric-labels" %}}) | `ResetMetricsOnDelete` | Disabled | `Alpha` | 1.26.0 | | [GameServer Stable Network ID]({{% ref "/docs/Reference/gameserver.md#stable-network-id" %}}) | `PodHostname` | Disabled | `Alpha` | 1.29.0 | | [Split `agones-controller` ](https://github.com/googleforgames/agones/issues/2797) | `SplitControllerAndExtensions` | Disabled | `Alpha` | 1.30.0 | +| [Allocated GameServers are notified on relevant Fleet Updates](https://github.com/googleforgames/agones/issues/2682) | `FleetAllocationOverflow` | Disabled | `Alpha` | 1.30.0 | | Example Gate (not in use) | `Example` | Disabled | None | 0.13.0 | {{< alert title="Note" color="info" >}} diff --git a/site/content/en/docs/Reference/agones_crd_api_reference.html b/site/content/en/docs/Reference/agones_crd_api_reference.html index 90f901a071..45c685a2f2 100644 --- a/site/content/en/docs/Reference/agones_crd_api_reference.html +++ b/site/content/en/docs/Reference/agones_crd_api_reference.html @@ -3,13 +3,10 @@ description="Detailed list of Agones Custom Resource Definitions available" +++ -{{% feature expiryVersion="1.31.0" %}} +{{% feature expiryVersion="1.32.0" %}}

Packages:

-

agones.dev/v1

+

allocation.agones.dev/v1

Package v1 is the v1 version of the API.

Resource Types: -

Fleet +

GameServerAllocation

-

Fleet is the data structure for a Fleet resource

+

GameServerAllocation is the data structure for allocating against a set of +GameServers, defined selectors selectors

@@ -50,7 +47,7 @@

Fleet string

@@ -59,13 +56,13 @@

Fleet kind
string -

+ @@ -90,43 +87,82 @@

Fleet

-agones.dev/v1 +allocation.agones.dev/v1
FleetGameServerAllocation
metadata
- + Kubernetes meta/v1.ObjectMeta @@ -79,8 +76,8 @@

Fleet

spec
- -FleetSpec + +GameServerAllocationSpec
+ + + + + + + + @@ -142,15 +178,16 @@

Fleet

-replicas
+multiClusterSetting
-int32 + +MultiClusterSetting +
-

Replicas are the number of GameServers that should be in this set. Defaults to 0.

+

MultiClusterPolicySelector if specified, multi-cluster policies are applied. +Otherwise, allocation will happen locally.

-allocationOverflow
+required
- -AllocationOverflow + +GameServerSelector + + +
+

Deprecated: use field Selectors instead. If Selectors is set, this field is ignored. +Required is the GameServer selector from which to choose GameServers from. +Defaults to all GameServers.

+
+preferred
+ + +[]GameServerSelector + + +
+

Deprecated: use field Selectors instead. If Selectors is set, this field is ignored. +Preferred is an ordered list of preferred GameServer selectors +that are optional to be fulfilled, but will be searched before the required selector. +If the first selector is not matched, the selection attempts the second selector, and so on. +If any of the preferred selectors are matched, the required selector is not considered. +This is useful for things like smoke testing of new game servers.

+
+priorities
+ + +[]Priority
(Optional) -

[Stage: Alpha] -[FeatureFlag:FleetAllocationOverflow] -Labels and Annotations to apply to GameServers when the number of Allocated GameServers drops below -the desired replicas on the underlying GameServerSet

+

(Alpha, CountsAndLists feature flag) The first Priority on the array of Priorities is the most +important for sorting. The allocator will use the first priority for sorting GameServers in the +Selector set, and will only use any following priority for tie-breaking during sort. +Impacts which GameServer is checked first.

-strategy
+selectors
- -Kubernetes apps/v1.DeploymentStrategy + +[]GameServerSelector
-

Deployment strategy

+

Ordered list of GameServer label selectors. +If the first selector is not matched, the selection attempts the second selector, and so on. +This is useful for things like smoke testing of new game servers. +Note: This field can only be set if neither Required or Preferred is set.

-template
+metadata
- -GameServerTemplateSpec + +MetaPatch
-

Template the GameServer template to apply for this Fleet

+

MetaPatch is optional custom metadata that is added to the game server at allocation +You can use this to tell the server necessary session data

@@ -160,8 +197,8 @@

Fleet status
- -FleetStatus + +GameServerAllocationStatus @@ -170,14 +207,15 @@

Fleet -

GameServer +

CounterSelector

-

GameServer is the data structure for a GameServer resource. -It is worth noting that while there is a GameServerStatus Status entry for the GameServer, it is not -defined as a subresource - unlike Fleet and other Agones resources. -This is so that we can retain the ability to change multiple aspects of a GameServer in a single atomic operation, -which is particularly useful for operations such as allocation.

+(Appears on: +GameServerSelector) +

+

+

CounterSelector is the filter options for a GameServer based on the count and/or available capacity. +0 for MaxCount or MaxAvailable means unlimited maximum. Default for all fields: 0

@@ -189,331 +227,379 @@

GameServer

- - - - - -
-apiVersion
-string
- -agones.dev/v1 - +minCount
+ +int64 +
-kind
-string
GameServer
-metadata
+maxCount
- -Kubernetes meta/v1.ObjectMeta - +int64
-Refer to the Kubernetes API documentation for the fields of the -metadata field.
-spec
+minAvailable
- -GameServerSpec - +int64
-
-
- + + + +
-container
+maxAvailable
-string +int64
-

Container specifies which Pod container is the game server. Only required if there is more than one -container defined

+

GameServerAllocationSpec +

+

+(Appears on: +GameServerAllocation) +

+

+

GameServerAllocationSpec is the spec for a GameServerAllocation

+

+ + + + + + + + - - +
FieldDescription
-ports
+multiClusterSetting
- -[]GameServerPort + +MultiClusterSetting
-

Ports are the array of ports that can be exposed via the game server

+

MultiClusterPolicySelector if specified, multi-cluster policies are applied. +Otherwise, allocation will happen locally.

-health
+required
- -Health + +GameServerSelector
-

Health configures health checking

+

Deprecated: use field Selectors instead. If Selectors is set, this field is ignored. +Required is the GameServer selector from which to choose GameServers from. +Defaults to all GameServers.

-scheduling
+preferred
-agones.dev/agones/pkg/apis.SchedulingStrategy + +[]GameServerSelector +
-

Scheduling strategy. Defaults to “Packed”

+

Deprecated: use field Selectors instead. If Selectors is set, this field is ignored. +Preferred is an ordered list of preferred GameServer selectors +that are optional to be fulfilled, but will be searched before the required selector. +If the first selector is not matched, the selection attempts the second selector, and so on. +If any of the preferred selectors are matched, the required selector is not considered. +This is useful for things like smoke testing of new game servers.

-sdkServer
+priorities
- -SdkServer + +[]Priority
-

SdkServer specifies parameters for the Agones SDK Server sidecar container

+(Optional) +

(Alpha, CountsAndLists feature flag) The first Priority on the array of Priorities is the most +important for sorting. The allocator will use the first priority for sorting GameServers in the +Selector set, and will only use any following priority for tie-breaking during sort. +Impacts which GameServer is checked first.

-template
+selectors
- -Kubernetes core/v1.PodTemplateSpec + +[]GameServerSelector
-

Template describes the Pod that will be created for the GameServer

+

Ordered list of GameServer label selectors. +If the first selector is not matched, the selection attempts the second selector, and so on. +This is useful for things like smoke testing of new game servers. +Note: This field can only be set if neither Required or Preferred is set.

-players
+scheduling
- -PlayersSpec - +agones.dev/agones/pkg/apis.SchedulingStrategy
-(Optional) -

(Alpha, PlayerTracking feature flag) Players provides the configuration for player tracking features.

+

Scheduling strategy. Defaults to “Packed”.

-counters
+metadata
- -map[string]agones.dev/agones/pkg/apis/agones/v1.CounterStatus + +MetaPatch
-(Optional) -

(Alpha, CountsAndLists feature flag) Counters and Lists provides the configuration for generic tracking features.

+

MetaPatch is optional custom metadata that is added to the game server at allocation +You can use this to tell the server necessary session data

-lists
- - -map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus +
+

GameServerAllocationState +(string alias)

+

+(Appears on: +GameServerAllocationStatus) +

+

+

GameServerAllocationState is the Allocation state

+

+

GameServerAllocationStatus +

+

+(Appears on: +GameServerAllocation) +

+

+

GameServerAllocationStatus is the status for an GameServerAllocation resource

+

+ + + + + + + + + + - -
FieldDescription
+state
+ + +GameServerAllocationState
+

GameServerState is the current state of an GameServerAllocation, e.g. Allocated, or UnAllocated

-eviction
+gameServerName
- -Eviction - +string
-(Optional) -

(Alpha, SafeToEvict feature flag) Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

-
-status
+ports
- -GameServerStatus + +[]GameServerStatusPort
-

GameServerSet -

-

-

GameServerSet is the data structure for a set of GameServers. -This matches philosophically with the relationship between -Deployments and ReplicaSets

-

- - - - - - - - - - - - + + +
FieldDescription
-apiVersion
-string
- -agones.dev/v1 - +address
+ +string +
-kind
-string
GameServerSet
-metadata
+nodeName
- -Kubernetes meta/v1.ObjectMeta - +string
-Refer to the Kubernetes API documentation for the fields of the -metadata field.
-spec
+source
- -GameServerSetSpec - +string
-
-
+

If the allocation is from a remote cluster, Source is the endpoint of the remote agones-allocator. +Otherwise, Source is “local”

+
+

GameServerSelector +

+

+(Appears on: +GameServerAllocationSpec) +

+

+

GameServerSelector contains all the filter options for selecting +a GameServer for allocation.

+

+ + + + + + + - -
FieldDescription
-replicas
+LabelSelector
-int32 + +Kubernetes meta/v1.LabelSelector +
-

Replicas are the number of GameServers that should be in this set

+

+(Members of LabelSelector are embedded into this type.) +

+

See: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/

-allocationOverflow
+gameServerState
- -AllocationOverflow + +GameServerState
(Optional) -

[Stage: Alpha] -[FeatureFlag:FleetAllocationOverflow] -Labels and Annotations to apply to GameServers when the number of Allocated GameServers drops below -the desired replicas on the underlying GameServerSet

+

[Stage:Beta] +[FeatureFlag:StateAllocationFilter] +GameServerState specifies which State is the filter to be used when attempting to retrieve a GameServer +via Allocation. Defaults to “Ready”. The only other option is “Allocated”, which can be used in conjunction with +label/annotation/player selectors to retrieve an already Allocated GameServer.

-scheduling
+players
-agones.dev/agones/pkg/apis.SchedulingStrategy + +PlayerSelector +
-

Scheduling strategy. Defaults to “Packed”.

+(Optional) +

[Stage:Alpha] +[FeatureFlag:PlayerAllocationFilter] +Players provides a filter on minimum and maximum values for player capacity when retrieving a GameServer +through Allocation. Defaults to no limits.

-template
+counters
- -GameServerTemplateSpec + +map[string]agones.dev/agones/pkg/apis/allocation/v1.CounterSelector
-

Template the GameServer template to apply for this GameServerSet

-
+(Optional) +

(Alpha, CountsAndLists feature flag) Counters provides filters on minimum and maximum values +for a Counter’s count and available capacity when retrieving a GameServer through Allocation. +Defaults to no limits.

-status
+lists
- -GameServerSetStatus + +map[string]agones.dev/agones/pkg/apis/allocation/v1.ListSelector +(Optional) +

(Alpha, CountsAndLists feature flag) Lists provides filters on minimum and maximum values +for List capacity, and for the existence of a value in a List, when retrieving a GameServer +through Allocation. Defaults to no limits.

-

AggregatedPlayerStatus +

ListSelector

(Appears on: -FleetStatus, -GameServerSetStatus) +GameServerSelector)

-

AggregatedPlayerStatus stores total player tracking values

+

ListSelector is the filter options for a GameServer based on List available capacity and/or the +existence of a value in a List. +0 for MaxAvailable means unlimited maximum. Default for integer fields: 0 +“” for ContainsValue means ignore field. Default for string field: “”

@@ -525,7 +611,17 @@

AggregatedPlayerStatus

+ + + +
-count
+containsValue
+ +string + +
+
+minAvailable
int64 @@ -535,7 +631,7 @@

AggregatedPlayerStatus

-capacity
+maxAvailable
int64 @@ -545,17 +641,14 @@

AggregatedPlayerStatus

-

AllocationOverflow +

MetaPatch

(Appears on: -FleetSpec, -GameServerSetSpec) +GameServerAllocationSpec)

-

AllocationOverflow specifies what labels and/or annotations to apply on Allocated GameServers -if the desired number of the underlying GameServerSet drops below the number of Allocated GameServers -attached to it.

+

MetaPatch is the metadata used to patch the GameServer metadata on allocation

@@ -573,8 +666,6 @@

AllocationOverflow

@@ -585,21 +676,18 @@

AllocationOverflow

-(Optional) -

Labels to be applied to the GameServer

-(Optional) -

Annotations to be applied to the GameServer

-

CounterStatus +

MultiClusterSetting

(Appears on: -GameServerSpec, -GameServerStatus) +GameServerAllocationSpec)

-

CounterStatus stores the current counter values

+

MultiClusterSetting specifies settings for multi-cluster allocation.

@@ -611,9 +699,9 @@

CounterStatus

-count
+enabled
-int64 +bool
@@ -621,9 +709,11 @@

CounterStatus

-capacity
+policySelector
-int64 + +Kubernetes meta/v1.LabelSelector +
@@ -631,15 +721,14 @@

CounterStatus

-

Eviction +

PlayerSelector

(Appears on: -GameServerSpec, -GameServerStatus) +GameServerSelector)

-

Eviction specifies the eviction tolerance of the GameServer

+

PlayerSelector is the filter options for a GameServer based on player counts

@@ -651,40 +740,39 @@

Eviction

+ + + +
-safe
+minAvailable
- -EvictionSafe - +int64 + +
+
+maxAvailable
+ +int64
-

(Alpha, SafeToEvict feature flag) -Game server supports termination via SIGTERM: -- Always: Allow eviction for both Cluster Autoscaler and node drain for upgrades -- OnUpgrade: Allow eviction for upgrades alone -- Never (default): Pod should run to completion

-

EvictionSafe -(string alias)

-

-(Appears on: -Eviction) -

-

-

EvictionSafe specified whether the game server supports termination via SIGTERM

-

-

FleetSpec +

Priority

(Appears on: -Fleet) +GameServerAllocationSpec)

-

FleetSpec is the spec for a Fleet

+

Priority is a sorting option for GameServers with Counters or Lists based on the count or +number of items in a List. +PriorityType: Sort by a “Counter” or a “List”. +Key: The name of the Counter or List. If not found on the GameServer, has no impact. +Order: Sort by “Ascending” or “Descending”. Default is “Descending” so bigger count is preferred. +“Ascending” would be smaller count is preferred.

@@ -696,80 +784,49 @@

FleetSpec

- - - - - - - -
-replicas
- -int32 - -
-

Replicas are the number of GameServers that should be in this set. Defaults to 0.

-
-allocationOverflow
- - -AllocationOverflow - - -
-(Optional) -

[Stage: Alpha] -[FeatureFlag:FleetAllocationOverflow] -Labels and Annotations to apply to GameServers when the number of Allocated GameServers drops below -the desired replicas on the underlying GameServerSet

-
-strategy
+priorityType
- -Kubernetes apps/v1.DeploymentStrategy - +string
-

Deployment strategy

-scheduling
+key
-agones.dev/agones/pkg/apis.SchedulingStrategy +string
-

Scheduling strategy. Defaults to “Packed”.

-template
+order
- -GameServerTemplateSpec - +string
-

Template the GameServer template to apply for this Fleet

-

FleetStatus -

+
+

autoscaling.agones.dev/v1

-(Appears on: -Fleet, -FleetAutoscaleRequest) +

Package v1 is the v1 version of the API.

+Resource Types: + +

FleetAutoscaler +

-

FleetStatus is the status of a Fleet

+

FleetAutoscaler is the data structure for a FleetAutoscaler resource

@@ -781,76 +838,112 @@

FleetStatus

+ + + + + + + + +
-replicas
+apiVersion
+string
+ +autoscaling.agones.dev/v1 + +
+kind
+string +
FleetAutoscaler
+metadata
-int32 + +Kubernetes meta/v1.ObjectMeta +
-

Replicas the total number of current GameServer replicas

+Refer to the Kubernetes API documentation for the fields of the +metadata field.
-readyReplicas
+spec
-int32 + +FleetAutoscalerSpec + + +
+
+
+ + + + +
+fleetName
+ +string
-

ReadyReplicas are the number of Ready GameServer replicas

-reservedReplicas
+policy
-int32 + +FleetAutoscalerPolicy +
-

ReservedReplicas are the total number of Reserved GameServer replicas in this fleet. -Reserved instances won’t be deleted on scale down, but won’t cause an autoscaler to scale up.

+

Autoscaling policy

-allocatedReplicas
+sync
-int32 + +FleetAutoscalerSync +
-

AllocatedReplicas are the number of Allocated GameServer replicas

+(Optional) +

[Stage:Beta] +[FeatureFlag:CustomFasSyncInterval] +Sync defines when FleetAutoscalers runs autoscaling

+
-players
+status
- -AggregatedPlayerStatus + +FleetAutoscalerStatus
-(Optional) -

[Stage:Alpha] -[FeatureFlag:PlayerTracking] -Players are the current total player capacity and count for this Fleet

-

GameServerPort +

BufferPolicy

(Appears on: -GameServerSpec) +FleetAutoscalerPolicy)

-

GameServerPort defines a set of Ports that -are to be exposed via the GameServer

+

BufferPolicy controls the desired behavior of the buffer policy.

@@ -862,89 +955,59 @@

GameServerPort

- - - - - - - - - - - -
-name
- -string - -
-

Name is the descriptive name of the port

-
-portPolicy
- - -PortPolicy - - -
-

PortPolicy defines the policy for how the HostPort is populated. -Dynamic port will allocate a HostPort within the selected MIN_PORT and MAX_PORT range passed to the controller -at installation time. -When Static portPolicy is specified, HostPort is required, to specify the port that game clients will -connect to

-
-container
- -string - -
-(Optional) -

Container is the name of the container on which to open the port. Defaults to the game server container.

-
-containerPort
+maxReplicas
int32
-

ContainerPort is the port that is being opened on the specified container’s process

+

MaxReplicas is the maximum amount of replicas that the fleet may have. +It must be bigger than both MinReplicas and BufferSize

-hostPort
+minReplicas
int32
-

HostPort the port exposed on the host for clients to connect to

+

MinReplicas is the minimum amount of replicas that the fleet must have +If zero, it is ignored. +If non zero, it must be smaller than MaxReplicas and bigger than BufferSize

-protocol
+bufferSize
- -Kubernetes core/v1.Protocol - +k8s.io/apimachinery/pkg/util/intstr.IntOrString
-

Protocol is the network protocol being used. Defaults to UDP. TCP and TCPUDP are other options.

+

BufferSize defines how many replicas the autoscaler tries to have ready all the time +Value can be an absolute number (ex: 5) or a percentage of desired gs instances (ex: 15%) +Absolute number is calculated from percentage by rounding up. +Example: when this is set to 20%, the autoscaler will make sure that 20% +of the fleet’s game server replicas are ready. When this is set to 20, +the autoscaler will make sure that there are 20 available game servers +Must be bigger than 0 +Note: by “ready” we understand in this case “non-allocated”; this is done to ensure robustness +and computation stability in different edge case (fleet just created, not enough +capacity in the cluster etc)

-

GameServerSetSpec +

FixedIntervalSync

(Appears on: -GameServerSet) +FleetAutoscalerSync)

-

GameServerSetSpec the specification for GameServerSet

+

FixedIntervalSync controls the desired behavior of the fixed interval based sync.

@@ -956,66 +1019,25 @@

GameServerSetSpec

- - - - - - - - - - - -
-replicas
+seconds
int32
-

Replicas are the number of GameServers that should be in this set

-
-allocationOverflow
- - -AllocationOverflow - - -
-(Optional) -

[Stage: Alpha] -[FeatureFlag:FleetAllocationOverflow] -Labels and Annotations to apply to GameServers when the number of Allocated GameServers drops below -the desired replicas on the underlying GameServerSet

-
-scheduling
- -agones.dev/agones/pkg/apis.SchedulingStrategy - -
-

Scheduling strategy. Defaults to “Packed”.

-
-template
- - -GameServerTemplateSpec - - -
-

Template the GameServer template to apply for this GameServerSet

+

Seconds defines how often we run fleet autoscaling in seconds

-

GameServerSetStatus +

FleetAutoscaleRequest

(Appears on: -GameServerSet) +FleetAutoscaleReview)

-

GameServerSetStatus is the status of a GameServerSet

+

FleetAutoscaleRequest defines the request to webhook autoscaler endpoint

@@ -1027,86 +1049,63 @@

GameServerSetStatus

- - - - - - - -
-replicas
- -int32 - -
-

Replicas is the total number of current GameServer replicas

-
-readyReplicas
- -int32 - -
-

ReadyReplicas is the number of Ready GameServer replicas

-
-reservedReplicas
+uid
-int32 +k8s.io/apimachinery/pkg/types.UID
-

ReservedReplicas is the number of Reserved GameServer replicas

+

UID is an identifier for the individual request/response. It allows us to distinguish instances of requests which are +otherwise identical (parallel requests, requests when earlier requests did not modify etc) +The UID is meant to track the round trip (request/response) between the Autoscaler and the WebHook, not the user request. +It is suitable for correlating log entries between the webhook and apiserver, for either auditing or debugging.

-allocatedReplicas
+name
-int32 +string
-

AllocatedReplicas is the number of Allocated GameServer replicas

+

Name is the name of the Fleet being scaled

-shutdownReplicas
+namespace
-int32 +string
-

ShutdownReplicas is the number of Shutdown GameServers replicas

+

Namespace is the namespace associated with the request (if any).

-players
+status
- -AggregatedPlayerStatus + +FleetStatus
-(Optional) -

[Stage:Alpha] -[FeatureFlag:PlayerTracking] -Players is the current total player capacity and count for this GameServerSet

+

The Fleet’s status values

-

GameServerSpec +

FleetAutoscaleResponse

(Appears on: -GameServer, -GameServerTemplateSpec) +FleetAutoscaleReview)

-

GameServerSpec is the spec for a GameServer resource

+

FleetAutoscaleResponse defines the response of webhook autoscaler endpoint

@@ -1118,153 +1117,158 @@

GameServerSpec

+ +
-container
+uid
-string +k8s.io/apimachinery/pkg/types.UID
-

Container specifies which Pod container is the game server. Only required if there is more than one -container defined

+

UID is an identifier for the individual request/response. +This should be copied over from the corresponding FleetAutoscaleRequest.

-ports
+scale
- -[]GameServerPort - +bool
-

Ports are the array of ports that can be exposed via the game server

+

Set to false if no scaling should occur to the Fleet

-health
+replicas
- -Health - +int32
-

Health configures health checking

+

The targeted replica count

+

FleetAutoscaleReview +

+

+

FleetAutoscaleReview is passed to the webhook with a populated Request value, +and then returned with a populated Response.

+

+ + - - + + + + + +
-scheduling
- -agones.dev/agones/pkg/apis.SchedulingStrategy - -
-

Scheduling strategy. Defaults to “Packed”

-
FieldDescription
-sdkServer
+request
- -SdkServer + +FleetAutoscaleRequest
-

SdkServer specifies parameters for the Agones SDK Server sidecar container

-template
+response
- -Kubernetes core/v1.PodTemplateSpec + +FleetAutoscaleResponse
-

Template describes the Pod that will be created for the GameServer

+

FleetAutoscalerPolicy +

+

+(Appears on: +FleetAutoscalerSpec) +

+

+

FleetAutoscalerPolicy describes how to scale a fleet

+

+ + - - + + + +
-players
- - -PlayersSpec - - -
-(Optional) -

(Alpha, PlayerTracking feature flag) Players provides the configuration for player tracking features.

-
FieldDescription
-counters
+type
- -map[string]agones.dev/agones/pkg/apis/agones/v1.CounterStatus + +FleetAutoscalerPolicyType
-(Optional) -

(Alpha, CountsAndLists feature flag) Counters and Lists provides the configuration for generic tracking features.

+

Type of autoscaling policy.

-lists
+buffer
- -map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus + +BufferPolicy
+(Optional) +

Buffer policy config params. Present only if FleetAutoscalerPolicyType = Buffer.

-eviction
+webhook
- -Eviction + +WebhookPolicy
(Optional) -

(Alpha, SafeToEvict feature flag) Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

+

Webhook policy config params. Present only if FleetAutoscalerPolicyType = Webhook.

-

GameServerState +

FleetAutoscalerPolicyType (string alias)

(Appears on: -GameServerSelector, -GameServerStatus) +FleetAutoscalerPolicy)

-

GameServerState is the state for the GameServer

+

FleetAutoscalerPolicyType is the policy for autoscaling +for a given Fleet

-

GameServerStatus +

FleetAutoscalerSpec

(Appears on: -GameServer) +FleetAutoscaler)

-

GameServerStatus is the status for a GameServer resource

+

FleetAutoscalerSpec is the spec for a Fleet Scaler

@@ -1276,129 +1280,133 @@

GameServerStatus

- - - - + +
-state
+fleetName
- -GameServerState - +string
-

GameServerState is the current state of a GameServer, e.g. Creating, Starting, Ready, etc

-ports
+policy
- -[]GameServerStatusPort + +FleetAutoscalerPolicy
+

Autoscaling policy

-address
+sync
-string - -
-
-nodeName
- -string + +FleetAutoscalerSync +
+(Optional) +

[Stage:Beta] +[FeatureFlag:CustomFasSyncInterval] +Sync defines when FleetAutoscalers runs autoscaling

+

FleetAutoscalerStatus +

+

+(Appears on: +FleetAutoscaler) +

+

+

FleetAutoscalerStatus defines the current status of a FleetAutoscaler

+

+ + + + + + + +
FieldDescription
-reservedUntil
+currentReplicas
- -Kubernetes meta/v1.Time - +int32
+

CurrentReplicas is the current number of gameserver replicas +of the fleet managed by this autoscaler, as last seen by the autoscaler

-players
+desiredReplicas
- -PlayerStatus - +int32
-(Optional) -

[Stage:Alpha] -[FeatureFlag:PlayerTracking]

+

DesiredReplicas is the desired number of gameserver replicas +of the fleet managed by this autoscaler, as last calculated by the autoscaler

-counters
+lastScaleTime
- -map[string]agones.dev/agones/pkg/apis/agones/v1.CounterStatus + +Kubernetes meta/v1.Time
(Optional) -

(Alpha, CountsAndLists feature flag) Counters and Lists provides the configuration for generic tracking features.

+

lastScaleTime is the last time the FleetAutoscaler scaled the attached fleet,

-lists
+ableToScale
- -map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus - +bool
-(Optional) +

AbleToScale indicates that we can access the target fleet

-eviction
+scalingLimited
- -Eviction - +bool
-(Optional) -

(Alpha, SafeToEvict feature flag) Eviction specifies the eviction tolerance of the GameServer.

+

ScalingLimited indicates that the calculated scale would be above or below the range +defined by MinReplicas and MaxReplicas, and has thus been capped.

-

GameServerStatusPort +

FleetAutoscalerSync

(Appears on: -GameServerAllocationStatus, -GameServerStatus) +FleetAutoscalerSpec)

-

GameServerStatusPort shows the port that was allocated to a -GameServer.

+

FleetAutoscalerSync describes when to sync a fleet

@@ -1410,35 +1418,52 @@

GameServerStatusPort

-name
+type
-string + +FleetAutoscalerSyncType +
+

Type of autoscaling sync.

-port
+fixedInterval
-int32 + +FixedIntervalSync +
+(Optional) +

FixedInterval config params. Present only if FleetAutoscalerSyncType = FixedInterval.

-

GameServerTemplateSpec +

FleetAutoscalerSyncType +(string alias)

+

+(Appears on: +FleetAutoscalerSync) +

+

+

FleetAutoscalerSyncType is the sync strategy for a given Fleet

+

+

WebhookPolicy

(Appears on: -FleetSpec, -GameServerSetSpec) +FleetAutoscalerPolicy)

-

GameServerTemplateSpec is a template for GameServers

+

WebhookPolicy controls the desired behavior of the webhook policy. +It contains the description of the webhook autoscaler service +used to form url which is accessible inside the cluster

@@ -1450,158 +1475,162 @@

GameServerTemplateSpec

-metadata
+url
- -Kubernetes meta/v1.ObjectMeta - +string
-Refer to the Kubernetes API documentation for the fields of the -metadata field. +(Optional) +

url gives the location of the webhook, in standard URL form +(scheme://host:port/path). Exactly one of url or service +must be specified.

+

The host should not refer to a service running in the cluster; use +the service field instead. The host might be resolved via external +DNS in some apiservers (e.g., kube-apiserver cannot resolve +in-cluster DNS as that would be a layering violation). host may +also be an IP address.

+

Please note that using localhost or 127.0.0.1 as a host is +risky unless you take great care to run this webhook on all hosts +which run an apiserver which might need to make calls to this +webhook. Such installs are likely to be non-portable, i.e., not easy +to turn up in a new cluster.

+

The scheme must be “https”; the URL must begin with “https://”.

+

A path is optional, and if present may be any string permissible in +a URL. You may use the path to pass an arbitrary string to the +webhook, for example, a cluster identifier.

+

Attempting to use a user or basic auth e.g. “user:password@” is not +allowed. Fragments (“#…”) and query parameters (“?…”) are not +allowed, either.

-spec
+service
- -GameServerSpec + +Kubernetes admissionregistration/v1.ServiceReference
-
-
- +(Optional) +

service is a reference to the service for this webhook. Either +service or url must be specified.

+

If the webhook is running within the cluster, then you should use service.

+ + + +
-container
+caBundle
-string +[]byte
-

Container specifies which Pod container is the game server. Only required if there is more than one -container defined

+(Optional) +

caBundle is a PEM encoded CA bundle which will be used to validate the webhook’s server certificate. +If unspecified, system trust roots on the apiserver are used.

+
+

multicluster.agones.dev/v1

+

+

Package v1 is the v1 version of the API.

+

+Resource Types: + +

GameServerAllocationPolicy +

+

+

GameServerAllocationPolicy is the Schema for the gameserverallocationpolicies API

+

+ + + + + + + + + + + + - +
+
+
FieldDescription
-ports
- - -[]GameServerPort - - +apiVersion
+string
+ +multicluster.agones.dev/v1 +
-

Ports are the array of ports that can be exposed via the game server

+kind
+string
GameServerAllocationPolicy
-health
+metadata
- -Health + +Kubernetes meta/v1.ObjectMeta
-

Health configures health checking

+Refer to the Kubernetes API documentation for the fields of the +metadata field.
-scheduling
+spec
-agones.dev/agones/pkg/apis.SchedulingStrategy + +GameServerAllocationPolicySpec +
-

Scheduling strategy. Defaults to “Packed”

-
- - - - - - - - - - - -
-sdkServer
+priority
- -SdkServer - +int32
-

SdkServer specifies parameters for the Agones SDK Server sidecar container

-template
+weight
- -Kubernetes core/v1.PodTemplateSpec - +int
-

Template describes the Pod that will be created for the GameServer

-players
+connectionInfo
- -PlayersSpec + +ClusterConnectionInfo
-(Optional) -

(Alpha, PlayerTracking feature flag) Players provides the configuration for player tracking features.

-
-counters
- - -map[string]agones.dev/agones/pkg/apis/agones/v1.CounterStatus - - -
-(Optional) -

(Alpha, CountsAndLists feature flag) Counters and Lists provides the configuration for generic tracking features.

-
-lists
- - -map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus - - -
-
-eviction
- - -Eviction - - -
-(Optional) -

(Alpha, SafeToEvict feature flag) Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

@@ -1609,14 +1638,14 @@

GameServerTemplateSpec

-

Health +

ClusterConnectionInfo

(Appears on: -GameServerSpec) +GameServerAllocationPolicySpec)

-

Health configures health checking on the GameServer

+

ClusterConnectionInfo defines the connection information for a cluster

@@ -1628,98 +1657,67 @@

Health

- - - - - -
-disabled
- -bool - -
-

Disabled is whether health checking is disabled or not

-
-periodSeconds
+clusterName
-int32 +string
-

PeriodSeconds is the number of seconds each health ping has to occur in

+

Optional: the name of the targeted cluster

-failureThreshold
+allocationEndpoints
-int32 +[]string
-

FailureThreshold how many failures in a row constitutes unhealthy

+

The endpoints for the allocator service in the targeted cluster. +If the AllocationEndpoints is not set, the allocation happens on local cluster. +If there are multiple endpoints any of the endpoints that can handle allocation request should suffice

-initialDelaySeconds
+secretName
-int32 +string
-

InitialDelaySeconds initial delay before checking health

+

The name of the secret that contains TLS client certificates to connect the allocator server in the targeted cluster

-

ListStatus -

-

-(Appears on: -GameServerSpec, -GameServerStatus) -

-

-

ListStatus stores the current list values

-

- - - - - - - -
FieldDescription
-capacity
+namespace
-int64 +string
+

The cluster namespace from which to allocate gameservers

-values
+serverCa
-[]string +[]byte
+

The PEM encoded server CA, used by the allocator client to authenticate the remote server.

-

PlayerStatus +

ConnectionInfoIterator

-(Appears on: -GameServerStatus) -

-

-

PlayerStatus stores the current player capacity values

+

ConnectionInfoIterator an iterator on ClusterConnectionInfo

@@ -1731,82 +1729,58 @@

PlayerStatus

- -
-count
+currPriority
-int64 +int
+

currPriority Current priority index from the orderedPriorities

-capacity
+orderedPriorities
-int64 +[]int32
+

orderedPriorities list of ordered priorities

-ids
+priorityToCluster
-[]string +map[int32]map[string][]*agones.dev/agones/pkg/apis/multicluster/v1.GameServerAllocationPolicy
+

priorityToCluster Map of priority to cluster-policies map

-

PlayersSpec -

-

-(Appears on: -GameServerSpec) -

-

-

PlayersSpec tracks the initial player capacity

-

- - - - - - - -
FieldDescription
-initialCapacity
+clusterBlackList
-int64 +map[string]bool
+

clusterBlackList the cluster blacklist for the clusters that has already returned

-

PortPolicy -(string alias)

-

-(Appears on: -GameServerPort) -

-

-

PortPolicy is the port policy for the GameServer

-

-

SdkServer +

GameServerAllocationPolicySpec

(Appears on: -GameServerSpec) +GameServerAllocationPolicy)

-

SdkServer specifies parameters for the Agones SDK Server sidecar container

+

GameServerAllocationPolicySpec defines the desired state of GameServerAllocationPolicy

@@ -1818,64 +1792,55 @@

SdkServer

-logLevel
+priority
- -SdkServerLogLevel - +int32
-

LogLevel for SDK server (sidecar) logs. Defaults to “Info”

-grpcPort
+weight
-int32 +int
-

GRPCPort is the port on which the SDK Server binds the gRPC server to accept incoming connections

-httpPort
+connectionInfo
-int32 + +ClusterConnectionInfo +
-

HTTPPort is the port on which the SDK Server binds the HTTP gRPC gateway server to accept incoming connections

-

SdkServerLogLevel -(string alias)

-

-(Appears on: -SdkServer) -

-

-

SdkServerLogLevel is the log level for SDK server (sidecar) logs

-


-

allocation.agones.dev/v1

+

agones.dev/v1

Package v1 is the v1 version of the API.

Resource Types: -

GameServerAllocation +

Fleet

-

GameServerAllocation is the data structure for allocating against a set of -GameServers, defined selectors selectors

+

Fleet is the data structure for a Fleet resource

@@ -1891,7 +1856,7 @@

GameServerAllocation string

@@ -1900,13 +1865,13 @@

GameServerAllocation kind
string -

+ @@ -1931,70 +1896,48 @@

GameServerAllocation

-allocation.agones.dev/v1 +agones.dev/v1
GameServerAllocationFleet
metadata
- + Kubernetes meta/v1.ObjectMeta @@ -1920,8 +1885,8 @@

GameServerAllocation

spec
- -GameServerAllocationSpec + +FleetSpec
- - - -
-multiClusterSetting
+replicas
- -MultiClusterSetting - +int32
-

MultiClusterPolicySelector if specified, multi-cluster policies are applied. -Otherwise, allocation will happen locally.

+

Replicas are the number of GameServers that should be in this set. Defaults to 0.

-required
+allocationOverflow
- -GameServerSelector + +AllocationOverflow
-

Deprecated: use field Selectors instead. If Selectors is set, this field is ignored. -Required is the GameServer selector from which to choose GameServers from. -Defaults to all GameServers.

+(Optional) +

[Stage: Alpha] +[FeatureFlag:FleetAllocationOverflow] +Labels and Annotations to apply to GameServers when the number of Allocated GameServers drops below +the desired replicas on the underlying GameServerSet

-preferred
+strategy
- -[]GameServerSelector + +Kubernetes apps/v1.DeploymentStrategy
-

Deprecated: use field Selectors instead. If Selectors is set, this field is ignored. -Preferred is an ordered list of preferred GameServer selectors -that are optional to be fulfilled, but will be searched before the required selector. -If the first selector is not matched, the selection attempts the second selector, and so on. -If any of the preferred selectors are matched, the required selector is not considered. -This is useful for things like smoke testing of new game servers.

+

Deployment strategy

-selectors
- - -[]GameServerSelector - - -
-

Ordered list of GameServer label selectors. -If the first selector is not matched, the selection attempts the second selector, and so on. -This is useful for things like smoke testing of new game servers. -Note: This field can only be set if neither Required or Preferred is set.

-
-scheduling
+scheduling
agones.dev/agones/pkg/apis.SchedulingStrategy @@ -2005,16 +1948,15 @@

GameServerAllocation

-metadata
+template
- -MetaPatch + +GameServerTemplateSpec
-

MetaPatch is optional custom metadata that is added to the game server at allocation -You can use this to tell the server necessary session data

+

Template the GameServer template to apply for this Fleet

@@ -2024,8 +1966,8 @@

GameServerAllocation status
- -GameServerAllocationStatus + +FleetStatus @@ -2034,14 +1976,14 @@

GameServerAllocation -

GameServerAllocationSpec +

GameServer

-(Appears on: -GameServerAllocation) -

-

-

GameServerAllocationSpec is the spec for a GameServerAllocation

+

GameServer is the data structure for a GameServer resource. +It is worth noting that while there is a GameServerStatus Status entry for the GameServer, it is not +defined as a subresource - unlike Fleet and other Agones resources. +This is so that we can retain the ability to change multiple aspects of a GameServer in a single atomic operation, +which is particularly useful for operations such as allocation.

@@ -2053,65 +1995,84 @@

GameServerAllocationS

+ + + + + + + + + + +
-multiClusterSetting
+apiVersion
+string
+ +agones.dev/v1 + +
+kind
+string +
GameServer
+metadata
- -MultiClusterSetting + +Kubernetes meta/v1.ObjectMeta
-

MultiClusterPolicySelector if specified, multi-cluster policies are applied. -Otherwise, allocation will happen locally.

+Refer to the Kubernetes API documentation for the fields of the +metadata field.
-required
+spec
- -GameServerSelector + +GameServerSpec
-

Deprecated: use field Selectors instead. If Selectors is set, this field is ignored. -Required is the GameServer selector from which to choose GameServers from. -Defaults to all GameServers.

+
+
+ + + + @@ -2122,42 +2083,112 @@

GameServerAllocationS

+ + + + + + + + + + + + + + + + + + + + + + +
+container
+ +string + +
+

Container specifies which Pod container is the game server. Only required if there is more than one +container defined

-preferred
+ports
- -[]GameServerSelector + +[]GameServerPort
-

Deprecated: use field Selectors instead. If Selectors is set, this field is ignored. -Preferred is an ordered list of preferred GameServer selectors -that are optional to be fulfilled, but will be searched before the required selector. -If the first selector is not matched, the selection attempts the second selector, and so on. -If any of the preferred selectors are matched, the required selector is not considered. -This is useful for things like smoke testing of new game servers.

+

Ports are the array of ports that can be exposed via the game server

-selectors
+health
- -[]GameServerSelector + +Health
-

Ordered list of GameServer label selectors. -If the first selector is not matched, the selection attempts the second selector, and so on. -This is useful for things like smoke testing of new game servers. -Note: This field can only be set if neither Required or Preferred is set.

+

Health configures health checking

-

Scheduling strategy. Defaults to “Packed”.

+

Scheduling strategy. Defaults to “Packed”

-metadata
+sdkServer
- -MetaPatch + +SdkServer + + +
+

SdkServer specifies parameters for the Agones SDK Server sidecar container

+
+template
+ + +Kubernetes core/v1.PodTemplateSpec + + +
+

Template describes the Pod that will be created for the GameServer

+
+players
+ + +PlayersSpec + + +
+(Optional) +

(Alpha, PlayerTracking feature flag) Players provides the configuration for player tracking features.

+
+counters
+ + +map[string]agones.dev/agones/pkg/apis/agones/v1.CounterStatus + + +
+(Optional) +

(Alpha, CountsAndLists feature flag) Counters and Lists provides the configuration for generic tracking features.

+
+lists
+ + +map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus + + +
+
+eviction
+ + +Eviction + + +
+(Optional) +

(Alpha, SafeToEvict feature flag) Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

+
+
+status
+ + +GameServerStatus
-

MetaPatch is optional custom metadata that is added to the game server at allocation -You can use this to tell the server necessary session data

-

GameServerAllocationState -(string alias)

-

-(Appears on: -GameServerAllocationStatus) -

-

-

GameServerAllocationState is the Allocation state

-

-

GameServerAllocationStatus +

GameServerSet

-(Appears on: -GameServerAllocation) -

-

-

GameServerAllocationStatus is the status for an GameServerAllocation resource

+

GameServerSet is the data structure for a set of GameServers. +This matches philosophically with the relationship between +Deployments and ReplicaSets

@@ -2169,82 +2200,126 @@

GameServerAllocatio

+ + + + + + + + +
-state
+apiVersion
+string
+ +agones.dev/v1 + +
+kind
+string +
GameServerSet
+metadata
- -GameServerAllocationState + +Kubernetes meta/v1.ObjectMeta
-

GameServerState is the current state of an GameServerAllocation, e.g. Allocated, or UnAllocated

+Refer to the Kubernetes API documentation for the fields of the +metadata field.
-gameServerName
+spec
-string + +GameServerSetSpec + + +
+
+
+ + + + +
+replicas
+ +int32
+

Replicas are the number of GameServers that should be in this set

-ports
+allocationOverflow
- -[]GameServerStatusPort + +AllocationOverflow
+(Optional) +

[Stage: Alpha] +[FeatureFlag:FleetAllocationOverflow] +Labels and Annotations to apply to GameServers when the number of Allocated GameServers drops below +the desired replicas on the underlying GameServerSet

-address
+scheduling
-string +agones.dev/agones/pkg/apis.SchedulingStrategy
+

Scheduling strategy. Defaults to “Packed”.

-nodeName
+template
-string + +GameServerTemplateSpec +
+

Template the GameServer template to apply for this GameServerSet

+
-source
+status
-string + +GameServerSetStatus +
-

If the allocation is from a remote cluster, Source is the endpoint of the remote agones-allocator. -Otherwise, Source is “local”

-

GameServerSelector +

AggregatedPlayerStatus

(Appears on: -GameServerAllocationSpec) +FleetStatus, +GameServerSetStatus)

-

GameServerSelector contains all the filter options for selecting -a GameServer for allocation.

+

AggregatedPlayerStatus stores total player tracking values

@@ -2256,65 +2331,166 @@

GameServerSelector

+ + + + + + +
-LabelSelector
+count
- -Kubernetes meta/v1.LabelSelector - +int64
+
+capacity
+ +int64 + +
+
+

AllocationOverflow +

-(Members of LabelSelector are embedded into this type.) +(Appears on: +FleetSpec, +GameServerSetSpec)

-

See: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/

+

+

AllocationOverflow specifies what labels and/or annotations to apply on Allocated GameServers +if the desired number of the underlying GameServerSet drops below the number of Allocated GameServers +attached to it.

+

+ + + + + + + + + + + + +
FieldDescription
+labels
+ +map[string]string + +
+(Optional) +

Labels to be applied to the GameServer

-gameServerState
+annotations
- -GameServerState - +map[string]string
(Optional) -

[Stage:Beta] -[FeatureFlag:StateAllocationFilter] -GameServerState specifies which State is the filter to be used when attempting to retrieve a GameServer -via Allocation. Defaults to “Ready”. The only other option is “Allocated”, which can be used in conjunction with -label/annotation/player selectors to retrieve an already Allocated GameServer.

+

Annotations to be applied to the GameServer

+

CounterStatus +

+

+(Appears on: +GameServerSpec, +GameServerStatus) +

+

+

CounterStatus stores the current counter values

+

+ + + + + + + + + + + + + + + +
FieldDescription
-players
+count
- -PlayerSelector +int64 + +
+
+capacity
+ +int64 + +
+
+

Eviction +

+

+(Appears on: +GameServerSpec, +GameServerStatus) +

+

+

Eviction specifies the eviction tolerance of the GameServer

+

+ + + + + + + + + +
FieldDescription
+safe
+ + +EvictionSafe
-(Optional) -

[Stage:Alpha] -[FeatureFlag:PlayerAllocationFilter] -Players provides a filter on minimum and maximum values for player capacity when retrieving a GameServer -through Allocation. Defaults to no limits.

+

(Alpha, SafeToEvict feature flag) +Game server supports termination via SIGTERM: +- Always: Allow eviction for both Cluster Autoscaler and node drain for upgrades +- OnUpgrade: Allow eviction for upgrades alone +- Never (default): Pod should run to completion

-

MetaPatch +

EvictionSafe +(string alias)

+

+(Appears on: +Eviction) +

+

+

EvictionSafe specified whether the game server supports termination via SIGTERM

+

+

FleetSpec

(Appears on: -GameServerAllocationSpec) +Fleet)

-

MetaPatch is the metadata used to patch the GameServer metadata on allocation

+

FleetSpec is the spec for a Fleet

@@ -2326,34 +2502,80 @@

MetaPatch

+ + + + + + + + + + + +
-labels
+replicas
-map[string]string +int32 + +
+

Replicas are the number of GameServers that should be in this set. Defaults to 0.

+
+allocationOverflow
+ + +AllocationOverflow + + +
+(Optional) +

[Stage: Alpha] +[FeatureFlag:FleetAllocationOverflow] +Labels and Annotations to apply to GameServers when the number of Allocated GameServers drops below +the desired replicas on the underlying GameServerSet

+
+strategy
+ + +Kubernetes apps/v1.DeploymentStrategy + + +
+

Deployment strategy

+
+scheduling
+ +agones.dev/agones/pkg/apis.SchedulingStrategy
+

Scheduling strategy. Defaults to “Packed”.

-annotations
+template
-map[string]string + +GameServerTemplateSpec +
+

Template the GameServer template to apply for this Fleet

-

MultiClusterSetting +

FleetStatus

(Appears on: -GameServerAllocationSpec) +Fleet, +FleetAutoscaleRequest)

-

MultiClusterSetting specifies settings for multi-cluster allocation.

+

FleetStatus is the status of a Fleet

@@ -2365,80 +2587,76 @@

MultiClusterSetting

- -
-enabled
+replicas
-bool +int32
+

Replicas the total number of current GameServer replicas

-policySelector
+readyReplicas
- -Kubernetes meta/v1.LabelSelector - +int32
+

ReadyReplicas are the number of Ready GameServer replicas

-

PlayerSelector -

-

-(Appears on: -GameServerSelector) -

-

-

PlayerSelector is the filter options for a GameServer based on player counts

-

- - - - + + - -
FieldDescription +reservedReplicas
+ +int32 + +
+

ReservedReplicas are the total number of Reserved GameServer replicas in this fleet. +Reserved instances won’t be deleted on scale down, but won’t cause an autoscaler to scale up.

+
-minAvailable
+allocatedReplicas
-int64 +int32
+

AllocatedReplicas are the number of Allocated GameServer replicas

-maxAvailable
+players
-int64 + +AggregatedPlayerStatus +
+(Optional) +

[Stage:Alpha] +[FeatureFlag:PlayerTracking] +Players are the current total player capacity and count for this Fleet

-
-

autoscaling.agones.dev/v1

+

GameServerPort +

-

Package v1 is the v1 version of the API.

+(Appears on: +GameServerSpec)

-Resource Types: - -

FleetAutoscaler -

-

FleetAutoscaler is the data structure for a FleetAutoscaler resource

+

GameServerPort defines a set of Ports that +are to be exposed via the GameServer

@@ -2450,112 +2668,89 @@

FleetAutoscaler

- - - - - - - -
-apiVersion
-string
- -autoscaling.agones.dev/v1 - -
-kind
-string -
FleetAutoscaler
-metadata
+name
- -Kubernetes meta/v1.ObjectMeta - +string
-Refer to the Kubernetes API documentation for the fields of the -metadata field. +

Name is the descriptive name of the port

-spec
+portPolicy
- -FleetAutoscalerSpec + +PortPolicy
-
-
- +

PortPolicy defines the policy for how the HostPort is populated. +Dynamic port will allocate a HostPort within the selected MIN_PORT and MAX_PORT range passed to the controller +at installation time. +When Static portPolicy is specified, HostPort is required, to specify the port that game clients will +connect to

+ + - -
-fleetName
+container
string
+(Optional) +

Container is the name of the container on which to open the port. Defaults to the game server container.

-policy
+containerPort
- -FleetAutoscalerPolicy - +int32
-

Autoscaling policy

+

ContainerPort is the port that is being opened on the specified container’s process

-sync
+hostPort
- -FleetAutoscalerSync - +int32
-(Optional) -

[Stage:Beta] -[FeatureFlag:CustomFasSyncInterval] -Sync defines when FleetAutoscalers runs autoscaling

-
+

HostPort the port exposed on the host for clients to connect to

-status
+protocol
- -FleetAutoscalerStatus + +Kubernetes core/v1.Protocol
+

Protocol is the network protocol being used. Defaults to UDP. TCP and TCPUDP are other options.

-

BufferPolicy +

GameServerSetSpec

(Appears on: -FleetAutoscalerPolicy) +GameServerSet)

-

BufferPolicy controls the desired behavior of the buffer policy.

+

GameServerSetSpec the specification for GameServerSet

@@ -2567,59 +2762,66 @@

BufferPolicy

+ + + +
-maxReplicas
+replicas
int32
-

MaxReplicas is the maximum amount of replicas that the fleet may have. -It must be bigger than both MinReplicas and BufferSize

+

Replicas are the number of GameServers that should be in this set

-minReplicas
+allocationOverflow
-int32 + +AllocationOverflow +
-

MinReplicas is the minimum amount of replicas that the fleet must have -If zero, it is ignored. -If non zero, it must be smaller than MaxReplicas and bigger than BufferSize

+(Optional) +

[Stage: Alpha] +[FeatureFlag:FleetAllocationOverflow] +Labels and Annotations to apply to GameServers when the number of Allocated GameServers drops below +the desired replicas on the underlying GameServerSet

-bufferSize
+scheduling
-k8s.io/apimachinery/pkg/util/intstr.IntOrString +agones.dev/agones/pkg/apis.SchedulingStrategy
-

BufferSize defines how many replicas the autoscaler tries to have ready all the time -Value can be an absolute number (ex: 5) or a percentage of desired gs instances (ex: 15%) -Absolute number is calculated from percentage by rounding up. -Example: when this is set to 20%, the autoscaler will make sure that 20% -of the fleet’s game server replicas are ready. When this is set to 20, -the autoscaler will make sure that there are 20 available game servers -Must be bigger than 0 -Note: by “ready” we understand in this case “non-allocated”; this is done to ensure robustness -and computation stability in different edge case (fleet just created, not enough -capacity in the cluster etc)

+

Scheduling strategy. Defaults to “Packed”.

+
+template
+ + +GameServerTemplateSpec + + +
+

Template the GameServer template to apply for this GameServerSet

-

FixedIntervalSync +

GameServerSetStatus

(Appears on: -FleetAutoscalerSync) +GameServerSet)

-

FixedIntervalSync controls the desired behavior of the fixed interval based sync.

+

GameServerSetStatus is the status of a GameServerSet

@@ -2631,93 +2833,86 @@

FixedIntervalSync

- -
-seconds
+replicas
int32
-

Seconds defines how often we run fleet autoscaling in seconds

+

Replicas is the total number of current GameServer replicas

-

FleetAutoscaleRequest -

-

-(Appears on: -FleetAutoscaleReview) -

-

-

FleetAutoscaleRequest defines the request to webhook autoscaler endpoint

-

- - - - + + - -
FieldDescription +readyReplicas
+ +int32 + +
+

ReadyReplicas is the number of Ready GameServer replicas

+
-uid
+reservedReplicas
-k8s.io/apimachinery/pkg/types.UID +int32
-

UID is an identifier for the individual request/response. It allows us to distinguish instances of requests which are -otherwise identical (parallel requests, requests when earlier requests did not modify etc) -The UID is meant to track the round trip (request/response) between the Autoscaler and the WebHook, not the user request. -It is suitable for correlating log entries between the webhook and apiserver, for either auditing or debugging.

+

ReservedReplicas is the number of Reserved GameServer replicas

-name
+allocatedReplicas
-string +int32
-

Name is the name of the Fleet being scaled

+

AllocatedReplicas is the number of Allocated GameServer replicas

-namespace
+shutdownReplicas
-string +int32
-

Namespace is the namespace associated with the request (if any).

+

ShutdownReplicas is the number of Shutdown GameServers replicas

-status
+players
- -FleetStatus + +AggregatedPlayerStatus
-

The Fleet’s status values

+(Optional) +

[Stage:Alpha] +[FeatureFlag:PlayerTracking] +Players is the current total player capacity and count for this GameServerSet

-

FleetAutoscaleResponse +

GameServerSpec

(Appears on: -FleetAutoscaleReview) +GameServer, +GameServerTemplateSpec)

-

FleetAutoscaleResponse defines the response of webhook autoscaler endpoint

+

GameServerSpec is the spec for a GameServer resource

@@ -2729,158 +2924,153 @@

FleetAutoscaleResponse

- -
-uid
+container
-k8s.io/apimachinery/pkg/types.UID +string
-

UID is an identifier for the individual request/response. -This should be copied over from the corresponding FleetAutoscaleRequest.

+

Container specifies which Pod container is the game server. Only required if there is more than one +container defined

-scale
+ports
-bool + +[]GameServerPort +
-

Set to false if no scaling should occur to the Fleet

+

Ports are the array of ports that can be exposed via the game server

-replicas
+health
-int32 + +Health +
-

The targeted replica count

+

Health configures health checking

-

FleetAutoscaleReview -

-

-

FleetAutoscaleReview is passed to the webhook with a populated Request value, -and then returned with a populated Response.

-

- - - - + + - - - -
FieldDescription +scheduling
+ +agones.dev/agones/pkg/apis.SchedulingStrategy + +
+

Scheduling strategy. Defaults to “Packed”

+
-request
+sdkServer
- -FleetAutoscaleRequest + +SdkServer
+

SdkServer specifies parameters for the Agones SDK Server sidecar container

-response
+template
- -FleetAutoscaleResponse + +Kubernetes core/v1.PodTemplateSpec
+

Template describes the Pod that will be created for the GameServer

-

FleetAutoscalerPolicy -

-

-(Appears on: -FleetAutoscalerSpec) -

-

-

FleetAutoscalerPolicy describes how to scale a fleet

-

- - - - + + - -
FieldDescription +players
+ + +PlayersSpec + + +
+(Optional) +

(Alpha, PlayerTracking feature flag) Players provides the configuration for player tracking features.

+
-type
+counters
- -FleetAutoscalerPolicyType + +map[string]agones.dev/agones/pkg/apis/agones/v1.CounterStatus
-

Type of autoscaling policy.

+(Optional) +

(Alpha, CountsAndLists feature flag) Counters and Lists provides the configuration for generic tracking features.

-buffer
+lists
- -BufferPolicy + +map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus
-(Optional) -

Buffer policy config params. Present only if FleetAutoscalerPolicyType = Buffer.

-webhook
+eviction
- -WebhookPolicy + +Eviction
(Optional) -

Webhook policy config params. Present only if FleetAutoscalerPolicyType = Webhook.

+

(Alpha, SafeToEvict feature flag) Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

-

FleetAutoscalerPolicyType +

GameServerState (string alias)

(Appears on: -FleetAutoscalerPolicy) +GameServerSelector, +GameServerStatus)

-

FleetAutoscalerPolicyType is the policy for autoscaling -for a given Fleet

+

GameServerState is the state for the GameServer

-

FleetAutoscalerSpec +

GameServerStatus

(Appears on: -FleetAutoscaler) +GameServer)

-

FleetAutoscalerSpec is the spec for a Fleet Scaler

+

GameServerStatus is the status for a GameServer resource

@@ -2892,133 +3082,129 @@

FleetAutoscalerSpec

- -
-fleetName
+state
-string + +GameServerState +
+

GameServerState is the current state of a GameServer, e.g. Creating, Starting, Ready, etc

-policy
+ports
- -FleetAutoscalerPolicy + +[]GameServerStatusPort
-

Autoscaling policy

-sync
+address
- -FleetAutoscalerSync - +string
-(Optional) -

[Stage:Beta] -[FeatureFlag:CustomFasSyncInterval] -Sync defines when FleetAutoscalers runs autoscaling

-

FleetAutoscalerStatus -

-

-(Appears on: -FleetAutoscaler) -

-

-

FleetAutoscalerStatus defines the current status of a FleetAutoscaler

-

- - - - + + - -
FieldDescription +nodeName
+ +string + +
+
-currentReplicas
+reservedUntil
-int32 + +Kubernetes meta/v1.Time +
-

CurrentReplicas is the current number of gameserver replicas -of the fleet managed by this autoscaler, as last seen by the autoscaler

-desiredReplicas
+players
-int32 + +PlayerStatus +
-

DesiredReplicas is the desired number of gameserver replicas -of the fleet managed by this autoscaler, as last calculated by the autoscaler

+(Optional) +

[Stage:Alpha] +[FeatureFlag:PlayerTracking]

-lastScaleTime
+counters
- -Kubernetes meta/v1.Time + +map[string]agones.dev/agones/pkg/apis/agones/v1.CounterStatus
(Optional) -

lastScaleTime is the last time the FleetAutoscaler scaled the attached fleet,

+

(Alpha, CountsAndLists feature flag) Counters and Lists provides the configuration for generic tracking features.

-ableToScale
+lists
-bool + +map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus +
-

AbleToScale indicates that we can access the target fleet

+(Optional)
-scalingLimited
+eviction
-bool + +Eviction +
-

ScalingLimited indicates that the calculated scale would be above or below the range -defined by MinReplicas and MaxReplicas, and has thus been capped.

+(Optional) +

(Alpha, SafeToEvict feature flag) Eviction specifies the eviction tolerance of the GameServer.

-

FleetAutoscalerSync +

GameServerStatusPort

(Appears on: -FleetAutoscalerSpec) +GameServerAllocationStatus, +GameServerStatus)

-

FleetAutoscalerSync describes when to sync a fleet

+

GameServerStatusPort shows the port that was allocated to a +GameServer.

@@ -3030,52 +3216,35 @@

FleetAutoscalerSync

-type
+name
- -FleetAutoscalerSyncType - +string
-

Type of autoscaling sync.

-fixedInterval
+port
- -FixedIntervalSync - +int32
-(Optional) -

FixedInterval config params. Present only if FleetAutoscalerSyncType = FixedInterval.

-

FleetAutoscalerSyncType -(string alias)

-

-(Appears on: -FleetAutoscalerSync) -

-

-

FleetAutoscalerSyncType is the sync strategy for a given Fleet

-

-

WebhookPolicy +

GameServerTemplateSpec

(Appears on: -FleetAutoscalerPolicy) +FleetSpec, +GameServerSetSpec)

-

WebhookPolicy controls the desired behavior of the webhook policy. -It contains the description of the webhook autoscaler service -used to form url which is accessible inside the cluster

+

GameServerTemplateSpec is a template for GameServers

@@ -3087,147 +3256,141 @@

WebhookPolicy

- - - - - - -
-url
+metadata
-string + +Kubernetes meta/v1.ObjectMeta +
-(Optional) -

url gives the location of the webhook, in standard URL form -(scheme://host:port/path). Exactly one of url or service -must be specified.

-

The host should not refer to a service running in the cluster; use -the service field instead. The host might be resolved via external -DNS in some apiservers (e.g., kube-apiserver cannot resolve -in-cluster DNS as that would be a layering violation). host may -also be an IP address.

-

Please note that using localhost or 127.0.0.1 as a host is -risky unless you take great care to run this webhook on all hosts -which run an apiserver which might need to make calls to this -webhook. Such installs are likely to be non-portable, i.e., not easy -to turn up in a new cluster.

-

The scheme must be “https”; the URL must begin with “https://”.

-

A path is optional, and if present may be any string permissible in -a URL. You may use the path to pass an arbitrary string to the -webhook, for example, a cluster identifier.

-

Attempting to use a user or basic auth e.g. “user:password@” is not -allowed. Fragments (“#…”) and query parameters (“?…”) are not -allowed, either.

+Refer to the Kubernetes API documentation for the fields of the +metadata field.
-service
+spec
- -Kubernetes admissionregistration/v1.ServiceReference + +GameServerSpec
-(Optional) -

service is a reference to the service for this webhook. Either -service or url must be specified.

-

If the webhook is running within the cluster, then you should use service.

+
+
+ + + + - -
+container
+ +string + +
+

Container specifies which Pod container is the game server. Only required if there is more than one +container defined

-caBundle
+ports
-[]byte + +[]GameServerPort +
-(Optional) -

caBundle is a PEM encoded CA bundle which will be used to validate the webhook’s server certificate. -If unspecified, system trust roots on the apiserver are used.

+

Ports are the array of ports that can be exposed via the game server

-
-

multicluster.agones.dev/v1

-

-

Package v1 is the v1 version of the API.

-

-Resource Types: - -

GameServerAllocationPolicy -

-

-

GameServerAllocationPolicy is the Schema for the gameserverallocationpolicies API

-

- - - - + + - - +scheduling
+ +agones.dev/agones/pkg/apis.SchedulingStrategy + + + -
FieldDescription +health
+ + +Health + + +
+

Health configures health checking

+
-apiVersion
-string
- -multicluster.agones.dev/v1 - +

Scheduling strategy. Defaults to “Packed”

-kind
-string +sdkServer
+ + +SdkServer + + +
+

SdkServer specifies parameters for the Agones SDK Server sidecar container

GameServerAllocationPolicy
-metadata
+template
- -Kubernetes meta/v1.ObjectMeta + +Kubernetes core/v1.PodTemplateSpec
-Refer to the Kubernetes API documentation for the fields of the -metadata field. +

Template describes the Pod that will be created for the GameServer

-spec
+players
- -GameServerAllocationPolicySpec + +PlayersSpec
-
-
- +(Optional) +

(Alpha, PlayerTracking feature flag) Players provides the configuration for player tracking features.

+ +
-priority
+counters
-int32 + +map[string]agones.dev/agones/pkg/apis/agones/v1.CounterStatus +
+(Optional) +

(Alpha, CountsAndLists feature flag) Counters and Lists provides the configuration for generic tracking features.

-weight
+lists
-int + +map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus +
@@ -3235,14 +3398,16 @@

GameServerAllocat

-connectionInfo
+eviction
- -ClusterConnectionInfo + +Eviction
+(Optional) +

(Alpha, SafeToEvict feature flag) Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

@@ -3250,14 +3415,14 @@

GameServerAllocat

-

ClusterConnectionInfo +

Health

(Appears on: -GameServerAllocationPolicySpec) +GameServerSpec)

-

ClusterConnectionInfo defines the connection information for a cluster

+

Health configures health checking on the GameServer

@@ -3269,67 +3434,98 @@

ClusterConnectionInfo

+ + + +
-clusterName
+disabled
-string +bool
-

Optional: the name of the targeted cluster

+

Disabled is whether health checking is disabled or not

-allocationEndpoints
+periodSeconds
-[]string +int32
-

The endpoints for the allocator service in the targeted cluster. -If the AllocationEndpoints is not set, the allocation happens on local cluster. -If there are multiple endpoints any of the endpoints that can handle allocation request should suffice

+

PeriodSeconds is the number of seconds each health ping has to occur in

-secretName
+failureThreshold
-string +int32
-

The name of the secret that contains TLS client certificates to connect the allocator server in the targeted cluster

+

FailureThreshold how many failures in a row constitutes unhealthy

-namespace
+initialDelaySeconds
+ +int32 + +
+

InitialDelaySeconds initial delay before checking health

+
+

ListStatus +

+

+(Appears on: +GameServerSpec, +GameServerStatus) +

+

+

ListStatus stores the current list values

+

+ + + + + + + + + +
FieldDescription
+capacity
-string +int64
-

The cluster namespace from which to allocate gameservers

-serverCa
+values
-[]byte +[]string
-

The PEM encoded server CA, used by the allocator client to authenticate the remote server.

-

ConnectionInfoIterator +

PlayerStatus

-

ConnectionInfoIterator an iterator on ClusterConnectionInfo

+(Appears on: +GameServerStatus) +

+

+

PlayerStatus stores the current player capacity values

@@ -3341,58 +3537,82 @@

ConnectionInfoIterato

+ +
-currPriority
+count
-int +int64
-

currPriority Current priority index from the orderedPriorities

-orderedPriorities
+capacity
-[]int32 +int64
-

orderedPriorities list of ordered priorities

-priorityToCluster
+ids
-map[int32]map[string][]*agones.dev/agones/pkg/apis/multicluster/v1.GameServerAllocationPolicy +[]string
-

priorityToCluster Map of priority to cluster-policies map

+

PlayersSpec +

+

+(Appears on: +GameServerSpec) +

+

+

PlayersSpec tracks the initial player capacity

+

+ + + + + + + +
FieldDescription
-clusterBlackList
+initialCapacity
-map[string]bool +int64
-

clusterBlackList the cluster blacklist for the clusters that has already returned

-

GameServerAllocationPolicySpec +

PortPolicy +(string alias)

+

+(Appears on: +GameServerPort) +

+

+

PortPolicy is the port policy for the GameServer

+

+

SdkServer

(Appears on: -GameServerAllocationPolicy) +GameServerSpec)

-

GameServerAllocationPolicySpec defines the desired state of GameServerAllocationPolicy

+

SdkServer specifies parameters for the Agones SDK Server sidecar container

@@ -3404,47 +3624,62 @@

GameServerAll

-priority
+logLevel
-int32 + +SdkServerLogLevel +
+

LogLevel for SDK server (sidecar) logs. Defaults to “Info”

-weight
+grpcPort
-int +int32
+

GRPCPort is the port on which the SDK Server binds the gRPC server to accept incoming connections

-connectionInfo
+httpPort
- -ClusterConnectionInfo - +int32
+

HTTPPort is the port on which the SDK Server binds the HTTP gRPC gateway server to accept incoming connections

+

SdkServerLogLevel +(string alias)

+

+(Appears on: +SdkServer) +

+

+

SdkServerLogLevel is the log level for SDK server (sidecar) logs

+


Generated with gen-crd-api-reference-docs.

{{% /feature %}} -{{% feature publishVersion="1.31.0" %}} +{{% feature publishVersion="1.32.0" %}}

Packages:

-

allocation.agones.dev/v1

+

agones.dev/v1

Package v1 is the v1 version of the API.

Resource Types: -

GameServerAllocation +

Fleet

-

GameServerAllocation is the data structure for allocating against a set of -GameServers, defined selectors selectors

+

Fleet is the data structure for a Fleet resource

@@ -3485,7 +3720,7 @@

GameServerAllocation string

@@ -3494,7 +3729,7 @@

GameServerAllocation kind
string -

+ @@ -3525,179 +3760,79 @@

GameServerAllocation

-allocation.agones.dev/v1 +agones.dev/v1
GameServerAllocationFleet
@@ -3514,8 +3749,8 @@

GameServerAllocation

spec
- -GameServerAllocationSpec + +FleetSpec
- - - - - - - - - - - - - - - - - - - - - -
-multiClusterSetting
- - -MultiClusterSetting - - -
-

MultiClusterPolicySelector if specified, multi-cluster policies are applied. -Otherwise, allocation will happen locally.

-
-required
- - -GameServerSelector - - -
-

Deprecated: use field Selectors instead. If Selectors is set, this field is ignored. -Required is the GameServer selector from which to choose GameServers from. -Defaults to all GameServers.

-
-preferred
+replicas
- -[]GameServerSelector - +int32
-

Deprecated: use field Selectors instead. If Selectors is set, this field is ignored. -Preferred is an ordered list of preferred GameServer selectors -that are optional to be fulfilled, but will be searched before the required selector. -If the first selector is not matched, the selection attempts the second selector, and so on. -If any of the preferred selectors are matched, the required selector is not considered. -This is useful for things like smoke testing of new game servers.

+

Replicas are the number of GameServers that should be in this set. Defaults to 0.

-priorities
+allocationOverflow
- -[]Priority + +AllocationOverflow
(Optional) -

(Alpha, CountsAndLists feature flag) The first Priority on the array of Priorities is the most -important for sorting. The allocator will use the first priority for sorting GameServers in the -Selector set, and will only use any following priority for tie-breaking during sort. -Impacts which GameServer is checked first.

-
-selectors
- - -[]GameServerSelector - - -
-

Ordered list of GameServer label selectors. -If the first selector is not matched, the selection attempts the second selector, and so on. -This is useful for things like smoke testing of new game servers. -Note: This field can only be set if neither Required or Preferred is set.

-
-scheduling
- -agones.dev/agones/pkg/apis.SchedulingStrategy - -
-

Scheduling strategy. Defaults to “Packed”.

-
-metadata
- - -MetaPatch - - -
-

MetaPatch is optional custom metadata that is added to the game server at allocation -You can use this to tell the server necessary session data

-
-
-status
- - -GameServerAllocationStatus - - -
+

[Stage: Alpha] +[FeatureFlag:FleetAllocationOverflow] +Labels and/or Annotations to apply to overflowing GameServers when the number of Allocated GameServers is more +than the desired replicas on the underlying GameServerSet

-

CounterSelector -

-

-(Appears on: -GameServerSelector) -

-

-

CounterSelector is the filter options for a GameServer based on the count and/or available capacity. -0 for MaxCount or MaxAvailable means unlimited maximum. Default for all fields: 0

-

- - - - - - - - + + +
FieldDescription
-minCount
+strategy
-int64 + +Kubernetes apps/v1.DeploymentStrategy +
+

Deployment strategy

-maxCount
+scheduling
-int64 +agones.dev/agones/pkg/apis.SchedulingStrategy
+

Scheduling strategy. Defaults to “Packed”.

-minAvailable
+template
-int64 + +GameServerTemplateSpec +
+

Template the GameServer template to apply for this Fleet

+
-maxAvailable
+status
-int64 + +FleetStatus + @@ -3705,14 +3840,14 @@

CounterSelector -

GameServerAllocationSpec +

GameServer

-(Appears on: -GameServerAllocation) -

-

-

GameServerAllocationSpec is the spec for a GameServerAllocation

+

GameServer is the data structure for a GameServer resource. +It is worth noting that while there is a GameServerStatus Status entry for the GameServer, it is not +defined as a subresource - unlike Fleet and other Agones resources. +This is so that we can retain the ability to change multiple aspects of a GameServer in a single atomic operation, +which is particularly useful for operations such as allocation.

@@ -3724,82 +3859,84 @@

GameServerAllocationS

+ + + +
-multiClusterSetting
- - -MultiClusterSetting - - +apiVersion
+string
+ +agones.dev/v1 +
-

MultiClusterPolicySelector if specified, multi-cluster policies are applied. -Otherwise, allocation will happen locally.

+kind
+string
GameServer
-required
+metadata
- -GameServerSelector + +Kubernetes meta/v1.ObjectMeta
-

Deprecated: use field Selectors instead. If Selectors is set, this field is ignored. -Required is the GameServer selector from which to choose GameServers from. -Defaults to all GameServers.

+Refer to the Kubernetes API documentation for the fields of the +metadata field.
-preferred
+spec
- -[]GameServerSelector + +GameServerSpec
-

Deprecated: use field Selectors instead. If Selectors is set, this field is ignored. -Preferred is an ordered list of preferred GameServer selectors -that are optional to be fulfilled, but will be searched before the required selector. -If the first selector is not matched, the selection attempts the second selector, and so on. -If any of the preferred selectors are matched, the required selector is not considered. -This is useful for things like smoke testing of new game servers.

+
+
+ + + + @@ -3810,91 +3947,70 @@

GameServerAllocationS

- -
+container
+ +string + +
+

Container specifies which Pod container is the game server. Only required if there is more than one +container defined

-priorities
+ports
- -[]Priority + +[]GameServerPort
-(Optional) -

(Alpha, CountsAndLists feature flag) The first Priority on the array of Priorities is the most -important for sorting. The allocator will use the first priority for sorting GameServers in the -Selector set, and will only use any following priority for tie-breaking during sort. -Impacts which GameServer is checked first.

+

Ports are the array of ports that can be exposed via the game server

-selectors
+health
- -[]GameServerSelector + +Health
-

Ordered list of GameServer label selectors. -If the first selector is not matched, the selection attempts the second selector, and so on. -This is useful for things like smoke testing of new game servers. -Note: This field can only be set if neither Required or Preferred is set.

+

Health configures health checking

-

Scheduling strategy. Defaults to “Packed”.

+

Scheduling strategy. Defaults to “Packed”

-metadata
+sdkServer
- -MetaPatch + +SdkServer
-

MetaPatch is optional custom metadata that is added to the game server at allocation -You can use this to tell the server necessary session data

+

SdkServer specifies parameters for the Agones SDK Server sidecar container

-

GameServerAllocationState -(string alias)

-

-(Appears on: -GameServerAllocationStatus) -

-

-

GameServerAllocationState is the Allocation state

-

-

GameServerAllocationStatus -

-

-(Appears on: -GameServerAllocation) -

-

-

GameServerAllocationStatus is the status for an GameServerAllocation resource

-

- - - - - - - - + +
FieldDescription
-state
+template
- -GameServerAllocationState + +Kubernetes core/v1.PodTemplateSpec
-

GameServerState is the current state of an GameServerAllocation, e.g. Allocated, or UnAllocated

+

Template describes the Pod that will be created for the GameServer

-gameServerName
+players
-string + +PlayersSpec +
+(Optional) +

(Alpha, PlayerTracking feature flag) Players provides the configuration for player tracking features.

-ports
+counters
- -[]GameServerStatusPort + +map[string]agones.dev/agones/pkg/apis/agones/v1.CounterStatus
+(Optional) +

(Alpha, CountsAndLists feature flag) Counters and Lists provides the configuration for generic tracking features.

-address
+lists
-string + +map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus +
@@ -3902,37 +4018,41 @@

GameServerAllocatio

-nodeName
+eviction
-string + +Eviction +
+(Optional) +

(Alpha, SafeToEvict feature flag) Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

+
-source
+status
-string + +GameServerStatus +
-

If the allocation is from a remote cluster, Source is the endpoint of the remote agones-allocator. -Otherwise, Source is “local”

-

GameServerSelector +

GameServerSet

-(Appears on: -GameServerAllocationSpec) -

-

-

GameServerSelector contains all the filter options for selecting -a GameServer for allocation.

+

GameServerSet is the data structure for a set of GameServers. +This matches philosophically with the relationship between +Deployments and ReplicaSets

@@ -3944,100 +4064,126 @@

GameServerSelector

+ + + + + + + + + + + + +
-LabelSelector
+apiVersion
+string
+ +agones.dev/v1 + +
+kind
+string +
GameServerSet
+metadata
+ + +Kubernetes meta/v1.ObjectMeta + + +
+Refer to the Kubernetes API documentation for the fields of the +metadata field. +
+spec
+ + +GameServerSetSpec + + +
+
+
+ + + + +
+replicas
- -Kubernetes meta/v1.LabelSelector - +int32
-

-(Members of LabelSelector are embedded into this type.) -

-

See: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/

+

Replicas are the number of GameServers that should be in this set

-gameServerState
+allocationOverflow
- -GameServerState + +AllocationOverflow
(Optional) -

[Stage:Beta] -[FeatureFlag:StateAllocationFilter] -GameServerState specifies which State is the filter to be used when attempting to retrieve a GameServer -via Allocation. Defaults to “Ready”. The only other option is “Allocated”, which can be used in conjunction with -label/annotation/player selectors to retrieve an already Allocated GameServer.

+

[Stage: Alpha] +[FeatureFlag:FleetAllocationOverflow] +Labels and Annotations to apply to GameServers when the number of Allocated GameServers drops below +the desired replicas on the underlying GameServerSet

-players
+scheduling
- -PlayerSelector - +agones.dev/agones/pkg/apis.SchedulingStrategy
-(Optional) -

[Stage:Alpha] -[FeatureFlag:PlayerAllocationFilter] -Players provides a filter on minimum and maximum values for player capacity when retrieving a GameServer -through Allocation. Defaults to no limits.

+

Scheduling strategy. Defaults to “Packed”.

-counters
+template
- -map[string]agones.dev/agones/pkg/apis/allocation/v1.CounterSelector + +GameServerTemplateSpec
-(Optional) -

(Alpha, CountsAndLists feature flag) Counters provides filters on minimum and maximum values -for a Counter’s count and available capacity when retrieving a GameServer through Allocation. -Defaults to no limits.

+

Template the GameServer template to apply for this GameServerSet

+
-lists
+status
- -map[string]agones.dev/agones/pkg/apis/allocation/v1.ListSelector + +GameServerSetStatus
-(Optional) -

(Alpha, CountsAndLists feature flag) Lists provides filters on minimum and maximum values -for List capacity, and for the existence of a value in a List, when retrieving a GameServer -through Allocation. Defaults to no limits.

-

ListSelector +

AggregatedPlayerStatus

(Appears on: -GameServerSelector) +FleetStatus, +GameServerSetStatus)

-

ListSelector is the filter options for a GameServer based on List available capacity and/or the -existence of a value in a List. -0 for MaxAvailable means unlimited maximum. Default for integer fields: 0 -“” for ContainsValue means ignore field. Default for string field: “”

+

AggregatedPlayerStatus stores total player tracking values

@@ -4049,17 +4195,7 @@

ListSelector

- - - -
-containsValue
- -string - -
-
-minAvailable
+count
int64 @@ -4069,7 +4205,7 @@

ListSelector

-maxAvailable
+capacity
int64 @@ -4079,14 +4215,17 @@

ListSelector

-

MetaPatch +

AllocationOverflow

(Appears on: -GameServerAllocationSpec) +FleetSpec, +GameServerSetSpec)

-

MetaPatch is the metadata used to patch the GameServer metadata on allocation

+

AllocationOverflow specifies what labels and/or annotations to apply on Allocated GameServers +if the desired number of the underlying GameServerSet drops below the number of Allocated GameServers +attached to it.

@@ -4104,6 +4243,8 @@

MetaPatch

@@ -4114,18 +4255,21 @@

MetaPatch

+(Optional) +

Labels to be applied to the GameServer

+(Optional) +

Annotations to be applied to the GameServer

-

MultiClusterSetting +

CounterStatus

(Appears on: -GameServerAllocationSpec) +GameServerSpec, +GameServerStatus)

-

MultiClusterSetting specifies settings for multi-cluster allocation.

+

CounterStatus stores the current counter values

@@ -4137,9 +4281,9 @@

MultiClusterSetting

+ + + +
-enabled
+count
-bool +int64
@@ -4147,26 +4291,70 @@

MultiClusterSetting

-policySelector
+capacity
- -Kubernetes meta/v1.LabelSelector +int64 + +
+
+

Eviction +

+

+(Appears on: +GameServerSpec, +GameServerStatus) +

+

+

Eviction specifies the eviction tolerance of the GameServer

+

+ + + + + + + + + +
FieldDescription
+safe
+ + +EvictionSafe
+

(Alpha, SafeToEvict feature flag) +Game server supports termination via SIGTERM: +- Always: Allow eviction for both Cluster Autoscaler and node drain for upgrades +- OnUpgrade: Allow eviction for upgrades alone +- Never (default): Pod should run to completion

-

PlayerSelector +

EvictionSafe +(string alias)

+

+(Appears on: +Eviction) +

+

+

EvictionSafe specified whether the game server supports termination via SIGTERM

+

+

FleetSpec

(Appears on: -GameServerSelector) +Fleet)

-

PlayerSelector is the filter options for a GameServer based on player counts

+

FleetSpec is the spec for a Fleet

@@ -4178,39 +4366,80 @@

PlayerSelector

+ + + + + + + + + + + +
-minAvailable
+replicas
-int64 +int32
+

Replicas are the number of GameServers that should be in this set. Defaults to 0.

-maxAvailable
+allocationOverflow
-int64 + +AllocationOverflow + + +
+(Optional) +

[Stage: Alpha] +[FeatureFlag:FleetAllocationOverflow] +Labels and/or Annotations to apply to overflowing GameServers when the number of Allocated GameServers is more +than the desired replicas on the underlying GameServerSet

+
+strategy
+ + +Kubernetes apps/v1.DeploymentStrategy + + +
+

Deployment strategy

+
+scheduling
+ +agones.dev/agones/pkg/apis.SchedulingStrategy + +
+

Scheduling strategy. Defaults to “Packed”.

+
+template
+ + +GameServerTemplateSpec +
+

Template the GameServer template to apply for this Fleet

-

Priority +

FleetStatus

(Appears on: -GameServerAllocationSpec) +Fleet, +FleetAutoscaleRequest)

-

Priority is a sorting option for GameServers with Counters or Lists based on the count or -number of items in a List. -PriorityType: Sort by a “Counter” or a “List”. -Key: The name of the Counter or List. If not found on the GameServer, has no impact. -Order: Sort by “Ascending” or “Descending”. Default is “Descending” so bigger count is preferred. -“Ascending” would be smaller count is preferred.

+

FleetStatus is the status of a Fleet

@@ -4218,53 +4447,80 @@

Priority

- - + + + + + + + + + +
Field Description
+replicas
+ +int32 + +
+

Replicas the total number of current GameServer replicas

+
+readyReplicas
+ +int32 + +
+

ReadyReplicas are the number of Ready GameServer replicas

+
-priorityType
+reservedReplicas
-string +int32
+

ReservedReplicas are the total number of Reserved GameServer replicas in this fleet. +Reserved instances won’t be deleted on scale down, but won’t cause an autoscaler to scale up.

-key
+allocatedReplicas
-string +int32
+

AllocatedReplicas are the number of Allocated GameServer replicas

-order
+players
-string + +AggregatedPlayerStatus +
+(Optional) +

[Stage:Alpha] +[FeatureFlag:PlayerTracking] +Players are the current total player capacity and count for this Fleet

-
-

autoscaling.agones.dev/v1

+

GameServerPort +

-

Package v1 is the v1 version of the API.

+(Appears on: +GameServerSpec)

-Resource Types: - -

FleetAutoscaler -

-

FleetAutoscaler is the data structure for a FleetAutoscaler resource

+

GameServerPort defines a set of Ports that +are to be exposed via the GameServer

@@ -4276,112 +4532,89 @@

FleetAutoscaler

- - - - - - - -
-apiVersion
-string
- -autoscaling.agones.dev/v1 - -
-kind
-string -
FleetAutoscaler
-metadata
+name
- -Kubernetes meta/v1.ObjectMeta - +string
-Refer to the Kubernetes API documentation for the fields of the -metadata field. +

Name is the descriptive name of the port

-spec
+portPolicy
- -FleetAutoscalerSpec + +PortPolicy
-
-
- +

PortPolicy defines the policy for how the HostPort is populated. +Dynamic port will allocate a HostPort within the selected MIN_PORT and MAX_PORT range passed to the controller +at installation time. +When Static portPolicy is specified, HostPort is required, to specify the port that game clients will +connect to

+ + - -
-fleetName
+container
string
+(Optional) +

Container is the name of the container on which to open the port. Defaults to the game server container.

-policy
+containerPort
- -FleetAutoscalerPolicy - +int32
-

Autoscaling policy

+

ContainerPort is the port that is being opened on the specified container’s process

-sync
+hostPort
- -FleetAutoscalerSync - +int32
-(Optional) -

[Stage:Beta] -[FeatureFlag:CustomFasSyncInterval] -Sync defines when FleetAutoscalers runs autoscaling

-
+

HostPort the port exposed on the host for clients to connect to

-status
+protocol
- -FleetAutoscalerStatus + +Kubernetes core/v1.Protocol
+

Protocol is the network protocol being used. Defaults to UDP. TCP and TCPUDP are other options.

-

BufferPolicy +

GameServerSetSpec

(Appears on: -FleetAutoscalerPolicy) +GameServerSet)

-

BufferPolicy controls the desired behavior of the buffer policy.

+

GameServerSetSpec the specification for GameServerSet

@@ -4393,59 +4626,66 @@

BufferPolicy

+ + + +
-maxReplicas
+replicas
int32
-

MaxReplicas is the maximum amount of replicas that the fleet may have. -It must be bigger than both MinReplicas and BufferSize

+

Replicas are the number of GameServers that should be in this set

-minReplicas
+allocationOverflow
-int32 + +AllocationOverflow +
-

MinReplicas is the minimum amount of replicas that the fleet must have -If zero, it is ignored. -If non zero, it must be smaller than MaxReplicas and bigger than BufferSize

+(Optional) +

[Stage: Alpha] +[FeatureFlag:FleetAllocationOverflow] +Labels and Annotations to apply to GameServers when the number of Allocated GameServers drops below +the desired replicas on the underlying GameServerSet

-bufferSize
+scheduling
-k8s.io/apimachinery/pkg/util/intstr.IntOrString +agones.dev/agones/pkg/apis.SchedulingStrategy
-

BufferSize defines how many replicas the autoscaler tries to have ready all the time -Value can be an absolute number (ex: 5) or a percentage of desired gs instances (ex: 15%) -Absolute number is calculated from percentage by rounding up. -Example: when this is set to 20%, the autoscaler will make sure that 20% -of the fleet’s game server replicas are ready. When this is set to 20, -the autoscaler will make sure that there are 20 available game servers -Must be bigger than 0 -Note: by “ready” we understand in this case “non-allocated”; this is done to ensure robustness -and computation stability in different edge case (fleet just created, not enough -capacity in the cluster etc)

+

Scheduling strategy. Defaults to “Packed”.

+
+template
+ + +GameServerTemplateSpec + + +
+

Template the GameServer template to apply for this GameServerSet

-

FixedIntervalSync +

GameServerSetStatus

(Appears on: -FleetAutoscalerSync) +GameServerSet)

-

FixedIntervalSync controls the desired behavior of the fixed interval based sync.

+

GameServerSetStatus is the status of a GameServerSet

@@ -4457,93 +4697,86 @@

FixedIntervalSync

- -
-seconds
+replicas
int32
-

Seconds defines how often we run fleet autoscaling in seconds

+

Replicas is the total number of current GameServer replicas

-

FleetAutoscaleRequest -

-

-(Appears on: -FleetAutoscaleReview) -

-

-

FleetAutoscaleRequest defines the request to webhook autoscaler endpoint

-

- - - - + + - -
FieldDescription +readyReplicas
+ +int32 + +
+

ReadyReplicas is the number of Ready GameServer replicas

+
-uid
+reservedReplicas
-k8s.io/apimachinery/pkg/types.UID +int32
-

UID is an identifier for the individual request/response. It allows us to distinguish instances of requests which are -otherwise identical (parallel requests, requests when earlier requests did not modify etc) -The UID is meant to track the round trip (request/response) between the Autoscaler and the WebHook, not the user request. -It is suitable for correlating log entries between the webhook and apiserver, for either auditing or debugging.

+

ReservedReplicas is the number of Reserved GameServer replicas

-name
+allocatedReplicas
-string +int32
-

Name is the name of the Fleet being scaled

+

AllocatedReplicas is the number of Allocated GameServer replicas

-namespace
+shutdownReplicas
-string +int32
-

Namespace is the namespace associated with the request (if any).

+

ShutdownReplicas is the number of Shutdown GameServers replicas

-status
+players
- -FleetStatus + +AggregatedPlayerStatus
-

The Fleet’s status values

+(Optional) +

[Stage:Alpha] +[FeatureFlag:PlayerTracking] +Players is the current total player capacity and count for this GameServerSet

-

FleetAutoscaleResponse +

GameServerSpec

(Appears on: -FleetAutoscaleReview) +GameServer, +GameServerTemplateSpec)

-

FleetAutoscaleResponse defines the response of webhook autoscaler endpoint

+

GameServerSpec is the spec for a GameServer resource

@@ -4555,158 +4788,153 @@

FleetAutoscaleResponse

+ + + + - -
-uid
+container
+ +string + +
+

Container specifies which Pod container is the game server. Only required if there is more than one +container defined

+
+ports
-k8s.io/apimachinery/pkg/types.UID + +[]GameServerPort +
-

UID is an identifier for the individual request/response. -This should be copied over from the corresponding FleetAutoscaleRequest.

+

Ports are the array of ports that can be exposed via the game server

-scale
+health
-bool + +Health +
-

Set to false if no scaling should occur to the Fleet

+

Health configures health checking

-replicas
+scheduling
-int32 +agones.dev/agones/pkg/apis.SchedulingStrategy
-

The targeted replica count

+

Scheduling strategy. Defaults to “Packed”

-

FleetAutoscaleReview -

-

-

FleetAutoscaleReview is passed to the webhook with a populated Request value, -and then returned with a populated Response.

-

- - - - - - - - - -
FieldDescription
-request
+sdkServer
- -FleetAutoscaleRequest + +SdkServer
+

SdkServer specifies parameters for the Agones SDK Server sidecar container

-response
+template
- -FleetAutoscaleResponse + +Kubernetes core/v1.PodTemplateSpec
+

Template describes the Pod that will be created for the GameServer

-

FleetAutoscalerPolicy -

-

-(Appears on: -FleetAutoscalerSpec) -

-

-

FleetAutoscalerPolicy describes how to scale a fleet

-

- - - - + + - -
FieldDescription +players
+ + +PlayersSpec + + +
+(Optional) +

(Alpha, PlayerTracking feature flag) Players provides the configuration for player tracking features.

+
-type
+counters
- -FleetAutoscalerPolicyType + +map[string]agones.dev/agones/pkg/apis/agones/v1.CounterStatus
-

Type of autoscaling policy.

+(Optional) +

(Alpha, CountsAndLists feature flag) Counters and Lists provides the configuration for generic tracking features.

-buffer
+lists
- -BufferPolicy + +map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus
-(Optional) -

Buffer policy config params. Present only if FleetAutoscalerPolicyType = Buffer.

-webhook
+eviction
- -WebhookPolicy + +Eviction
(Optional) -

Webhook policy config params. Present only if FleetAutoscalerPolicyType = Webhook.

+

(Alpha, SafeToEvict feature flag) Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

-

FleetAutoscalerPolicyType +

GameServerState (string alias)

(Appears on: -FleetAutoscalerPolicy) +GameServerSelector, +GameServerStatus)

-

FleetAutoscalerPolicyType is the policy for autoscaling -for a given Fleet

+

GameServerState is the state for the GameServer

-

FleetAutoscalerSpec +

GameServerStatus

(Appears on: -FleetAutoscaler) +GameServer)

-

FleetAutoscalerSpec is the spec for a Fleet Scaler

+

GameServerStatus is the status for a GameServer resource

@@ -4718,133 +4946,129 @@

FleetAutoscalerSpec

- -
-fleetName
+state
-string + +GameServerState +
+

GameServerState is the current state of a GameServer, e.g. Creating, Starting, Ready, etc

-policy
+ports
- -FleetAutoscalerPolicy + +[]GameServerStatusPort
-

Autoscaling policy

-sync
+address
- -FleetAutoscalerSync - +string
-(Optional) -

[Stage:Beta] -[FeatureFlag:CustomFasSyncInterval] -Sync defines when FleetAutoscalers runs autoscaling

-

FleetAutoscalerStatus -

-

-(Appears on: -FleetAutoscaler) -

-

-

FleetAutoscalerStatus defines the current status of a FleetAutoscaler

-

- - - - + + - -
FieldDescription +nodeName
+ +string + +
+
-currentReplicas
+reservedUntil
-int32 + +Kubernetes meta/v1.Time +
-

CurrentReplicas is the current number of gameserver replicas -of the fleet managed by this autoscaler, as last seen by the autoscaler

-desiredReplicas
+players
-int32 + +PlayerStatus +
-

DesiredReplicas is the desired number of gameserver replicas -of the fleet managed by this autoscaler, as last calculated by the autoscaler

+(Optional) +

[Stage:Alpha] +[FeatureFlag:PlayerTracking]

-lastScaleTime
+counters
- -Kubernetes meta/v1.Time + +map[string]agones.dev/agones/pkg/apis/agones/v1.CounterStatus
(Optional) -

lastScaleTime is the last time the FleetAutoscaler scaled the attached fleet,

+

(Alpha, CountsAndLists feature flag) Counters and Lists provides the configuration for generic tracking features.

-ableToScale
+lists
-bool + +map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus +
-

AbleToScale indicates that we can access the target fleet

+(Optional)
-scalingLimited
+eviction
-bool + +Eviction +
-

ScalingLimited indicates that the calculated scale would be above or below the range -defined by MinReplicas and MaxReplicas, and has thus been capped.

+(Optional) +

(Alpha, SafeToEvict feature flag) Eviction specifies the eviction tolerance of the GameServer.

-

FleetAutoscalerSync +

GameServerStatusPort

(Appears on: -FleetAutoscalerSpec) +GameServerAllocationStatus, +GameServerStatus)

-

FleetAutoscalerSync describes when to sync a fleet

+

GameServerStatusPort shows the port that was allocated to a +GameServer.

@@ -4856,52 +5080,35 @@

FleetAutoscalerSync

- - - -
-type
+name
- -FleetAutoscalerSyncType - +string
-

Type of autoscaling sync.

-fixedInterval
- - -FixedIntervalSync - - -
-(Optional) -

FixedInterval config params. Present only if FleetAutoscalerSyncType = FixedInterval.

-
-

FleetAutoscalerSyncType -(string alias)

-

-(Appears on: -FleetAutoscalerSync) -

-

-

FleetAutoscalerSyncType is the sync strategy for a given Fleet

-

-

WebhookPolicy +port
+ +int32 + + + + + + + +

GameServerTemplateSpec

(Appears on: -FleetAutoscalerPolicy) +FleetSpec, +GameServerSetSpec)

-

WebhookPolicy controls the desired behavior of the webhook policy. -It contains the description of the webhook autoscaler service -used to form url which is accessible inside the cluster

+

GameServerTemplateSpec is a template for GameServers

@@ -4913,147 +5120,141 @@

WebhookPolicy

@@ -5414,14 +5721,15 @@

Fleet

-url
+metadata
-string + +Kubernetes meta/v1.ObjectMeta +
-(Optional) -

url gives the location of the webhook, in standard URL form -(scheme://host:port/path). Exactly one of url or service -must be specified.

-

The host should not refer to a service running in the cluster; use -the service field instead. The host might be resolved via external -DNS in some apiservers (e.g., kube-apiserver cannot resolve -in-cluster DNS as that would be a layering violation). host may -also be an IP address.

-

Please note that using localhost or 127.0.0.1 as a host is -risky unless you take great care to run this webhook on all hosts -which run an apiserver which might need to make calls to this -webhook. Such installs are likely to be non-portable, i.e., not easy -to turn up in a new cluster.

-

The scheme must be “https”; the URL must begin with “https://”.

-

A path is optional, and if present may be any string permissible in -a URL. You may use the path to pass an arbitrary string to the -webhook, for example, a cluster identifier.

-

Attempting to use a user or basic auth e.g. “user:password@” is not -allowed. Fragments (“#…”) and query parameters (“?…”) are not -allowed, either.

+Refer to the Kubernetes API documentation for the fields of the +metadata field.
-service
+spec
- -Kubernetes admissionregistration/v1.ServiceReference + +GameServerSpec
-(Optional) -

service is a reference to the service for this webhook. Either -service or url must be specified.

-

If the webhook is running within the cluster, then you should use service.

+
+
+ + + + - -
+container
+ +string + +
+

Container specifies which Pod container is the game server. Only required if there is more than one +container defined

-caBundle
+ports
-[]byte + +[]GameServerPort +
-(Optional) -

caBundle is a PEM encoded CA bundle which will be used to validate the webhook’s server certificate. -If unspecified, system trust roots on the apiserver are used.

+

Ports are the array of ports that can be exposed via the game server

-
-

multicluster.agones.dev/v1

-

-

Package v1 is the v1 version of the API.

-

-Resource Types: - -

GameServerAllocationPolicy -

-

-

GameServerAllocationPolicy is the Schema for the gameserverallocationpolicies API

-

- - - - + + - - +scheduling
+ +agones.dev/agones/pkg/apis.SchedulingStrategy + + + -
FieldDescription +health
+ + +Health + + +
+

Health configures health checking

+
-apiVersion
-string
- -multicluster.agones.dev/v1 - +

Scheduling strategy. Defaults to “Packed”

-kind
-string +sdkServer
+ + +SdkServer + + +
+

SdkServer specifies parameters for the Agones SDK Server sidecar container

GameServerAllocationPolicy
-metadata
+template
- -Kubernetes meta/v1.ObjectMeta + +Kubernetes core/v1.PodTemplateSpec
-Refer to the Kubernetes API documentation for the fields of the -metadata field. +

Template describes the Pod that will be created for the GameServer

-spec
+players
- -GameServerAllocationPolicySpec + +PlayersSpec
-
-
- +(Optional) +

(Alpha, PlayerTracking feature flag) Players provides the configuration for player tracking features.

+ +
-priority
+counters
-int32 + +map[string]agones.dev/agones/pkg/apis/agones/v1.CounterStatus +
+(Optional) +

(Alpha, CountsAndLists feature flag) Counters and Lists provides the configuration for generic tracking features.

-weight
+lists
-int + +map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus +
@@ -5061,14 +5262,16 @@

GameServerAllocat

-connectionInfo
+eviction
- -ClusterConnectionInfo + +Eviction
+(Optional) +

(Alpha, SafeToEvict feature flag) Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

@@ -5076,14 +5279,14 @@

GameServerAllocat

-

ClusterConnectionInfo +

Health

(Appears on: -GameServerAllocationPolicySpec) +GameServerSpec)

-

ClusterConnectionInfo defines the connection information for a cluster

+

Health configures health checking on the GameServer

@@ -5095,67 +5298,98 @@

ClusterConnectionInfo

+ + + +
-clusterName
+disabled
-string +bool
-

Optional: the name of the targeted cluster

+

Disabled is whether health checking is disabled or not

-allocationEndpoints
+periodSeconds
-[]string +int32
-

The endpoints for the allocator service in the targeted cluster. -If the AllocationEndpoints is not set, the allocation happens on local cluster. -If there are multiple endpoints any of the endpoints that can handle allocation request should suffice

+

PeriodSeconds is the number of seconds each health ping has to occur in

-secretName
+failureThreshold
-string +int32
-

The name of the secret that contains TLS client certificates to connect the allocator server in the targeted cluster

+

FailureThreshold how many failures in a row constitutes unhealthy

-namespace
+initialDelaySeconds
-string +int32 + +
+

InitialDelaySeconds initial delay before checking health

+
+

ListStatus +

+

+(Appears on: +GameServerSpec, +GameServerStatus) +

+

+

ListStatus stores the current list values

+

+ + + + + + + + + +
FieldDescription
+capacity
+ +int64
-

The cluster namespace from which to allocate gameservers

-serverCa
+values
-[]byte +[]string
-

The PEM encoded server CA, used by the allocator client to authenticate the remote server.

-

ConnectionInfoIterator +

PlayerStatus

-

ConnectionInfoIterator an iterator on ClusterConnectionInfo

+(Appears on: +GameServerStatus) +

+

+

PlayerStatus stores the current player capacity values

@@ -5167,58 +5401,82 @@

ConnectionInfoIterato

+ +
-currPriority
+count
-int +int64
-

currPriority Current priority index from the orderedPriorities

-orderedPriorities
+capacity
-[]int32 +int64
-

orderedPriorities list of ordered priorities

-priorityToCluster
+ids
-map[int32]map[string][]*agones.dev/agones/pkg/apis/multicluster/v1.GameServerAllocationPolicy +[]string
-

priorityToCluster Map of priority to cluster-policies map

+

PlayersSpec +

+

+(Appears on: +GameServerSpec) +

+

+

PlayersSpec tracks the initial player capacity

+

+ + + + + + + +
FieldDescription
-clusterBlackList
+initialCapacity
-map[string]bool +int64
-

clusterBlackList the cluster blacklist for the clusters that has already returned

-

GameServerAllocationPolicySpec +

PortPolicy +(string alias)

+

+(Appears on: +GameServerPort) +

+

+

PortPolicy is the port policy for the GameServer

+

+

SdkServer

(Appears on: -GameServerAllocationPolicy) +GameServerSpec)

-

GameServerAllocationPolicySpec defines the desired state of GameServerAllocationPolicy

+

SdkServer specifies parameters for the Agones SDK Server sidecar container

@@ -5230,55 +5488,64 @@

GameServerAll

-priority
+logLevel
-int32 + +SdkServerLogLevel +
+

LogLevel for SDK server (sidecar) logs. Defaults to “Info”

-weight
+grpcPort
-int +int32
+

GRPCPort is the port on which the SDK Server binds the gRPC server to accept incoming connections

-connectionInfo
+httpPort
- -ClusterConnectionInfo - +int32
+

HTTPPort is the port on which the SDK Server binds the HTTP gRPC gateway server to accept incoming connections

+

SdkServerLogLevel +(string alias)

+

+(Appears on: +SdkServer) +

+

+

SdkServerLogLevel is the log level for SDK server (sidecar) logs

+


-

agones.dev/v1

+

allocation.agones.dev/v1

Package v1 is the v1 version of the API.

Resource Types: -

Fleet +

GameServerAllocation

-

Fleet is the data structure for a Fleet resource

+

GameServerAllocation is the data structure for allocating against a set of +GameServers, defined selectors selectors

@@ -5294,7 +5561,7 @@

Fleet string

@@ -5303,7 +5570,7 @@

Fleet kind
string -

+ @@ -5334,43 +5601,82 @@

Fleet

-agones.dev/v1 +allocation.agones.dev/v1
FleetGameServerAllocation
@@ -5323,8 +5590,8 @@

Fleet

spec
- -FleetSpec + +GameServerAllocationSpec
+ + + + + + + + @@ -5386,15 +5692,16 @@

Fleet

-replicas
+multiClusterSetting
-int32 + +MultiClusterSetting +
-

Replicas are the number of GameServers that should be in this set. Defaults to 0.

+

MultiClusterPolicySelector if specified, multi-cluster policies are applied. +Otherwise, allocation will happen locally.

-allocationOverflow
+required
- -AllocationOverflow + +GameServerSelector + + +
+

Deprecated: use field Selectors instead. If Selectors is set, this field is ignored. +Required is the GameServer selector from which to choose GameServers from. +Defaults to all GameServers.

+
+preferred
+ + +[]GameServerSelector + + +
+

Deprecated: use field Selectors instead. If Selectors is set, this field is ignored. +Preferred is an ordered list of preferred GameServer selectors +that are optional to be fulfilled, but will be searched before the required selector. +If the first selector is not matched, the selection attempts the second selector, and so on. +If any of the preferred selectors are matched, the required selector is not considered. +This is useful for things like smoke testing of new game servers.

+
+priorities
+ + +[]Priority
(Optional) -

[Stage: Alpha] -[FeatureFlag:FleetAllocationOverflow] -Labels and Annotations to apply to GameServers when the number of Allocated GameServers drops below -the desired replicas on the underlying GameServerSet

+

(Alpha, CountsAndLists feature flag) The first Priority on the array of Priorities is the most +important for sorting. The allocator will use the first priority for sorting GameServers in the +Selector set, and will only use any following priority for tie-breaking during sort. +Impacts which GameServer is checked first.

-strategy
+selectors
- -Kubernetes apps/v1.DeploymentStrategy + +[]GameServerSelector
-

Deployment strategy

+

Ordered list of GameServer label selectors. +If the first selector is not matched, the selection attempts the second selector, and so on. +This is useful for things like smoke testing of new game servers. +Note: This field can only be set if neither Required or Preferred is set.

-template
+metadata
- -GameServerTemplateSpec + +MetaPatch
-

Template the GameServer template to apply for this Fleet

+

MetaPatch is optional custom metadata that is added to the game server at allocation +You can use this to tell the server necessary session data

@@ -5404,8 +5711,8 @@

Fleet

status
- -FleetStatus + +GameServerAllocationStatus
-

GameServer +

CounterSelector

-

GameServer is the data structure for a GameServer resource. -It is worth noting that while there is a GameServerStatus Status entry for the GameServer, it is not -defined as a subresource - unlike Fleet and other Agones resources. -This is so that we can retain the ability to change multiple aspects of a GameServer in a single atomic operation, -which is particularly useful for operations such as allocation.

+(Appears on: +GameServerSelector) +

+

+

CounterSelector is the filter options for a GameServer based on the count and/or available capacity. +0 for MaxCount or MaxAvailable means unlimited maximum. Default for all fields: 0

@@ -5433,84 +5741,141 @@

GameServer

+minCount
+ +int64 + + + - + + + + + + + +
-apiVersion
-string
- -agones.dev/v1 -
-kind
-string +maxCount
+ +int64 + +
GameServer
-metadata
+minAvailable
- -Kubernetes meta/v1.ObjectMeta +int64 + +
+
+maxAvailable
+ +int64 + +
+
+

GameServerAllocationSpec +

+

+(Appears on: +GameServerAllocation) +

+

+

GameServerAllocationSpec is the spec for a GameServerAllocation

+

+ + + + + + + + + +
FieldDescription
+multiClusterSetting
+ + +MultiClusterSetting
-Refer to the Kubernetes API documentation for the fields of the -metadata field. +

MultiClusterPolicySelector if specified, multi-cluster policies are applied. +Otherwise, allocation will happen locally.

-spec
+required
- -GameServerSpec + +GameServerSelector
-
-
- +

Deprecated: use field Selectors instead. If Selectors is set, this field is ignored. +Required is the GameServer selector from which to choose GameServers from. +Defaults to all GameServers.

+ + @@ -5521,70 +5886,91 @@

GameServer

+ +
-container
+preferred
-string + +[]GameServerSelector +
-

Container specifies which Pod container is the game server. Only required if there is more than one -container defined

+

Deprecated: use field Selectors instead. If Selectors is set, this field is ignored. +Preferred is an ordered list of preferred GameServer selectors +that are optional to be fulfilled, but will be searched before the required selector. +If the first selector is not matched, the selection attempts the second selector, and so on. +If any of the preferred selectors are matched, the required selector is not considered. +This is useful for things like smoke testing of new game servers.

-ports
+priorities
- -[]GameServerPort + +[]Priority
-

Ports are the array of ports that can be exposed via the game server

+(Optional) +

(Alpha, CountsAndLists feature flag) The first Priority on the array of Priorities is the most +important for sorting. The allocator will use the first priority for sorting GameServers in the +Selector set, and will only use any following priority for tie-breaking during sort. +Impacts which GameServer is checked first.

-health
+selectors
- -Health + +[]GameServerSelector
-

Health configures health checking

+

Ordered list of GameServer label selectors. +If the first selector is not matched, the selection attempts the second selector, and so on. +This is useful for things like smoke testing of new game servers. +Note: This field can only be set if neither Required or Preferred is set.

-

Scheduling strategy. Defaults to “Packed”

+

Scheduling strategy. Defaults to “Packed”.

-sdkServer
+metadata
- -SdkServer + +MetaPatch
-

SdkServer specifies parameters for the Agones SDK Server sidecar container

+

MetaPatch is optional custom metadata that is added to the game server at allocation +You can use this to tell the server necessary session data

+

GameServerAllocationState +(string alias)

+

+(Appears on: +GameServerAllocationStatus) +

+

+

GameServerAllocationState is the Allocation state

+

+

GameServerAllocationStatus +

+

+(Appears on: +GameServerAllocation) +

+

+

GameServerAllocationStatus is the status for an GameServerAllocation resource

+

+ + + + + + + + - -
FieldDescription
-template
+state
- -Kubernetes core/v1.PodTemplateSpec + +GameServerAllocationState
-

Template describes the Pod that will be created for the GameServer

+

GameServerState is the current state of an GameServerAllocation, e.g. Allocated, or UnAllocated

-players
+gameServerName
- -PlayersSpec - +string
-(Optional) -

(Alpha, PlayerTracking feature flag) Players provides the configuration for player tracking features.

-counters
+ports
- -map[string]agones.dev/agones/pkg/apis/agones/v1.CounterStatus + +[]GameServerStatusPort
-(Optional) -

(Alpha, CountsAndLists feature flag) Counters and Lists provides the configuration for generic tracking features.

-lists
+address
- -map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus - +string
@@ -5592,41 +5978,37 @@

GameServer

-eviction
+nodeName
- -Eviction - +string
-(Optional) -

(Alpha, SafeToEvict feature flag) Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

-
-status
+source
- -GameServerStatus - +string
+

If the allocation is from a remote cluster, Source is the endpoint of the remote agones-allocator. +Otherwise, Source is “local”

-

GameServerSet +

GameServerSelector

-

GameServerSet is the data structure for a set of GameServers. -This matches philosophically with the relationship between -Deployments and ReplicaSets

+(Appears on: +GameServerAllocationSpec) +

+

+

GameServerSelector contains all the filter options for selecting +a GameServer for allocation.

@@ -5638,126 +6020,100 @@

GameServerSet

- - - - - - - -
-apiVersion
-string
- -agones.dev/v1 - -
-kind
-string -
GameServerSet
-metadata
+LabelSelector
- -Kubernetes meta/v1.ObjectMeta + +Kubernetes meta/v1.LabelSelector
-Refer to the Kubernetes API documentation for the fields of the -metadata field. +

+(Members of LabelSelector are embedded into this type.) +

+

See: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/

-spec
+gameServerState
- -GameServerSetSpec + +GameServerState
-
-
- - - - - - - - - -
-replicas
- -int32 - -
-

Replicas are the number of GameServers that should be in this set

+(Optional) +

[Stage:Beta] +[FeatureFlag:StateAllocationFilter] +GameServerState specifies which State is the filter to be used when attempting to retrieve a GameServer +via Allocation. Defaults to “Ready”. The only other option is “Allocated”, which can be used in conjunction with +label/annotation/player selectors to retrieve an already Allocated GameServer.

-allocationOverflow
+players
- -AllocationOverflow + +PlayerSelector
(Optional) -

[Stage: Alpha] -[FeatureFlag:FleetAllocationOverflow] -Labels and Annotations to apply to GameServers when the number of Allocated GameServers drops below -the desired replicas on the underlying GameServerSet

-
-scheduling
- -agones.dev/agones/pkg/apis.SchedulingStrategy - -
-

Scheduling strategy. Defaults to “Packed”.

+

[Stage:Alpha] +[FeatureFlag:PlayerAllocationFilter] +Players provides a filter on minimum and maximum values for player capacity when retrieving a GameServer +through Allocation. Defaults to no limits.

-template
+counters
- -GameServerTemplateSpec + +map[string]agones.dev/agones/pkg/apis/allocation/v1.CounterSelector
-

Template the GameServer template to apply for this GameServerSet

-
+(Optional) +

(Alpha, CountsAndLists feature flag) Counters provides filters on minimum and maximum values +for a Counter’s count and available capacity when retrieving a GameServer through Allocation. +Defaults to no limits.

-status
+lists
- -GameServerSetStatus + +map[string]agones.dev/agones/pkg/apis/allocation/v1.ListSelector
+(Optional) +

(Alpha, CountsAndLists feature flag) Lists provides filters on minimum and maximum values +for List capacity, and for the existence of a value in a List, when retrieving a GameServer +through Allocation. Defaults to no limits.

-

AggregatedPlayerStatus +

ListSelector

(Appears on: -FleetStatus, -GameServerSetStatus) +GameServerSelector)

-

AggregatedPlayerStatus stores total player tracking values

+

ListSelector is the filter options for a GameServer based on List available capacity and/or the +existence of a value in a List. +0 for MaxAvailable means unlimited maximum. Default for integer fields: 0 +“” for ContainsValue means ignore field. Default for string field: “”

@@ -5769,7 +6125,17 @@

AggregatedPlayerStatus

+ + + +
-count
+containsValue
+ +string + +
+
+minAvailable
int64 @@ -5779,7 +6145,7 @@

AggregatedPlayerStatus

-capacity
+maxAvailable
int64 @@ -5789,17 +6155,14 @@

AggregatedPlayerStatus

-

AllocationOverflow +

MetaPatch

(Appears on: -FleetSpec, -GameServerSetSpec) +GameServerAllocationSpec)

-

AllocationOverflow specifies what labels and/or annotations to apply on Allocated GameServers -if the desired number of the underlying GameServerSet drops below the number of Allocated GameServers -attached to it.

+

MetaPatch is the metadata used to patch the GameServer metadata on allocation

@@ -5817,8 +6180,6 @@

AllocationOverflow

@@ -5829,21 +6190,18 @@

AllocationOverflow

-(Optional) -

Labels to be applied to the GameServer

-(Optional) -

Annotations to be applied to the GameServer

-

CounterStatus +

MultiClusterSetting

(Appears on: -GameServerSpec, -GameServerStatus) +GameServerAllocationSpec)

-

CounterStatus stores the current counter values

+

MultiClusterSetting specifies settings for multi-cluster allocation.

@@ -5855,9 +6213,9 @@

CounterStatus

-count
+enabled
-int64 +bool
@@ -5865,9 +6223,11 @@

CounterStatus

-capacity
+policySelector
-int64 + +Kubernetes meta/v1.LabelSelector +
@@ -5875,15 +6235,14 @@

CounterStatus

-

Eviction +

PlayerSelector

(Appears on: -GameServerSpec, -GameServerStatus) +GameServerSelector)

-

Eviction specifies the eviction tolerance of the GameServer

+

PlayerSelector is the filter options for a GameServer based on player counts

@@ -5895,40 +6254,39 @@

Eviction

+ + + +
-safe
+minAvailable
- -EvictionSafe - +int64 + +
+
+maxAvailable
+ +int64
-

(Alpha, SafeToEvict feature flag) -Game server supports termination via SIGTERM: -- Always: Allow eviction for both Cluster Autoscaler and node drain for upgrades -- OnUpgrade: Allow eviction for upgrades alone -- Never (default): Pod should run to completion

-

EvictionSafe -(string alias)

-

-(Appears on: -Eviction) -

-

-

EvictionSafe specified whether the game server supports termination via SIGTERM

-

-

FleetSpec +

Priority

(Appears on: -Fleet) +GameServerAllocationSpec)

-

FleetSpec is the spec for a Fleet

+

Priority is a sorting option for GameServers with Counters or Lists based on the count or +number of items in a List. +PriorityType: Sort by a “Counter” or a “List”. +Key: The name of the Counter or List. If not found on the GameServer, has no impact. +Order: Sort by “Ascending” or “Descending”. Default is “Descending” so bigger count is preferred. +“Ascending” would be smaller count is preferred.

@@ -5940,80 +6298,49 @@

FleetSpec

- - - - - - - -
-replicas
- -int32 - -
-

Replicas are the number of GameServers that should be in this set. Defaults to 0.

-
-allocationOverflow
- - -AllocationOverflow - - -
-(Optional) -

[Stage: Alpha] -[FeatureFlag:FleetAllocationOverflow] -Labels and Annotations to apply to GameServers when the number of Allocated GameServers drops below -the desired replicas on the underlying GameServerSet

-
-strategy
+priorityType
- -Kubernetes apps/v1.DeploymentStrategy - +string
-

Deployment strategy

-scheduling
+key
-agones.dev/agones/pkg/apis.SchedulingStrategy +string
-

Scheduling strategy. Defaults to “Packed”.

-template
+order
- -GameServerTemplateSpec - +string
-

Template the GameServer template to apply for this Fleet

-

FleetStatus -

+
+

autoscaling.agones.dev/v1

-(Appears on: -Fleet, -FleetAutoscaleRequest) +

Package v1 is the v1 version of the API.

+Resource Types: + +

FleetAutoscaler +

-

FleetStatus is the status of a Fleet

+

FleetAutoscaler is the data structure for a FleetAutoscaler resource

@@ -6025,170 +6352,112 @@

FleetStatus

- - - - - - - - +apiVersion
+string - + - - -
-replicas
- -int32 - -
-

Replicas the total number of current GameServer replicas

-
-readyReplicas
- -int32 - -
-

ReadyReplicas are the number of Ready GameServer replicas

-
-reservedReplicas
- -int32 - -
-

ReservedReplicas are the total number of Reserved GameServer replicas in this fleet. -Reserved instances won’t be deleted on scale down, but won’t cause an autoscaler to scale up.

+ +autoscaling.agones.dev/v1 +
-allocatedReplicas
- -int32 - -
-

AllocatedReplicas are the number of Allocated GameServer replicas

+kind
+string
FleetAutoscaler
-players
+metadata
- -AggregatedPlayerStatus + +Kubernetes meta/v1.ObjectMeta
-(Optional) -

[Stage:Alpha] -[FeatureFlag:PlayerTracking] -Players are the current total player capacity and count for this Fleet

-
-

GameServerPort -

-

-(Appears on: -GameServerSpec) -

-

-

GameServerPort defines a set of Ports that -are to be exposed via the GameServer

-

- - - - - - - - - - - - +
+
+
FieldDescription
-name
- -string - -
-

Name is the descriptive name of the port

+Refer to the Kubernetes API documentation for the fields of the +metadata field.
-portPolicy
+spec
- -PortPolicy + +FleetAutoscalerSpec
-

PortPolicy defines the policy for how the HostPort is populated. -Dynamic port will allocate a HostPort within the selected MIN_PORT and MAX_PORT range passed to the controller -at installation time. -When Static portPolicy is specified, HostPort is required, to specify the port that game clients will -connect to

-
+ +
-container
+fleetName
string
-(Optional) -

Container is the name of the container on which to open the port. Defaults to the game server container.

-containerPort
+policy
-int32 + +FleetAutoscalerPolicy +
-

ContainerPort is the port that is being opened on the specified container’s process

+

Autoscaling policy

-hostPort
+sync
-int32 + +FleetAutoscalerSync +
-

HostPort the port exposed on the host for clients to connect to

+(Optional) +

[Stage:Beta] +[FeatureFlag:CustomFasSyncInterval] +Sync defines when FleetAutoscalers runs autoscaling

+
-protocol
+status
- -Kubernetes core/v1.Protocol + +FleetAutoscalerStatus -

Protocol is the network protocol being used. Defaults to UDP. TCP and TCPUDP are other options.

-

GameServerSetSpec +

BufferPolicy

(Appears on: -GameServerSet) +FleetAutoscalerPolicy)

-

GameServerSetSpec the specification for GameServerSet

+

BufferPolicy controls the desired behavior of the buffer policy.

@@ -6200,66 +6469,59 @@

GameServerSetSpec

- - - -
-replicas
+maxReplicas
int32
-

Replicas are the number of GameServers that should be in this set

-
-allocationOverflow
- - -AllocationOverflow - - -
-(Optional) -

[Stage: Alpha] -[FeatureFlag:FleetAllocationOverflow] -Labels and Annotations to apply to GameServers when the number of Allocated GameServers drops below -the desired replicas on the underlying GameServerSet

+

MaxReplicas is the maximum amount of replicas that the fleet may have. +It must be bigger than both MinReplicas and BufferSize

-scheduling
+minReplicas
-agones.dev/agones/pkg/apis.SchedulingStrategy +int32
-

Scheduling strategy. Defaults to “Packed”.

+

MinReplicas is the minimum amount of replicas that the fleet must have +If zero, it is ignored. +If non zero, it must be smaller than MaxReplicas and bigger than BufferSize

-template
+bufferSize
- -GameServerTemplateSpec - +k8s.io/apimachinery/pkg/util/intstr.IntOrString
-

Template the GameServer template to apply for this GameServerSet

+

BufferSize defines how many replicas the autoscaler tries to have ready all the time +Value can be an absolute number (ex: 5) or a percentage of desired gs instances (ex: 15%) +Absolute number is calculated from percentage by rounding up. +Example: when this is set to 20%, the autoscaler will make sure that 20% +of the fleet’s game server replicas are ready. When this is set to 20, +the autoscaler will make sure that there are 20 available game servers +Must be bigger than 0 +Note: by “ready” we understand in this case “non-allocated”; this is done to ensure robustness +and computation stability in different edge case (fleet just created, not enough +capacity in the cluster etc)

-

GameServerSetStatus +

FixedIntervalSync

(Appears on: -GameServerSet) +FleetAutoscalerSync)

-

GameServerSetStatus is the status of a GameServerSet

+

FixedIntervalSync controls the desired behavior of the fixed interval based sync.

@@ -6271,86 +6533,93 @@

GameServerSetStatus

+ +
-replicas
+seconds
int32
-

Replicas is the total number of current GameServer replicas

+

Seconds defines how often we run fleet autoscaling in seconds

+

FleetAutoscaleRequest +

+

+(Appears on: +FleetAutoscaleReview) +

+

+

FleetAutoscaleRequest defines the request to webhook autoscaler endpoint

+

+ + - - + + + +
-readyReplicas
- -int32 - -
-

ReadyReplicas is the number of Ready GameServer replicas

-
FieldDescription
-reservedReplicas
+uid
-int32 +k8s.io/apimachinery/pkg/types.UID
-

ReservedReplicas is the number of Reserved GameServer replicas

+

UID is an identifier for the individual request/response. It allows us to distinguish instances of requests which are +otherwise identical (parallel requests, requests when earlier requests did not modify etc) +The UID is meant to track the round trip (request/response) between the Autoscaler and the WebHook, not the user request. +It is suitable for correlating log entries between the webhook and apiserver, for either auditing or debugging.

-allocatedReplicas
+name
-int32 +string
-

AllocatedReplicas is the number of Allocated GameServer replicas

+

Name is the name of the Fleet being scaled

-shutdownReplicas
+namespace
-int32 +string
-

ShutdownReplicas is the number of Shutdown GameServers replicas

+

Namespace is the namespace associated with the request (if any).

-players
+status
- -AggregatedPlayerStatus + +FleetStatus
-(Optional) -

[Stage:Alpha] -[FeatureFlag:PlayerTracking] -Players is the current total player capacity and count for this GameServerSet

+

The Fleet’s status values

-

GameServerSpec +

FleetAutoscaleResponse

(Appears on: -GameServer, -GameServerTemplateSpec) +FleetAutoscaleReview)

-

GameServerSpec is the spec for a GameServer resource

+

FleetAutoscaleResponse defines the response of webhook autoscaler endpoint

@@ -6362,153 +6631,158 @@

GameServerSpec

+ +
-container
+uid
-string +k8s.io/apimachinery/pkg/types.UID
-

Container specifies which Pod container is the game server. Only required if there is more than one -container defined

+

UID is an identifier for the individual request/response. +This should be copied over from the corresponding FleetAutoscaleRequest.

-ports
+scale
- -[]GameServerPort - +bool
-

Ports are the array of ports that can be exposed via the game server

+

Set to false if no scaling should occur to the Fleet

-health
+replicas
- -Health - +int32
-

Health configures health checking

+

The targeted replica count

+

FleetAutoscaleReview +

+

+

FleetAutoscaleReview is passed to the webhook with a populated Request value, +and then returned with a populated Response.

+

+ + - - + + + + - - - + +
-scheduling
- -agones.dev/agones/pkg/apis.SchedulingStrategy - -
-

Scheduling strategy. Defaults to “Packed”

-
FieldDescription
-sdkServer
+request
- -SdkServer + +FleetAutoscaleRequest
-

SdkServer specifies parameters for the Agones SDK Server sidecar container

-template
+response
- -Kubernetes core/v1.PodTemplateSpec + +FleetAutoscaleResponse
-

Template describes the Pod that will be created for the GameServer

-players
- - -PlayersSpec - - -
-(Optional) -

(Alpha, PlayerTracking feature flag) Players provides the configuration for player tracking features.

-
+

FleetAutoscalerPolicy +

+

+(Appears on: +FleetAutoscalerSpec) +

+

+

FleetAutoscalerPolicy describes how to scale a fleet

+

+ + + + + + +
FieldDescription
-counters
+type
- -map[string]agones.dev/agones/pkg/apis/agones/v1.CounterStatus + +FleetAutoscalerPolicyType
-(Optional) -

(Alpha, CountsAndLists feature flag) Counters and Lists provides the configuration for generic tracking features.

+

Type of autoscaling policy.

-lists
+buffer
- -map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus + +BufferPolicy
+(Optional) +

Buffer policy config params. Present only if FleetAutoscalerPolicyType = Buffer.

-eviction
+webhook
- -Eviction + +WebhookPolicy
(Optional) -

(Alpha, SafeToEvict feature flag) Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

+

Webhook policy config params. Present only if FleetAutoscalerPolicyType = Webhook.

-

GameServerState +

FleetAutoscalerPolicyType (string alias)

(Appears on: -GameServerSelector, -GameServerStatus) +FleetAutoscalerPolicy)

-

GameServerState is the state for the GameServer

+

FleetAutoscalerPolicyType is the policy for autoscaling +for a given Fleet

-

GameServerStatus +

FleetAutoscalerSpec

(Appears on: -GameServer) +FleetAutoscaler)

-

GameServerStatus is the status for a GameServer resource

+

FleetAutoscalerSpec is the spec for a Fleet Scaler

@@ -6520,129 +6794,133 @@

GameServerStatus

+ +
-state
+fleetName
- -GameServerState - +string
-

GameServerState is the current state of a GameServer, e.g. Creating, Starting, Ready, etc

-ports
+policy
- -[]GameServerStatusPort + +FleetAutoscalerPolicy
+

Autoscaling policy

-address
+sync
-string + +FleetAutoscalerSync +
+(Optional) +

[Stage:Beta] +[FeatureFlag:CustomFasSyncInterval] +Sync defines when FleetAutoscalers runs autoscaling

+

FleetAutoscalerStatus +

+

+(Appears on: +FleetAutoscaler) +

+

+

FleetAutoscalerStatus defines the current status of a FleetAutoscaler

+

+ + - - + + + +
-nodeName
- -string - -
-FieldDescription
-reservedUntil
+currentReplicas
- -Kubernetes meta/v1.Time - +int32
+

CurrentReplicas is the current number of gameserver replicas +of the fleet managed by this autoscaler, as last seen by the autoscaler

-players
+desiredReplicas
- -PlayerStatus - +int32
-(Optional) -

[Stage:Alpha] -[FeatureFlag:PlayerTracking]

+

DesiredReplicas is the desired number of gameserver replicas +of the fleet managed by this autoscaler, as last calculated by the autoscaler

-counters
+lastScaleTime
- -map[string]agones.dev/agones/pkg/apis/agones/v1.CounterStatus + +Kubernetes meta/v1.Time
(Optional) -

(Alpha, CountsAndLists feature flag) Counters and Lists provides the configuration for generic tracking features.

+

lastScaleTime is the last time the FleetAutoscaler scaled the attached fleet,

-lists
+ableToScale
- -map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus - +bool
-(Optional) +

AbleToScale indicates that we can access the target fleet

-eviction
+scalingLimited
- -Eviction - +bool
-(Optional) -

(Alpha, SafeToEvict feature flag) Eviction specifies the eviction tolerance of the GameServer.

+

ScalingLimited indicates that the calculated scale would be above or below the range +defined by MinReplicas and MaxReplicas, and has thus been capped.

-

GameServerStatusPort +

FleetAutoscalerSync

(Appears on: -GameServerAllocationStatus, -GameServerStatus) +FleetAutoscalerSpec)

-

GameServerStatusPort shows the port that was allocated to a -GameServer.

+

FleetAutoscalerSync describes when to sync a fleet

@@ -6654,35 +6932,52 @@

GameServerStatusPort

-name
+type
-string + +FleetAutoscalerSyncType +
+

Type of autoscaling sync.

-port
+fixedInterval
-int32 + +FixedIntervalSync +
+(Optional) +

FixedInterval config params. Present only if FleetAutoscalerSyncType = FixedInterval.

-

GameServerTemplateSpec +

FleetAutoscalerSyncType +(string alias)

+

+(Appears on: +FleetAutoscalerSync) +

+

+

FleetAutoscalerSyncType is the sync strategy for a given Fleet

+

+

WebhookPolicy

(Appears on: -FleetSpec, -GameServerSetSpec) +FleetAutoscalerPolicy)

-

GameServerTemplateSpec is a template for GameServers

+

WebhookPolicy controls the desired behavior of the webhook policy. +It contains the description of the webhook autoscaler service +used to form url which is accessible inside the cluster

@@ -6694,141 +6989,147 @@

GameServerTemplateSpec

- - - - -
-metadata
- - -Kubernetes meta/v1.ObjectMeta - - -
-Refer to the Kubernetes API documentation for the fields of the -metadata field. -
-spec
- - -GameServerSpec - - -
-
-
- - - - - - - + +
-container
+url
string
-

Container specifies which Pod container is the game server. Only required if there is more than one -container defined

-
-ports
- - -[]GameServerPort - - -
-

Ports are the array of ports that can be exposed via the game server

+(Optional) +

url gives the location of the webhook, in standard URL form +(scheme://host:port/path). Exactly one of url or service +must be specified.

+

The host should not refer to a service running in the cluster; use +the service field instead. The host might be resolved via external +DNS in some apiservers (e.g., kube-apiserver cannot resolve +in-cluster DNS as that would be a layering violation). host may +also be an IP address.

+

Please note that using localhost or 127.0.0.1 as a host is +risky unless you take great care to run this webhook on all hosts +which run an apiserver which might need to make calls to this +webhook. Such installs are likely to be non-portable, i.e., not easy +to turn up in a new cluster.

+

The scheme must be “https”; the URL must begin with “https://”.

+

A path is optional, and if present may be any string permissible in +a URL. You may use the path to pass an arbitrary string to the +webhook, for example, a cluster identifier.

+

Attempting to use a user or basic auth e.g. “user:password@” is not +allowed. Fragments (“#…”) and query parameters (“?…”) are not +allowed, either.

-health
+service
- -Health + +Kubernetes admissionregistration/v1.ServiceReference
-

Health configures health checking

+(Optional) +

service is a reference to the service for this webhook. Either +service or url must be specified.

+

If the webhook is running within the cluster, then you should use service.

-scheduling
+caBundle
-agones.dev/agones/pkg/apis.SchedulingStrategy +[]byte
-

Scheduling strategy. Defaults to “Packed”

+(Optional) +

caBundle is a PEM encoded CA bundle which will be used to validate the webhook’s server certificate. +If unspecified, system trust roots on the apiserver are used.

+
+

multicluster.agones.dev/v1

+

+

Package v1 is the v1 version of the API.

+

+Resource Types: + +

GameServerAllocationPolicy +

+

+

GameServerAllocationPolicy is the Schema for the gameserverallocationpolicies API

+

+ + + + + + + + + + + + - +
+
+
FieldDescription
-sdkServer
- - -SdkServer - - +apiVersion
+string
+ +multicluster.agones.dev/v1 +
-

SdkServer specifies parameters for the Agones SDK Server sidecar container

+kind
+string
GameServerAllocationPolicy
-template
+metadata
- -Kubernetes core/v1.PodTemplateSpec + +Kubernetes meta/v1.ObjectMeta
-

Template describes the Pod that will be created for the GameServer

+Refer to the Kubernetes API documentation for the fields of the +metadata field.
-players
+spec
- -PlayersSpec + +GameServerAllocationPolicySpec
-(Optional) -

(Alpha, PlayerTracking feature flag) Players provides the configuration for player tracking features.

-
-counters
+priority
- -map[string]agones.dev/agones/pkg/apis/agones/v1.CounterStatus - +int32
-(Optional) -

(Alpha, CountsAndLists feature flag) Counters and Lists provides the configuration for generic tracking features.

-lists
+weight
- -map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus - +int
@@ -6836,16 +7137,14 @@

GameServerTemplateSpec

-eviction
+connectionInfo
- -Eviction + +ClusterConnectionInfo
-(Optional) -

(Alpha, SafeToEvict feature flag) Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

@@ -6853,14 +7152,14 @@

GameServerTemplateSpec

-

Health +

ClusterConnectionInfo

(Appears on: -GameServerSpec) +GameServerAllocationPolicySpec)

-

Health configures health checking on the GameServer

+

ClusterConnectionInfo defines the connection information for a cluster

@@ -6872,98 +7171,67 @@

Health

- - - - - -
-disabled
- -bool - -
-

Disabled is whether health checking is disabled or not

-
-periodSeconds
+clusterName
-int32 +string
-

PeriodSeconds is the number of seconds each health ping has to occur in

+

Optional: the name of the targeted cluster

-failureThreshold
+allocationEndpoints
-int32 +[]string
-

FailureThreshold how many failures in a row constitutes unhealthy

+

The endpoints for the allocator service in the targeted cluster. +If the AllocationEndpoints is not set, the allocation happens on local cluster. +If there are multiple endpoints any of the endpoints that can handle allocation request should suffice

-initialDelaySeconds
+secretName
-int32 +string
-

InitialDelaySeconds initial delay before checking health

+

The name of the secret that contains TLS client certificates to connect the allocator server in the targeted cluster

-

ListStatus -

-

-(Appears on: -GameServerSpec, -GameServerStatus) -

-

-

ListStatus stores the current list values

-

- - - - - - - -
FieldDescription
-capacity
+namespace
-int64 +string
+

The cluster namespace from which to allocate gameservers

-values
+serverCa
-[]string +[]byte
+

The PEM encoded server CA, used by the allocator client to authenticate the remote server.

-

PlayerStatus +

ConnectionInfoIterator

-(Appears on: -GameServerStatus) -

-

-

PlayerStatus stores the current player capacity values

+

ConnectionInfoIterator an iterator on ClusterConnectionInfo

@@ -6975,82 +7243,58 @@

PlayerStatus

- -
-count
+currPriority
-int64 +int
+

currPriority Current priority index from the orderedPriorities

-capacity
+orderedPriorities
-int64 +[]int32
+

orderedPriorities list of ordered priorities

-ids
+priorityToCluster
-[]string +map[int32]map[string][]*agones.dev/agones/pkg/apis/multicluster/v1.GameServerAllocationPolicy
+

priorityToCluster Map of priority to cluster-policies map

-

PlayersSpec -

-

-(Appears on: -GameServerSpec) -

-

-

PlayersSpec tracks the initial player capacity

-

- - - - - - - -
FieldDescription
-initialCapacity
+clusterBlackList
-int64 +map[string]bool
+

clusterBlackList the cluster blacklist for the clusters that has already returned

-

PortPolicy -(string alias)

-

-(Appears on: -GameServerPort) -

-

-

PortPolicy is the port policy for the GameServer

-

-

SdkServer +

GameServerAllocationPolicySpec

(Appears on: -GameServerSpec) +GameServerAllocationPolicy)

-

SdkServer specifies parameters for the Agones SDK Server sidecar container

+

GameServerAllocationPolicySpec defines the desired state of GameServerAllocationPolicy

@@ -7062,50 +7306,38 @@

SdkServer

-logLevel
+priority
- -SdkServerLogLevel - +int32
-

LogLevel for SDK server (sidecar) logs. Defaults to “Info”

-grpcPort
+weight
-int32 +int
-

GRPCPort is the port on which the SDK Server binds the gRPC server to accept incoming connections

-httpPort
+connectionInfo
-int32 + +ClusterConnectionInfo +
-

HTTPPort is the port on which the SDK Server binds the HTTP gRPC gateway server to accept incoming connections

-

SdkServerLogLevel -(string alias)

-

-(Appears on: -SdkServer) -

-

-

SdkServerLogLevel is the log level for SDK server (sidecar) logs

-


Generated with gen-crd-api-reference-docs. diff --git a/site/content/en/docs/Reference/fleet.md b/site/content/en/docs/Reference/fleet.md index 4297c6c0b9..852b773cb6 100644 --- a/site/content/en/docs/Reference/fleet.md +++ b/site/content/en/docs/Reference/fleet.md @@ -43,6 +43,16 @@ spec: maxSurge: 25% # the amount to decrements GameServers by. Defaults to 25% maxUnavailable: 25% + # [Stage:Alpha] + # [FeatureFlag:FleetAllocationOverflow] + # Labels and/or Annotations to apply to overflowing GameServers when the number of Allocated GameServers is more + # than the desired replicas on the underlying `GameServerSet` + allocationOverflow: + labels: + mykey: myvalue + version: "" # empty an existing label value + annotations: + otherkey: setthisvalue template: # GameServer metadata metadata: @@ -98,6 +108,11 @@ The `spec` field is the actual `Fleet` specification and it is composed as follo - `rollingUpdate` is only relevant when `type: RollingUpdate` - `maxSurge` is the amount to increment the new GameServers by. Defaults to 25% - `maxUnavailable` is the amount to decrements GameServers by. Defaults to 25% +- `allocationOverflow` (Alpha, requires `FleetAllocationOverflow` flag) The labels and/or Annotations to apply to + GameServers when the number of Allocated GameServers drops below the desired replicas on the underlying + `GameServerSet`. + - `labels` the map of labels to be applied + - `annotations` the map of annotations to be applied - `template` a full `GameServer` configuration template. See the [GameServer]({{< relref "gameserver.md" >}}) reference for all available fields. diff --git a/test/e2e/fleet_test.go b/test/e2e/fleet_test.go index dffe17ce32..f6ef287e88 100644 --- a/test/e2e/fleet_test.go +++ b/test/e2e/fleet_test.go @@ -1528,6 +1528,103 @@ func TestFleetAggregatedPlayerStatus(t *testing.T) { }) } +func TestFleetAllocationOverflow(t *testing.T) { + if !runtime.FeatureEnabled(runtime.FeatureFleetAllocateOverflow) { + t.SkipNow() + } + t.Parallel() + ctx := context.Background() + client := framework.AgonesClient.AgonesV1() + fleets := client.Fleets(framework.Namespace) + + setup := func() *agonesv1.Fleet { + flt := defaultFleet(framework.Namespace) + flt.Spec.AllocationOverflow = &agonesv1.AllocationOverflow{Labels: map[string]string{"colour": "green"}, Annotations: map[string]string{"action": "update"}} + flt, err := fleets.Create(ctx, flt.DeepCopy(), metav1.CreateOptions{}) + require.NoError(t, err) + framework.AssertFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) + + // allocate two of them. + framework.CreateAndApplyAllocation(t, flt) + framework.CreateAndApplyAllocation(t, flt) + framework.AssertFleetCondition(t, flt, func(entry *logrus.Entry, fleet *agonesv1.Fleet) bool { + return fleet.Status.AllocatedReplicas == 2 + }) + + flt, err = fleets.Get(ctx, flt.ObjectMeta.Name, metav1.GetOptions{}) + require.NoError(t, err) + return flt + } + + assertCount := func(t *testing.T, log *logrus.Entry, flt *agonesv1.Fleet, expected int) { + require.Eventuallyf(t, func() bool { + log.Info("Checking GameServers") + list, err := framework.ListGameServersFromFleet(flt) + require.NoError(t, err) + count := 0 + + for _, gs := range list { + if gs.ObjectMeta.Labels["colour"] != "green" { + log.WithField("gs", gs).Info("Label not set") + continue + } + if gs.ObjectMeta.Annotations["action"] != "update" { + log.WithField("gs", gs).Info("Annotation not set") + continue + } + count++ + } + + return count == expected + }, 5*time.Minute, time.Second, "Labels and annotations not set") + } + + t.Run("scale down", func(t *testing.T) { + log := e2e.TestLogger(t) + flt := setup() + defer fleets.Delete(ctx, flt.ObjectMeta.Name, metav1.DeleteOptions{}) // nolint: errcheck + + framework.ScaleFleet(t, log, flt, 0) + + // wait for scale down + framework.AssertFleetCondition(t, flt, func(entry *logrus.Entry, fleet *agonesv1.Fleet) bool { + return fleet.Status.AllocatedReplicas == 2 && fleet.Status.ReadyReplicas == 0 + }) + + assertCount(t, log, flt, 2) + }) + + t.Run("rolling update", func(t *testing.T) { + log := e2e.TestLogger(t) + flt := setup() + defer fleets.Delete(ctx, flt.ObjectMeta.Name, metav1.DeleteOptions{}) // nolint: errcheck + + fltCopy := flt.DeepCopy() + if fltCopy.Spec.Template.ObjectMeta.Labels == nil { + fltCopy.Spec.Template.ObjectMeta.Labels = map[string]string{} + } + fltCopy.Spec.Template.ObjectMeta.Labels["version"] = "2.0" + flt, err := fleets.Update(ctx, fltCopy, metav1.UpdateOptions{}) + require.NoError(t, err) + + // wait for rolling update to finish + require.Eventuallyf(t, func() bool { + list, err := framework.ListGameServersFromFleet(flt) + assert.NoError(t, err) + for _, gs := range list { + log.WithField("gs", gs).Info("checking game server") + if gs.Status.State == agonesv1.GameServerStateReady && gs.ObjectMeta.Labels["version"] == "2.0" { + return true + } + } + + return false + }, 5*time.Minute, time.Second, "Rolling update did not complete") + + assertCount(t, log, flt, 1) + }) +} + func assertCausesContainsString(t *testing.T, causes []metav1.StatusCause, expected string) { found := false for _, v := range causes { diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index 424962aed9..58225458f7 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -315,6 +315,30 @@ func (f *Framework) CycleAllocations(ctx context.Context, t *testing.T, flt *ago } } +// ScaleFleet will scale a Fleet with retries to a specified replica size. +func (f *Framework) ScaleFleet(t *testing.T, log *logrus.Entry, flt *agonesv1.Fleet, replicas int32) { + fleets := f.AgonesClient.AgonesV1().Fleets(f.Namespace) + ctx := context.Background() + + require.Eventuallyf(t, func() bool { + flt, err := fleets.Get(ctx, flt.ObjectMeta.Name, metav1.GetOptions{}) + if err != nil { + log.WithError(err).Info("Could not get Fleet") + return false + } + + fltCopy := flt.DeepCopy() + fltCopy.Spec.Replicas = replicas + _, err = fleets.Update(ctx, fltCopy, metav1.UpdateOptions{}) + if err != nil { + log.WithError(err).Info("Could not scale Fleet") + return false + } + + return true + }, 5*time.Minute, time.Second, "Could not scale Fleet %s", flt.ObjectMeta.Name) +} + // AssertFleetCondition waits for the Fleet to be in a specific condition or fails the test if the condition can't be met in 5 minutes. func (f *Framework) AssertFleetCondition(t *testing.T, flt *agonesv1.Fleet, condition func(*logrus.Entry, *agonesv1.Fleet) bool) { err := f.WaitForFleetCondition(t, flt, condition)