diff --git a/examples/fleet.yaml b/examples/fleet.yaml index 8d3e5caa7a..f08a49edbf 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 GameServers when the number of Allocated GameServers drops below + # the desired replicas on the underlying `GameServerSet` + # Commented out since Alpha, and disabled by default + # allocationOverflow: # applied to the GameServerSet's number Allocated GameServers that are over the desired replicas + # 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..e3413a4e57 100644 --- a/pkg/apis/agones/v1/fleet.go +++ b/pkg/apis/agones/v1/fleet.go @@ -62,7 +62,7 @@ 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 + // Labels and/or Annotations to apply to GameServers when the number of Allocated GameServers drops below // the desired replicas on the underlying `GameServerSet` // +optional AllocationOverflow *AllocationOverflow `json:"allocationOverflow,omitempty"` 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..5d524d628d 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:
Package v1 is the v1 version of the API.
Resource Types: --
Fleet is the data structure for a Fleet resource
+GameServerAllocation is the data structure for allocating against a set of
+GameServers, defined selectors
selectors
-agones.dev/v1
+allocation.agones.dev/v1
|
@@ -59,13 +56,13 @@ Fleet |
+GameServerAllocation |
||||||||||||
metadata
-
+
Kubernetes meta/v1.ObjectMeta
@@ -79,8 +76,8 @@ Fleet
spec
-
-FleetSpec
+
+GameServerAllocationSpec
Fleet
status
-
-FleetStatus
+
+GameServerAllocationStatus
|
-
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.
+
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
-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
|
- - -
GameServerAllocationSpec +++(Appears on: +GameServerAllocation) + ++ GameServerAllocationSpec is the spec for a GameServerAllocation + +
GameServerAllocationState
+(
+ |
Field | +Description | +
---|---|
+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 is the data structure for a set of GameServers. -This matches philosophically with the relationship between -Deployments and ReplicaSets
- -Field | -Description | -
---|---|
-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” + |
+
+(Appears on: +GameServerAllocationSpec) +
++
GameServerSelector contains all the filter options for selecting +a GameServer for allocation.
+Field | +Description | +
---|---|
-replicas
+LabelSelector
-int32
+
+Kubernetes meta/v1.LabelSelector
+
|
- Replicas are the number of GameServers that should be in this set +
+(Members of 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 [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 - |
-
(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
(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.
(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: “”
-count
+containsValue
+
+string
+
+ |
++ | +
+minAvailable
int64
@@ -535,7 +631,7 @@ AggregatedPlayerStatus | |
-capacity
+maxAvailable
int64
@@ -545,17 +641,14 @@ AggregatedPlayerStatus |
(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
-(Optional)
- Labels to be applied to the |
-(Optional)
- Annotations to be applied to the |
(Appears on: -GameServerSpec, -GameServerStatus) +GameServerAllocationSpec)
-
CounterStatus stores the current counter values
+MultiClusterSetting specifies settings for multi-cluster allocation.
-count
+enabled
-int64
+bool
|
@@ -621,9 +709,11 @@ CounterStatus |
-capacity
+policySelector
-int64
+
+Kubernetes meta/v1.LabelSelector
+
|
@@ -631,15 +721,14 @@ CounterStatus |
(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
-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 |
string
alias)-(Appears on: -Eviction) -
--
EvictionSafe specified whether the game server supports termination via SIGTERM
- -(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.
-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 |
-
-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 |
-(Appears on: -Fleet, -FleetAutoscaleRequest) +
Package v1 is the v1 version of the API.
+Resource Types: + +-
FleetStatus is the status of a Fleet
+FleetAutoscaler is the data structure for a FleetAutoscaler resource
-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
+
+
+ |
+
+ + +
|
||||||
-players
+status
-
-AggregatedPlayerStatus
+
+FleetAutoscalerStatus
|
-(Optional)
- [Stage:Alpha] -[FeatureFlag:PlayerTracking] -Players are the current total player capacity and count for this Fleet |
(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.
-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 |
-
-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) |
(Appears on: -GameServerSet) +FleetAutoscalerSync)
-
GameServerSetSpec the specification for GameServerSet
+FixedIntervalSync controls the desired behavior of the fixed interval based sync.
-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 |
-
-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 |
(Appears on: -GameServerSet) +FleetAutoscaleReview)
-
GameServerSetStatus is the status of a GameServerSet
+FleetAutoscaleRequest defines the request to webhook autoscaler endpoint
-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 |
(Appears on: -GameServer, -GameServerTemplateSpec) +FleetAutoscaleReview)
-
GameServerSpec is the spec for a GameServer resource
+FleetAutoscaleResponse defines the response of webhook autoscaler endpoint
-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 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” - |
+Field | +Description |
---|---|---|---|
-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 |
+(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. - |
+Field | +Description |
---|---|---|---|
-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. |
string
alias)(Appears on: -GameServerSelector, -GameServerStatus) +FleetAutoscalerPolicy)
-
GameServerState is the state for the GameServer
+FleetAutoscalerPolicyType is the policy for autoscaling +for a given Fleet
-(Appears on: -GameServer) +FleetAutoscaler)
-
GameServerStatus is the status for a GameServer resource
+FleetAutoscalerSpec is the spec for a Fleet Scaler
-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 |
+(Appears on: +FleetAutoscaler) +
++
FleetAutoscalerStatus defines the current status of a FleetAutoscaler
+ +Field | +Description | +
---|---|
-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. |
(Appears on: -GameServerAllocationStatus, -GameServerStatus) +FleetAutoscalerSpec)
-
GameServerStatusPort shows the port that was allocated to a -GameServer.
+FleetAutoscalerSync describes when to sync a fleet
-name
+type
-string
+
+FleetAutoscalerSyncType
+
|
+ Type of autoscaling sync. |
-port
+fixedInterval
-int32
+
+FixedIntervalSync
+
|
+(Optional)
+ FixedInterval config params. Present only if FleetAutoscalerSyncType = FixedInterval. |
string
alias)+(Appears on: +FleetAutoscalerSync) +
++
FleetAutoscalerSyncType is the sync strategy for a given Fleet
+ +(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
-metadata
+url
-
-Kubernetes meta/v1.ObjectMeta
-
+string
|
-Refer to the Kubernetes API documentation for the fields of the
-metadata field.
+(Optional)
+
The Please note that using 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
|
- - -
+ multicluster.agones.dev/v1++ Package v1 is the v1 version of the API. + +Resource Types: + +GameServerAllocationPolicy +++ GameServerAllocationPolicy is the Schema for the gameserverallocationpolicies API + +
GameServerTemplateSpecHealth
+ |
-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 |
-(Appears on: -GameServerSpec, -GameServerStatus) -
--
ListStatus stores the current list values
- -Field | -Description | -
---|---|
-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. |
-(Appears on: -GameServerStatus) -
--
PlayerStatus stores the current player capacity values
+ConnectionInfoIterator an iterator on ClusterConnectionInfo
-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 |
-(Appears on: -GameServerSpec) -
--
PlayersSpec tracks the initial player capacity
- -Field | -Description | -
---|---|
-initialCapacity
+clusterBlackList
-int64
+map[string]bool
|
+ clusterBlackList the cluster blacklist for the clusters that has already returned |
string
alias)-(Appears on: -GameServerPort) -
--
PortPolicy is the port policy for the GameServer
- -(Appears on: -GameServerSpec) +GameServerAllocationPolicy)
-
SdkServer specifies parameters for the Agones SDK Server sidecar container
+GameServerAllocationPolicySpec defines the desired state of GameServerAllocationPolicy
-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 |
string
alias)-(Appears on: -SdkServer) -
--
SdkServerLogLevel is the log level for SDK server (sidecar) logs
-
Package v1 is the v1 version of the API.
Resource Types: --
GameServerAllocation is the data structure for allocating against a set of
-GameServers, defined selectors
selectors
Fleet is the data structure for a Fleet resource
-allocation.agones.dev/v1
+agones.dev/v1
|
@@ -1900,13 +1865,13 @@ GameServerAllocation |
+Fleet |
|||||||||||
metadata
-
+
Kubernetes meta/v1.ObjectMeta
@@ -1920,8 +1885,8 @@ GameServerAllocation
spec
-
-GameServerAllocationSpec
+
+FleetSpec
GameServerAllocation
status
-
-GameServerAllocationStatus
+
+FleetStatus
|
-(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.
-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. ++ +
GameServerAllocationState
-(
- |
Field | -Description | -
---|---|
-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
+
|
@@ -2214,37 +2154,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”
-(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
-LabelSelector
-
-
-Kubernetes meta/v1.LabelSelector
-
-
+apiVersion
+string |
+
+
+agones.dev/v1
+
|
+||||||||
-
-(Members of See: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +kind
+string
|
+GameServerSet |
||||||||
-gameServerState
+metadata
-
-GameServerState
+
+Kubernetes meta/v1.ObjectMeta
|
-(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. +Refer to the Kubernetes API documentation for the fields of the +metadata field.
|
||||||||
-players
+spec
-
-PlayerSelector
+
+GameServerSetSpec
|
-(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. - |
+
+replicas
+
+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 |
+
+scheduling
+
+agones.dev/agones/pkg/apis.SchedulingStrategy
+
+ |
+
+ Scheduling strategy. Defaults to “Packed”. + |
+
+template
+
+
+GameServerTemplateSpec
+
+
+ |
+
+ Template the GameServer template to apply for this GameServerSet + |
+
status
+
+
+GameServerSetStatus
+
+
+(Appears on: -GameServerAllocationSpec) +FleetStatus, +GameServerSetStatus)
-
MetaPatch is the metadata used to patch the GameServer metadata on allocation
+AggregatedPlayerStatus stores total player tracking values
-labels
+count
-map[string]string
+int64
|
@@ -2336,9 +2341,9 @@ MetaPatch |
-annotations
+capacity
-map[string]string
+int64
|
@@ -2346,14 +2351,17 @@ MetaPatch |
(Appears on: -GameServerAllocationSpec) +FleetSpec, +GameServerSetSpec)
-
MultiClusterSetting specifies settings for multi-cluster 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.
-enabled
+labels
-bool
+map[string]string
|
+(Optional)
+ Labels to be applied to the |
-policySelector
+annotations
-
-Kubernetes meta/v1.LabelSelector
-
+map[string]string
|
+(Optional)
+ Annotations to be applied to the |
(Appears on: -GameServerSelector) +GameServerSpec, +GameServerStatus)
-
PlayerSelector is the filter options for a GameServer based on player counts
+CounterStatus stores the current counter values
-minAvailable
+count
int64
@@ -2416,7 +2427,7 @@ PlayerSelector |
-maxAvailable
+capacity
int64
@@ -2426,19 +2437,15 @@ PlayerSelector |
-
Package v1 is the v1 version of the API.
+(Appears on: +GameServerSpec, +GameServerStatus) -Resource Types: - --
FleetAutoscaler is the data structure for a FleetAutoscaler resource
+Eviction specifies the eviction tolerance of the GameServer
-apiVersion
-string |
+
-
-autoscaling.agones.dev/v1
-
+(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 |
string
alias)+(Appears on: +Eviction) +
++
EvictionSafe specified whether the game server supports termination via SIGTERM
+ ++(Appears on: +Fleet) +
++
FleetSpec is the spec for a Fleet
+ +
-kind
-string
- |
-FleetAutoscaler |
+Field | +Description | ||||
---|---|---|---|---|---|---|---|
-metadata
+replicas
-
-Kubernetes meta/v1.ObjectMeta
-
+int32
|
-Refer to the Kubernetes API documentation for the fields of the
-metadata field.
+Replicas are the number of GameServers that should be in this set. Defaults to 0. |
||||||
-spec
+allocationOverflow
-
-FleetAutoscalerSpec
+
+AllocationOverflow
|
- - -
Scheduling strategy. Defaults to “Packed”. |
||||||
-status
+template
-
-FleetAutoscalerStatus
+
+GameServerTemplateSpec
|
+ Template the GameServer template to apply for this Fleet |
(Appears on: -FleetAutoscalerPolicy) +Fleet, +FleetAutoscaleRequest)
-
BufferPolicy controls the desired behavior of the buffer policy.
+FleetStatus is the status of a Fleet
-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 the total number of current GameServer replicas |
-minReplicas
+readyReplicas
int32
|
- 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 +ReadyReplicas are the number of Ready GameServer replicas |
-bufferSize
+reservedReplicas
-k8s.io/apimachinery/pkg/util/intstr.IntOrString
+int32
|
- 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) +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. |
-(Appears on: -FleetAutoscalerSync) -
--
FixedIntervalSync controls the desired behavior of the fixed interval based sync.
- -Field | -Description | +
+allocatedReplicas
+
+int32
+
+ |
+
+ AllocatedReplicas are the number of Allocated GameServer replicas + |
---|---|---|---|
-seconds
+players
-int32
+
+AggregatedPlayerStatus
+
|
- Seconds defines how often we run fleet autoscaling in seconds +(Optional) +[Stage:Alpha] +[FeatureFlag:PlayerTracking] +Players are the current total player capacity and count for this Fleet |
(Appears on: -FleetAutoscaleReview) +GameServerSpec)
-
FleetAutoscaleRequest defines the request to webhook autoscaler endpoint
+GameServerPort defines a set of Ports that +are to be exposed via the GameServer
-uid
+name
-k8s.io/apimachinery/pkg/types.UID
+string
|
- 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. +Name is the descriptive name of the port |
-name
+portPolicy
-string
+
+PortPolicy
+
|
- Name is the name of the Fleet being scaled +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 |
-namespace
+container
string
|
- Namespace is the namespace associated with the request (if any). +(Optional) +Container is the name of the container on which to open the port. Defaults to the game server container. |
-status
+containerPort
-
-FleetStatus
+int32
+
+ |
+
+ ContainerPort is the port that is being opened on the specified container’s process + |
+
+hostPort
+
+int32
+
+ |
+
+ HostPort the port exposed on the host for clients to connect to + |
+
+protocol
+
+
+Kubernetes core/v1.Protocol
|
- The Fleet’s status values +Protocol is the network protocol being used. Defaults to UDP. TCP and TCPUDP are other options. |
(Appears on: -FleetAutoscaleReview) +GameServerSet)
-
FleetAutoscaleResponse defines the response of webhook autoscaler endpoint
+GameServerSetSpec the specification for GameServerSet
-uid
+replicas
-k8s.io/apimachinery/pkg/types.UID
+int32
|
- UID is an identifier for the individual request/response. -This should be copied over from the corresponding FleetAutoscaleRequest. +Replicas are the number of GameServers that should be in this set |
-scale
+allocationOverflow
-bool
+
+AllocationOverflow
+
|
- Set to false if no scaling should occur to the Fleet +(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 |
-replicas
+scheduling
-int32
+agones.dev/agones/pkg/apis.SchedulingStrategy
|
- The targeted replica count +Scheduling strategy. Defaults to “Packed”. + |
+
+template
+
+
+GameServerTemplateSpec
+
+
+ |
+
+ Template the GameServer template to apply for this GameServerSet |
-
FleetAutoscaleReview is passed to the webhook with a populated Request value, -and then returned with a populated Response.
+(Appears on: +GameServerSet) + ++
GameServerSetStatus is the status of a GameServerSet
-request
+replicas
-
-FleetAutoscaleRequest
-
+int32
|
+ Replicas is the total number of current GameServer replicas |
-response
+readyReplicas
-
-FleetAutoscaleResponse
-
+int32
|
+ ReadyReplicas is the number of Ready GameServer replicas |
-(Appears on: -FleetAutoscalerSpec) -
--
FleetAutoscalerPolicy describes how to scale a fleet
- -Field | -Description | +
+reservedReplicas
+
+int32
+
+ |
+
+ ReservedReplicas is the number of Reserved GameServer replicas + |
---|---|---|---|
-type
+allocatedReplicas
-
-FleetAutoscalerPolicyType
-
+int32
|
- Type of autoscaling policy. +AllocatedReplicas is the number of Allocated GameServer replicas |
||
-buffer
+shutdownReplicas
-
-BufferPolicy
-
+int32
|
-(Optional)
- Buffer policy config params. Present only if FleetAutoscalerPolicyType = Buffer. +ShutdownReplicas is the number of Shutdown GameServers replicas |
||
-webhook
+players
-
-WebhookPolicy
+
+AggregatedPlayerStatus
|
(Optional)
- Webhook policy config params. Present only if FleetAutoscalerPolicyType = Webhook. +[Stage:Alpha] +[FeatureFlag:PlayerTracking] +Players is the current total player capacity and count for this GameServerSet |
string
alias)-(Appears on: -FleetAutoscalerPolicy) -
--
FleetAutoscalerPolicyType is the policy for autoscaling -for a given Fleet
- -(Appears on: -FleetAutoscaler) +GameServer, +GameServerTemplateSpec)
-
FleetAutoscalerSpec is the spec for a Fleet Scaler
+GameServerSpec is the spec for a GameServer resource
-fleetName
+container
string
|
+ Container specifies which Pod container is the game server. Only required if there is more than one +container defined |
-policy
+ports
-
-FleetAutoscalerPolicy
+
+[]GameServerPort
|
- Autoscaling policy +Ports are the array of ports that can be exposed via the game server |
-sync
+health
-
-FleetAutoscalerSync
+
+Health
+
+
+ |
+
+ Health configures health checking + |
+
+scheduling
+
+agones.dev/agones/pkg/apis.SchedulingStrategy
+
+ |
+
+ Scheduling strategy. Defaults to “Packed” + |
+
+sdkServer
+
+
+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)
- [Stage:Beta] -[FeatureFlag:CustomFasSyncInterval] -Sync defines when FleetAutoscalers runs autoscaling +(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”. |
string
alias)+(Appears on: +GameServerSelector, +GameServerStatus) +
++
GameServerState is the state for the GameServer
+ +(Appears on: -FleetAutoscaler) +GameServer)
-
FleetAutoscalerStatus defines the current status of a FleetAutoscaler
+GameServerStatus is the status for a GameServer resource
-currentReplicas
+state
-int32
+
+GameServerState
+
|
- CurrentReplicas is the current number of gameserver replicas -of the fleet managed by this autoscaler, as last seen by the autoscaler +GameServerState is the current state of a GameServer, e.g. Creating, Starting, Ready, etc |
-desiredReplicas
+ports
-int32
+
+[]GameServerStatusPort
+
|
- DesiredReplicas is the desired number of gameserver replicas -of the fleet managed by this autoscaler, as last calculated by the autoscaler |
-lastScaleTime
+address
+
+string
+
+ |
++ | +
+nodeName
+
+string
+
+ |
++ | +
+reservedUntil
-
+
Kubernetes meta/v1.Time
|
+ | +
+players
+
+
+PlayerStatus
+
+
+ |
+
(Optional)
- lastScaleTime is the last time the FleetAutoscaler scaled the attached fleet, +[Stage:Alpha] +[FeatureFlag:PlayerTracking] |
-ableToScale
+counters
-bool
+
+map[string]agones.dev/agones/pkg/apis/agones/v1.CounterStatus
+
|
- AbleToScale indicates that we can access the target fleet +(Optional) +(Alpha, CountsAndLists feature flag) Counters and Lists provides the configuration for generic tracking features. |
-scalingLimited
+lists
-bool
+
+map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus
+
|
- ScalingLimited indicates that the calculated scale would be above or below the range -defined by MinReplicas and MaxReplicas, and has thus been capped. +(Optional) + |
+
+eviction
+
+
+Eviction
+
+
+ |
+
+(Optional)
+ (Alpha, SafeToEvict feature flag) Eviction specifies the eviction tolerance of the GameServer. |
(Appears on: -FleetAutoscalerSpec) +GameServerAllocationStatus, +GameServerStatus)
-
FleetAutoscalerSync describes when to sync a fleet
+GameServerStatusPort shows the port that was allocated to a +GameServer.
-type
+name
-
-FleetAutoscalerSyncType
-
+string
|
- Type of autoscaling sync. |
-fixedInterval
+port
-
-FixedIntervalSync
-
+int32
|
-(Optional)
- FixedInterval config params. Present only if FleetAutoscalerSyncType = FixedInterval. |
string
alias)-(Appears on: -FleetAutoscalerSync) -
--
FleetAutoscalerSyncType is the sync strategy for a given Fleet
- -(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
-url
+metadata
-string
+
+Kubernetes meta/v1.ObjectMeta
+
|
-(Optional)
-
The Please note that using 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)
-
If the webhook is running within the cluster, then you should use + +
- multicluster.agones.dev/v1-- Package v1 is the v1 version of the API. - -Resource Types: - -GameServerAllocationPolicy --- GameServerAllocationPolicy is the Schema for the gameserverallocationpolicies API - -
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 + |
+
+(Appears on: +GameServerSpec, +GameServerStatus) +
++
ListStatus stores the current list values
+ +Field | +Description | +
---|---|
+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 an iterator on ClusterConnectionInfo
+(Appears on: +GameServerStatus) + ++
PlayerStatus stores the current player capacity values
-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 |
+(Appears on: +GameServerSpec) +
++
PlayersSpec tracks the initial player capacity
+ +Field | +Description | +
---|---|
-clusterBlackList
+initialCapacity
-map[string]bool
+int64
|
- clusterBlackList the cluster blacklist for the clusters that has already returned |
string
alias)+(Appears on: +GameServerPort) +
++
PortPolicy is the port policy for the GameServer
+ +(Appears on: -GameServerAllocationPolicy) +GameServerSpec)
-
GameServerAllocationPolicySpec defines the desired state of GameServerAllocationPolicy
+SdkServer specifies parameters for the Agones SDK Server sidecar container
-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 |
string
alias)+(Appears on: +SdkServer) +
++
SdkServerLogLevel is the log level for SDK server (sidecar) logs
+
Generated with gen-crd-api-reference-docs
.
Packages:
Package v1 is the v1 version of the API.
Resource Types: --
GameServerAllocation is the data structure for allocating against a set of
-GameServers, defined selectors
selectors
Fleet is the data structure for a Fleet resource
-allocation.agones.dev/v1
+agones.dev/v1
|
@@ -3494,7 +3729,7 @@ GameServerAllocation |
+Fleet |
||||||||||||
@@ -3514,8 +3749,8 @@ GameServerAllocation
spec
-
-GameServerAllocationSpec
+
+FleetSpec
GameServerAllocation
status
-
-GameServerAllocationStatus
+
+FleetStatus
|
-(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
+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.
-minCount
+apiVersion
+string |
+
+
+agones.dev/v1
+
+ |
+||||||||||||||||||||||
+kind
+string
+ |
+GameServer |
+||||||||||||||||||||||
+metadata
-int64
+
+Kubernetes meta/v1.ObjectMeta
+
|
+Refer to the Kubernetes API documentation for the fields of the
+metadata field.
|
||||||||||||||||||||||
-maxCount
+spec
-int64
+
+GameServerSpec
+
|
+ + +
GameServerAllocationSpec ---(Appears on: -GameServerAllocation) - -- GameServerAllocationSpec is the spec for a GameServerAllocation - -
|
||||||||||||||||||||||
-metadata
+status
-
-MetaPatch
+
+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 |
string
alias)-(Appears on: -GameServerAllocationStatus) -
--
GameServerAllocationState is the Allocation state
- --(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
Field | Description | -
---|---|
+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.
+ |
+
-state
+spec
-
-GameServerAllocationState
+
+GameServerSetSpec
|
- GameServerState is the current state of an GameServerAllocation, e.g. Allocated, or UnAllocated - |
-
-gameServerName
+replicas
-string
+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 |
-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”
(Appears on: -GameServerAllocationSpec) +FleetStatus, +GameServerSetStatus)
-
GameServerSelector contains all the filter options for selecting -a GameServer for allocation.
+AggregatedPlayerStatus stores total player tracking values
-LabelSelector
+count
-
-Kubernetes meta/v1.LabelSelector
-
+int64
|
-
-(Members of See: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ |
-gameServerState
+capacity
-
-GameServerState
-
+int64
|
-(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. |
+(Appears on: +FleetSpec, +GameServerSetSpec) +
++
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.
-players
-
-
-PlayerSelector
-
-
- |
-
-(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. - |
+Field | +Description |
---|---|---|---|
-counters
+labels
-
-map[string]agones.dev/agones/pkg/apis/allocation/v1.CounterSelector
-
+map[string]string
|
(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. +Labels to be applied to the |
||
-lists
+annotations
-
-map[string]agones.dev/agones/pkg/apis/allocation/v1.ListSelector
-
+map[string]string
|
(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. +Annotations to be applied to the |
(Appears on: -GameServerSelector) +GameServerSpec, +GameServerStatus)
-
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: “”
+CounterStatus stores the current counter values
-containsValue
-
-string
-
- |
-- | -
-minAvailable
+count
int64
@@ -4069,7 +4291,7 @@ ListSelector | |
-maxAvailable
+capacity
int64
@@ -4079,14 +4301,15 @@ ListSelector |
(Appears on: -GameServerAllocationSpec) +GameServerSpec, +GameServerStatus)
-
MetaPatch is the metadata used to patch the GameServer metadata on allocation
+Eviction specifies the eviction tolerance of the GameServer
-labels
-
-map[string]string
-
- |
-- | -
-annotations
+safe
-map[string]string
+
+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 |
string
alias)+(Appears on: +Eviction) +
++
EvictionSafe specified whether the game server supports termination via SIGTERM
+ +(Appears on: -GameServerAllocationSpec) +Fleet)
-
MultiClusterSetting specifies settings for multi-cluster allocation.
+FleetSpec is the spec for a Fleet
-enabled
+replicas
-bool
+int32
|
+ Replicas are the number of GameServers that should be in this set. Defaults to 0. |
-policySelector
+allocationOverflow
-
-Kubernetes meta/v1.LabelSelector
+
+AllocationOverflow
+
+
+ |
+
+(Optional)
+ [Stage: Alpha]
+[FeatureFlag:FleetAllocationOverflow]
+Labels and/or Annotations to apply to GameServers when the number of Allocated GameServers drops below
+the desired replicas on the underlying |
+
+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 |
(Appears on: -GameServerSelector) +Fleet, +FleetAutoscaleRequest)
-
PlayerSelector is the filter options for a GameServer based on player counts
+FleetStatus is the status of a Fleet
-minAvailable
+replicas
-int64
+int32
|
+ Replicas the total number of current GameServer replicas |
-maxAvailable
+readyReplicas
-int64
+int32
|
+ ReadyReplicas are the number of Ready GameServer replicas |
-(Appears on: -GameServerAllocationSpec) -
--
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.
- -Field | -Description | -
---|---|
-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 |
-
Package v1 is the v1 version of the API.
+(Appears on: +GameServerSpec) -Resource Types: - --
FleetAutoscaler is the data structure for a FleetAutoscaler resource
+GameServerPort defines a set of Ports that +are to be exposed via the GameServer
-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
|
- - -
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. |
(Appears on: -FleetAutoscalerPolicy) +GameServerSet)
-
BufferPolicy controls the desired behavior of the buffer policy.
+GameServerSetSpec the specification for GameServerSet
-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 |
-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 |
(Appears on: -FleetAutoscalerSync) +GameServerSet)
-
FixedIntervalSync controls the desired behavior of the fixed interval based sync.
+GameServerSetStatus is the status of a GameServerSet
-seconds
+replicas
int32
|
- Seconds defines how often we run fleet autoscaling in seconds +Replicas is the total number of current GameServer replicas |
-(Appears on: -FleetAutoscaleReview) -
--
FleetAutoscaleRequest defines the request to webhook autoscaler endpoint
- -Field | -Description | +
+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 |
(Appears on: -FleetAutoscaleReview) +GameServer, +GameServerTemplateSpec)
-
FleetAutoscaleResponse defines the response of webhook autoscaler endpoint
+GameServerSpec is the spec for a GameServer resource
-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 is passed to the webhook with a populated Request value, -and then returned with a populated Response.
- -Field | -Description | +
+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 |
-(Appears on: -FleetAutoscalerSpec) -
--
FleetAutoscalerPolicy describes how to scale a fleet
- -Field | -Description | +
+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”. |
string
alias)(Appears on: -FleetAutoscalerPolicy) +GameServerSelector, +GameServerStatus)
-
FleetAutoscalerPolicyType is the policy for autoscaling -for a given Fleet
+GameServerState is the state for the GameServer
-(Appears on: -FleetAutoscaler) +GameServer)
-
FleetAutoscalerSpec is the spec for a Fleet Scaler
+GameServerStatus is the status for a GameServer resource
-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 |
-(Appears on: -FleetAutoscaler) -
--
FleetAutoscalerStatus defines the current status of a FleetAutoscaler
- -Field | -Description | +
+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. |
(Appears on: -FleetAutoscalerSpec) +GameServerAllocationStatus, +GameServerStatus)
-
FleetAutoscalerSync describes when to sync a fleet
+GameServerStatusPort shows the port that was allocated to a +GameServer.
-type
+name
-
-FleetAutoscalerSyncType
-
+string
|
- Type of autoscaling sync. |
-fixedInterval
+port
-
-FixedIntervalSync
-
+int32
|
-(Optional)
- FixedInterval config params. Present only if FleetAutoscalerSyncType = FixedInterval. |
string
alias)-(Appears on: -FleetAutoscalerSync) -
--
FleetAutoscalerSyncType is the sync strategy for a given Fleet
- -(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
-url
+metadata
-string
+
+Kubernetes meta/v1.ObjectMeta
+
|
-(Optional)
-
The Please note that using 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)
-
If the webhook is running within the cluster, then you should use + +
- multicluster.agones.dev/v1-- Package v1 is the v1 version of the API. - -Resource Types: - -GameServerAllocationPolicy --- GameServerAllocationPolicy is the Schema for the gameserverallocationpolicies API - -
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 + |
+
+initialDelaySeconds
+
+int32
+
+ |
+
+ InitialDelaySeconds initial delay before checking health |
+(Appears on: +GameServerSpec, +GameServerStatus) +
++
ListStatus stores the current list values
+ +Field | +Description | +
---|---|
-namespace
+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 an iterator on ClusterConnectionInfo
+(Appears on: +GameServerStatus) + ++
PlayerStatus stores the current player capacity values
-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 |
+(Appears on: +GameServerSpec) +
++
PlayersSpec tracks the initial player capacity
+ +Field | +Description | +
---|---|
-clusterBlackList
+initialCapacity
-map[string]bool
+int64
|
- clusterBlackList the cluster blacklist for the clusters that has already returned |
string
alias)+(Appears on: +GameServerPort) +
++
PortPolicy is the port policy for the GameServer
+ +(Appears on: -GameServerAllocationPolicy) +GameServerSpec)
-
GameServerAllocationPolicySpec defines the desired state of GameServerAllocationPolicy
+SdkServer specifies parameters for the Agones SDK Server sidecar container
-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 |
string
alias)+(Appears on: +SdkServer) +
++
SdkServerLogLevel is the log level for SDK server (sidecar) logs
+
Package v1 is the v1 version of the API.
Resource Types: --
Fleet is the data structure for a Fleet resource
+GameServerAllocation is the data structure for allocating against a set of
+GameServers, defined selectors
selectors
-agones.dev/v1
+allocation.agones.dev/v1
|
@@ -5303,7 +5570,7 @@ Fleet |
+GameServerAllocation |
||||||||||
@@ -5323,8 +5590,8 @@ Fleet
spec
-
-FleetSpec
+
+GameServerAllocationSpec
Fleet
status
-
-FleetStatus
+
+GameServerAllocationStatus
|
-
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.
+
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
Description | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
-apiVersion
-string |
-
-
-agones.dev/v1
-
- |
-||||||||||||||||||||||
-kind
-string
- |
-GameServer |
-||||||||||||||||||||||
-metadata
-
-
-Kubernetes meta/v1.ObjectMeta
-
-
- |
-
-Refer to the Kubernetes API documentation for the fields of the
-metadata field.
- |
-||||||||||||||||||||||
-spec
-
-
-GameServerSpec
-
-
- |
-
- - -
GameServerAllocationSpec +++(Appears on: +GameServerAllocation) + ++ GameServerAllocationSpec is the spec for a GameServerAllocation + +
Scheduling strategy. Defaults to “Packed”. |
||||||||||||||||||||||
-status
+metadata
-
-GameServerStatus
+
+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 |
string
alias)+(Appears on: +GameServerAllocationStatus) +
++
GameServerAllocationState is the Allocation state
+ +-
GameServerSet is the data structure for a set of GameServers. -This matches philosophically with the relationship between -Deployments and ReplicaSets
+(Appears on: +GameServerAllocation) + ++
GameServerAllocationStatus is the status for an GameServerAllocation resource
-apiVersion
-string |
-
-
-agones.dev/v1
-
- |
-||||||||
-kind
-string
- |
-GameServerSet |
-||||||||
-metadata
+state
-
-Kubernetes meta/v1.ObjectMeta
+
+GameServerAllocationState
|
-Refer to the Kubernetes API documentation for the fields of the
-metadata field.
+GameServerState is the current state of an GameServerAllocation, e.g. Allocated, or UnAllocated |
||||||||
-spec
-
-
-GameServerSetSpec
-
-
- |
-
- - -
|
||||||||
-status
+source
-
-GameServerSetStatus
-
+string
|
+ If the allocation is from a remote cluster, Source is the endpoint of the remote agones-allocator. +Otherwise, Source is “local” |
(Appears on: -FleetStatus, -GameServerSetStatus) +GameServerAllocationSpec)
-
AggregatedPlayerStatus stores total player tracking values
+GameServerSelector contains all the filter options for selecting +a GameServer for allocation.
-count
+LabelSelector
-int64
+
+Kubernetes meta/v1.LabelSelector
+
|
+
+(Members of See: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ |
-capacity
+gameServerState
-int64
+
+GameServerState
+
|
+(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. |
-(Appears on: -FleetSpec, -GameServerSetSpec) -
--
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.
Field | -Description | +
---|---|
+players
+
+
+PlayerSelector
+
+
+ |
+
+(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. + |
-labels
+counters
-map[string]string
+
+map[string]agones.dev/agones/pkg/apis/allocation/v1.CounterSelector
+
|
(Optional)
- Labels to be applied to the (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. |
-annotations
+lists
-map[string]string
+
+map[string]agones.dev/agones/pkg/apis/allocation/v1.ListSelector
+
|
(Optional)
- Annotations to be applied to the (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. |
(Appears on: -GameServerSpec, -GameServerStatus) +GameServerSelector)
-
CounterStatus stores the current counter 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: “”
-count
+containsValue
-int64
+string
|
@@ -5865,7 +6101,7 @@ CounterStatus |
-capacity
+minAvailable
int64
@@ -5873,62 +6109,26 @@ CounterStatus
|
-(Appears on: -GameServerSpec, -GameServerStatus) -
--
Eviction specifies the eviction tolerance of the GameServer
- -Field | -Description | -
---|---|
-safe
+maxAvailable
-
-EvictionSafe
-
+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 |
string
alias)-(Appears on: -Eviction) -
--
EvictionSafe specified whether the game server supports termination via SIGTERM
- -(Appears on: -Fleet) +GameServerAllocationSpec)
-
FleetSpec is the spec for a Fleet
+MetaPatch is the metadata used to patch the GameServer metadata on allocation
-replicas
+labels
-int32
+map[string]string
|
- Replicas are the number of GameServers that should be in this set. Defaults to 0. |
-allocationOverflow
+annotations
-
-AllocationOverflow
-
+map[string]string
|
-(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 |
+(Appears on: +GameServerAllocationSpec) +
++
MultiClusterSetting specifies settings for multi-cluster allocation.
+ +
-strategy
-
-
-Kubernetes apps/v1.DeploymentStrategy
-
-
- |
-
- Deployment strategy - |
+Field | +Description |
---|---|---|---|
-scheduling
+enabled
-agones.dev/agones/pkg/apis.SchedulingStrategy
+bool
|
- Scheduling strategy. Defaults to “Packed”. |
||
-template
+policySelector
-
-GameServerTemplateSpec
+
+Kubernetes meta/v1.LabelSelector
|
- Template the GameServer template to apply for this Fleet |
(Appears on: -Fleet, -FleetAutoscaleRequest) +GameServerSelector)
-
FleetStatus is the status of a Fleet
+PlayerSelector is the filter options for a GameServer based on player counts
-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. - |
-
-allocatedReplicas
+minAvailable
-int32
+int64
|
- AllocatedReplicas are the number of Allocated GameServer replicas |
-players
+maxAvailable
-
-AggregatedPlayerStatus
-
+int64
|
-(Optional)
- [Stage:Alpha] -[FeatureFlag:PlayerTracking] -Players are the current total player capacity and count for this Fleet |
-(Appears on: -GameServerSpec) +
Package v1 is the v1 version of the API.
+Resource Types: + +-
GameServerPort defines a set of Ports that -are to be exposed via the GameServer
+FleetAutoscaler is the data structure for a FleetAutoscaler resource
-name
-
+apiVersion
+string |
+
+
+autoscaling.agones.dev/v1
+
+ |
+
+kind
string
+ |
+FleetAutoscaler |
+
+metadata
+
+
+Kubernetes meta/v1.ObjectMeta
+
|
- 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 |
-
-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.
(Appears on: -GameServerSet) +FleetAutoscalerPolicy)
-
GameServerSetSpec the specification for GameServerSet
+BufferPolicy controls the desired behavior of the buffer policy.
-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 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) |
(Appears on: -GameServerSet) +FleetAutoscalerSync)
-
GameServerSetStatus is the status of a GameServerSet
+FixedIntervalSync controls the desired behavior of the fixed interval based sync.
-replicas
+seconds
int32
|
- Replicas is the total number of current GameServer replicas +Seconds defines how often we run fleet autoscaling in seconds |
+(Appears on: +FleetAutoscaleReview) +
++
FleetAutoscaleRequest defines the request to webhook autoscaler endpoint
+ +
-readyReplicas
-
-int32
-
- |
-
- ReadyReplicas is the number of Ready GameServer replicas - |
+Field | +Description |
---|---|---|---|
-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 |
(Appears on: -GameServer, -GameServerTemplateSpec) +FleetAutoscaleReview)
-
GameServerSpec is the spec for a GameServer resource
+FleetAutoscaleResponse defines the response of webhook autoscaler endpoint
-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 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” - |
+Field | +Description |
---|---|---|---|
-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. - |
+
+(Appears on: +FleetAutoscalerSpec) +
++
FleetAutoscalerPolicy describes how to scale a fleet
+ +Field | +Description |
---|---|
-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. |
string
alias)(Appears on: -GameServerSelector, -GameServerStatus) +FleetAutoscalerPolicy)
-
GameServerState is the state for the GameServer
+FleetAutoscalerPolicyType is the policy for autoscaling +for a given Fleet
-(Appears on: -GameServer) +FleetAutoscaler)
-
GameServerStatus is the status for a GameServer resource
+FleetAutoscalerSpec is the spec for a Fleet Scaler
-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 |
+(Appears on: +FleetAutoscaler) +
++
FleetAutoscalerStatus defines the current status of a FleetAutoscaler
+ +
-nodeName
-
-string
-
- |
-- | +Field | +Description |
---|---|---|---|
-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. |
(Appears on: -GameServerAllocationStatus, -GameServerStatus) +FleetAutoscalerSpec)
-
GameServerStatusPort shows the port that was allocated to a -GameServer.
+FleetAutoscalerSync describes when to sync a fleet
-name
+type
-string
+
+FleetAutoscalerSyncType
+
|
+ Type of autoscaling sync. |
-port
+fixedInterval
-int32
+
+FixedIntervalSync
+
|
+(Optional)
+ FixedInterval config params. Present only if FleetAutoscalerSyncType = FixedInterval. |
string
alias)+(Appears on: +FleetAutoscalerSync) +
++
FleetAutoscalerSyncType is the sync strategy for a given Fleet
+ +(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
-metadata
-
-
-Kubernetes meta/v1.ObjectMeta
-
-
- |
-
-Refer to the Kubernetes API documentation for the fields of the
-metadata field.
- |
-||||||||||||||||||||||||||||||||||||||||||||||||||||||
-spec
-
-
-GameServerSpec
-
-
- |
-
- - -
+ multicluster.agones.dev/v1++ Package v1 is the v1 version of the API. + +Resource Types: + +GameServerAllocationPolicy +++ GameServerAllocationPolicy is the Schema for the gameserverallocationpolicies API + +
GameServerTemplateSpecHealth
+ |
-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 |
-(Appears on: -GameServerSpec, -GameServerStatus) -
--
ListStatus stores the current list values
- -Field | -Description | -
---|---|
-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. |
-(Appears on: -GameServerStatus) -
--
PlayerStatus stores the current player capacity values
+ConnectionInfoIterator an iterator on ClusterConnectionInfo
-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 |
-(Appears on: -GameServerSpec) -
--
PlayersSpec tracks the initial player capacity
- -Field | -Description | -
---|---|
-initialCapacity
+clusterBlackList
-int64
+map[string]bool
|
+ clusterBlackList the cluster blacklist for the clusters that has already returned |
string
alias)-(Appears on: -GameServerPort) -
--
PortPolicy is the port policy for the GameServer
- -(Appears on: -GameServerSpec) +GameServerAllocationPolicy)
-
SdkServer specifies parameters for the Agones SDK Server sidecar container
+GameServerAllocationPolicySpec defines the desired state of GameServerAllocationPolicy
-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 |
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..214c557da1 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 GameServers when the number of Allocated GameServers drops below
+ # the desired replicas on the underlying `GameServerSet`.
+ allocationOverflow: # applied to the GameServerSet's number Allocated GameServers that are over the desired replicas
+ 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)