From b79b138f24a75b595e16024a68f07fb77f1feb05 Mon Sep 17 00:00:00 2001 From: Ivy Gooch Date: Tue, 23 May 2023 20:29:00 +0000 Subject: [PATCH 1/6] Adds Counters and Lists Aggregate Values to GameServerSet and Fleet --- pkg/apis/agones/v1/common.go | 12 +++ pkg/apis/agones/v1/fleet.go | 8 ++ pkg/apis/agones/v1/gameserverset.go | 8 ++ pkg/fleets/controller.go | 52 +++++++++++ pkg/fleets/controller_test.go | 122 ++++++++++++++++++++++++++ pkg/gameserversets/controller.go | 55 +++++++++++- pkg/gameserversets/controller_test.go | 96 ++++++++++++++++++++ 7 files changed, 352 insertions(+), 1 deletion(-) diff --git a/pkg/apis/agones/v1/common.go b/pkg/apis/agones/v1/common.go index 12fcd3d212..91cdddbf67 100644 --- a/pkg/apis/agones/v1/common.go +++ b/pkg/apis/agones/v1/common.go @@ -46,6 +46,18 @@ type AggregatedPlayerStatus struct { Capacity int64 `json:"capacity"` } +// AggregatedCounterStatus stores total Counter tracking values +type AggregatedCounterStatus struct { + Count int64 `json:"count"` + Capacity int64 `json:"capacity"` +} + +// AggregatedListStatus stores total List tracking values +type AggregatedListStatus struct { + Capacity int64 `json:"capacity"` + Values []string `json:"values"` +} + // crd is an interface to get Name and Kind of CRD type crd interface { GetName() string diff --git a/pkg/apis/agones/v1/fleet.go b/pkg/apis/agones/v1/fleet.go index db06b7b635..a8a8e42276 100644 --- a/pkg/apis/agones/v1/fleet.go +++ b/pkg/apis/agones/v1/fleet.go @@ -90,6 +90,14 @@ type FleetStatus struct { // Players are the current total player capacity and count for this Fleet // +optional Players *AggregatedPlayerStatus `json:"players,omitempty"` + // (Alpha, CountsAndLists feature flag) Counters provides aggregated Counter capacity and Counter + // count for this Fleet. + // +optional + Counters map[string]AggregatedCounterStatus `json:"counters,omitempty"` + // (Alpha, CountsAndLists feature flag) Lists provides aggregated List capacityv and List values + // for this Fleet. + // +optional + Lists map[string]AggregatedListStatus `json:"lists,omitempty"` } // GameServerSet returns a single GameServerSet for this Fleet definition diff --git a/pkg/apis/agones/v1/gameserverset.go b/pkg/apis/agones/v1/gameserverset.go index 7399e76dc3..a58ab41bb9 100644 --- a/pkg/apis/agones/v1/gameserverset.go +++ b/pkg/apis/agones/v1/gameserverset.go @@ -86,6 +86,14 @@ type GameServerSetStatus struct { // Players is the current total player capacity and count for this GameServerSet // +optional Players *AggregatedPlayerStatus `json:"players,omitempty"` + // (Alpha, CountsAndLists feature flag) Counters provides aggregated Counter capacity and Counter + // count for this GameServerSet. + // +optional + Counters map[string]AggregatedCounterStatus `json:"counters,omitempty"` + // (Alpha, CountsAndLists feature flag) Lists provides aggregated List capacity and List values + // for this GameServerSet. + // +optional + Lists map[string]AggregatedListStatus `json:"lists,omitempty"` } // ValidateUpdate validates when updates occur. The argument diff --git a/pkg/fleets/controller.go b/pkg/fleets/controller.go index 213aa1fd81..78d8ba4637 100644 --- a/pkg/fleets/controller.go +++ b/pkg/fleets/controller.go @@ -652,12 +652,20 @@ func (c *Controller) updateFleetStatus(ctx context.Context, fleet *agonesv1.Flee fCopy.Status.ReadyReplicas = 0 fCopy.Status.ReservedReplicas = 0 fCopy.Status.AllocatedReplicas = 0 + if runtime.FeatureEnabled(runtime.FeatureCountsAndLists) { + fCopy.Status.Counters = make(map[string]agonesv1.AggregatedCounterStatus) + fCopy.Status.Lists = make(map[string]agonesv1.AggregatedListStatus) + } for _, gsSet := range list { fCopy.Status.Replicas += gsSet.Status.Replicas fCopy.Status.ReadyReplicas += gsSet.Status.ReadyReplicas fCopy.Status.ReservedReplicas += gsSet.Status.ReservedReplicas fCopy.Status.AllocatedReplicas += gsSet.Status.AllocatedReplicas + if runtime.FeatureEnabled(runtime.FeatureCountsAndLists) { + fCopy.Status.Counters = mergeCounters(fCopy.Status.Counters, gsSet.Status.Counters) + fCopy.Status.Lists = mergeLists(fCopy.Status.Lists, gsSet.Status.Lists) + } } if runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { // to make this code simpler, while the feature gate is in place, @@ -693,3 +701,47 @@ func (c *Controller) filterGameServerSetByActive(fleet *agonesv1.Fleet, list []* return active, rest } + +// mergeCounters adds the contents of c2 into c1. +func mergeCounters(c1, c2 map[string]agonesv1.AggregatedCounterStatus) map[string]agonesv1.AggregatedCounterStatus { + if c1 == nil { + c1 = make(map[string]agonesv1.AggregatedCounterStatus) + } + + for key, val := range c2 { + // If the Counter exists in both maps, aggregate the values. + if counter, ok := c1[key]; ok { + counter.Capacity += val.Capacity + counter.Count += val.Count + c1[key] = counter + } else { + c1[key] = *val.DeepCopy() + } + } + + return c1 +} + +// mergeLists adds the contents of l2 into l1. +func mergeLists(l1, l2 map[string]agonesv1.AggregatedListStatus) map[string]agonesv1.AggregatedListStatus { + if l1 == nil { + l1 = make(map[string]agonesv1.AggregatedListStatus) + } + + for key, val := range l2 { + // If the List exists in both maps, aggregate the values. + // TODO: Will this cause issues with install/helm/agones/templates/crds/fleet.yaml because in + // the CRD we define a maximum capacity and maximum number of values as 1000? (Also a possible + // issue with there being a max of 1000 Lists in a Fleet per the CRD?) So far it passes unit tests... + if list, ok := l1[key]; ok { + list.Capacity += val.Capacity + // We do not remove duplicates here. + list.Values = append(list.Values, val.Values...) + l1[key] = list + } else { + l1[key] = *val.DeepCopy() + } + } + + return l1 +} diff --git a/pkg/fleets/controller_test.go b/pkg/fleets/controller_test.go index d607b1bd6f..2c87519cfe 100644 --- a/pkg/fleets/controller_test.go +++ b/pkg/fleets/controller_test.go @@ -685,6 +685,128 @@ func TestControllerUpdateFleetPlayerStatus(t *testing.T) { assert.True(t, updated) } +func TestControllerUpdateFleetCounterStatus(t *testing.T) { + t.Parallel() + + utilruntime.FeatureTestMutex.Lock() + defer utilruntime.FeatureTestMutex.Unlock() + + require.NoError(t, utilruntime.ParseFeatures(string(utilruntime.FeatureCountsAndLists)+"=true")) + + fleet := defaultFixture() + c, m := newFakeController() + + gsSet1 := fleet.GameServerSet() + gsSet1.ObjectMeta.Name = "gsSet1" + gsSet1.Status.Counters = map[string]agonesv1.AggregatedCounterStatus{ + "fullCounter": { + Capacity: 1000, + Count: 1000, + }, + } + + gsSet2 := fleet.GameServerSet() + gsSet2.ObjectMeta.Name = "gsSet2" + gsSet2.Status.Counters = map[string]agonesv1.AggregatedCounterStatus{ + "fullCounter": { + Capacity: 1000, + Count: 1000, + }, + "anotherCounter": { + Capacity: 10, + Count: 0, + }, + } + + m.AgonesClient.AddReactor("list", "gameserversets", + func(action k8stesting.Action) (bool, runtime.Object, error) { + return true, &agonesv1.GameServerSetList{Items: []agonesv1.GameServerSet{*gsSet1, *gsSet2}}, nil + }) + + updated := false + m.AgonesClient.AddReactor("update", "fleets", + func(action k8stesting.Action) (bool, runtime.Object, error) { + updated = true + ua := action.(k8stesting.UpdateAction) + fleet := ua.GetObject().(*agonesv1.Fleet) + + assert.Equal(t, int64(2000), fleet.Status.Counters["fullCounter"].Capacity) + assert.Equal(t, int64(2000), fleet.Status.Counters["fullCounter"].Count) + assert.Equal(t, int64(10), fleet.Status.Counters["anotherCounter"].Capacity) + assert.Equal(t, int64(0), fleet.Status.Counters["anotherCounter"].Count) + + return true, fleet, nil + }) + + ctx, cancel := agtesting.StartInformers(m, c.fleetSynced, c.gameServerSetSynced) + defer cancel() + + err := c.updateFleetStatus(ctx, fleet) + assert.Nil(t, err) + assert.True(t, updated) +} + +func TestControllerUpdateFleetListStatus(t *testing.T) { + t.Parallel() + + utilruntime.FeatureTestMutex.Lock() + defer utilruntime.FeatureTestMutex.Unlock() + + require.NoError(t, utilruntime.ParseFeatures(string(utilruntime.FeatureCountsAndLists)+"=true")) + + fleet := defaultFixture() + c, m := newFakeController() + + gsSet1 := fleet.GameServerSet() + gsSet1.ObjectMeta.Name = "gsSet1" + gsSet1.Status.Lists = map[string]agonesv1.AggregatedListStatus{ + "fullList": { + Capacity: 1000, + Values: []string{"ab", "ba", "ac", "ca", "ad", "da", "ae", "ea", "af", "fa", "ag", "ga", "ah", "ha", "ai", "ia", "aj", "ja", "ak", "ka", "al", "la", "am", "ma", "an", "na", "ao", "oa", "ap", "pa", "aq", "qa", "ar", "ra", "as", "sa", "at", "ta", "au", "ua", "av", "va", "aw", "wa", "ax", "xa", "ay", "ya", "az", "za", "aA", "Aa", "aB", "Ba", "aC", "Ca", "aD", "Da", "aE", "Ea", "aF", "Fa", "aG", "Ga", "aH", "Ha", "aI", "Ia", "aJ", "Ja", "aK", "Ka", "aL", "La", "aM", "Ma", "aN", "Na", "aO", "Oa", "aP", "Pa", "aQ", "Qa", "aR", "Ra", "aS", "Sa", "aT", "Ta", "aU", "Ua", "aV", "Va", "aW", "Wa", "aX", "Xa", "aY", "Ya", "aZ", "Za", "a0", "0a", "a1", "1a", "a2", "2a", "a3", "3a", "a4", "4a", "a5", "5a", "a6", "6a", "a7", "7a", "a8", "8a", "a9", "9a", "bc", "cb", "bd", "db", "be", "eb", "bf", "fb", "bg", "gb", "bh", "hb", "bi", "ib", "bj", "jb", "bk", "kb", "bl", "lb", "bm", "mb", "bn", "nb", "bo", "ob", "bp", "pb", "bq", "qb", "br", "rb", "bs", "sb", "bt", "tb", "bu", "ub", "bv", "vb", "bw", "wb", "bx", "xb", "by", "yb", "bz", "zb", "bA", "Ab", "bB", "Bb", "bC", "Cb", "bD", "Db", "bE", "Eb", "bF", "Fb", "bG", "Gb", "bH", "Hb", "bI", "Ib", "bJ", "Jb", "bK", "Kb", "bL", "Lb", "bM", "Mb", "bN", "Nb", "bO", "Ob", "bP", "Pb", "bQ", "Qb", "bR", "Rb", "bS", "Sb", "bT", "Tb", "bU", "Ub", "bV", "Vb", "bW", "Wb", "bX", "Xb", "bY", "Yb", "bZ", "Zb", "b0", "0b", "b1", "1b", "b2", "2b", "b3", "3b", "b4", "4b", "b5", "5b", "b6", "6b", "b7", "7b", "b8", "8b", "b9", "9b", "cd", "dc", "ce", "ec", "cf", "fc", "cg", "gc", "ch", "hc", "ci", "ic", "cj", "jc", "ck", "kc", "cl", "lc", "cm", "mc", "cn", "nc", "co", "oc", "cp", "pc", "cq", "qc", "cr", "rc", "cs", "sc", "ct", "tc", "cu", "uc", "cv", "vc", "cw", "wc", "cx", "xc", "cy", "yc", "cz", "zc", "cA", "Ac", "cB", "Bc", "cC", "Cc", "cD", "Dc", "cE", "Ec", "cF", "Fc", "cG", "Gc", "cH", "Hc", "cI", "Ic", "cJ", "Jc", "cK", "Kc", "cL", "Lc", "cM", "Mc", "cN", "Nc", "cO", "Oc", "cP", "Pc", "cQ", "Qc", "cR", "Rc", "cS", "Sc", "cT", "Tc", "cU", "Uc", "cV", "Vc", "cW", "Wc", "cX", "Xc", "cY", "Yc", "cZ", "Zc", "c0", "0c", "c1", "1c", "c2", "2c", "c3", "3c", "c4", "4c", "c5", "5c", "c6", "6c", "c7", "7c", "c8", "8c", "c9", "9c", "de", "ed", "df", "fd", "dg", "gd", "dh", "hd", "di", "id", "dj", "jd", "dk", "kd", "dl", "ld", "dm", "md", "dn", "nd", "do", "od", "dp", "pd", "dq", "qd", "dr", "rd", "ds", "sd", "dt", "td", "du", "ud", "dv", "vd", "dw", "wd", "dx", "xd", "dy", "yd", "dz", "zd", "dA", "Ad", "dB", "Bd", "dC", "Cd", "dD", "Dd", "dE", "Ed", "dF", "Fd", "dG", "Gd", "dH", "Hd", "dI", "Id", "dJ", "Jd", "dK", "Kd", "dL", "Ld", "dM", "Md", "dN", "Nd", "dO", "Od", "dP", "Pd", "dQ", "Qd", "dR", "Rd", "dS", "Sd", "dT", "Td", "dU", "Ud", "dV", "Vd", "dW", "Wd", "dX", "Xd", "dY", "Yd", "dZ", "Zd", "d0", "0d", "d1", "1d", "d2", "2d", "d3", "3d", "d4", "4d", "d5", "5d", "d6", "6d", "d7", "7d", "d8", "8d", "d9", "9d", "ef", "fe", "eg", "ge", "eh", "he", "ei", "ie", "ej", "je", "ek", "ke", "el", "le", "em", "me", "en", "ne", "eo", "oe", "ep", "pe", "eq", "qe", "er", "re", "es", "se", "et", "te", "eu", "ue", "ev", "ve", "ew", "we", "ex", "xe", "ey", "ye", "ez", "ze", "eA", "Ae", "eB", "Be", "eC", "Ce", "eD", "De", "eE", "Ee", "eF", "Fe", "eG", "Ge", "eH", "He", "eI", "Ie", "eJ", "Je", "eK", "Ke", "eL", "Le", "eM", "Me", "eN", "Ne", "eO", "Oe", "eP", "Pe", "eQ", "Qe", "eR", "Re", "eS", "Se", "eT", "Te", "eU", "Ue", "eV", "Ve", "eW", "We", "eX", "Xe", "eY", "Ye", "eZ", "Ze", "e0", "0e", "e1", "1e", "e2", "2e", "e3", "3e", "e4", "4e", "e5", "5e", "e6", "6e", "e7", "7e", "e8", "8e", "e9", "9e", "fg", "gf", "fh", "hf", "fi", "if", "fj", "jf", "fk", "kf", "fl", "lf", "fm", "mf", "fn", "nf", "fo", "of", "fp", "pf", "fq", "qf", "fr", "rf", "fs", "sf", "ft", "tf", "fu", "uf", "fv", "vf", "fw", "wf", "fx", "xf", "fy", "yf", "fz", "zf", "fA", "Af", "fB", "Bf", "fC", "Cf", "fD", "Df", "fE", "Ef", "fF", "Ff", "fG", "Gf", "fH", "Hf", "fI", "If", "fJ", "Jf", "fK", "Kf", "fL", "Lf", "fM", "Mf", "fN", "Nf", "fO", "Of", "fP", "Pf", "fQ", "Qf", "fR", "Rf", "fS", "Sf", "fT", "Tf", "fU", "Uf", "fV", "Vf", "fW", "Wf", "fX", "Xf", "fY", "Yf", "fZ", "Zf", "f0", "0f", "f1", "1f", "f2", "2f", "f3", "3f", "f4", "4f", "f5", "5f", "f6", "6f", "f7", "7f", "f8", "8f", "f9", "9f", "gh", "hg", "gi", "ig", "gj", "jg", "gk", "kg", "gl", "lg", "gm", "mg", "gn", "ng", "go", "og", "gp", "pg", "gq", "qg", "gr", "rg", "gs", "sg", "gt", "tg", "gu", "ug", "gv", "vg", "gw", "wg", "gx", "xg", "gy", "yg", "gz", "zg", "gA", "Ag", "gB", "Bg", "gC", "Cg", "gD", "Dg", "gE", "Eg", "gF", "Fg", "gG", "Gg", "gH", "Hg", "gI", "Ig", "gJ", "Jg", "gK", "Kg", "gL", "Lg", "gM", "Mg", "gN", "Ng", "gO", "Og", "gP", "Pg", "gQ", "Qg", "gR", "Rg", "gS", "Sg", "gT", "Tg", "gU", "Ug", "gV", "Vg", "gW", "Wg", "gX", "Xg", "gY", "Yg", "gZ", "Zg", "g0", "0g", "g1", "1g", "g2", "2g", "g3", "3g", "g4", "4g", "g5", "5g", "g6", "6g", "g7", "7g", "g8", "8g", "g9", "9g", "hi", "ih", "hj", "jh", "hk", "kh", "hl", "lh", "hm", "mh", "hn", "nh", "ho", "oh", "hp", "ph", "hq", "qh", "hr", "rh", "hs", "sh", "ht", "th", "hu", "uh", "hv", "vh", "hw", "wh", "hx", "xh", "hy", "yh", "hz", "zh", "hA", "Ah", "hB", "Bh", "hC", "Ch", "hD", "Dh", "hE", "Eh", "hF", "Fh", "hG", "Gh", "hH", "Hh", "hI", "Ih", "hJ", "Jh", "hK", "Kh", "hL", "Lh", "hM", "Mh", "hN", "Nh", "hO", "Oh", "hP", "Ph", "hQ", "Qh", "hR", "Rh", "hS", "Sh", "hT", "Th", "hU", "Uh", "hV", "Vh", "hW", "Wh", "hX", "Xh", "hY", "Yh", "hZ", "Zh", "h0", "0h", "h1", "1h", "h2", "2h", "h3", "3h", "h4", "4h", "h5", "5h", "h6", "6h", "h7", "7h", "h8", "8h", "h9", "9h", "ij", "ji", "ik", "ki", "il", "li", "im", "mi", "in", "ni", "io", "oi", "ip", "pi", "iq", "qi", "ir", "ri", "is", "si", "it", "ti", "iu", "ui", "iv", "vi", "iw", "wi", "ix", "xi", "iy", "yi", "iz", "zi", "iA", "Ai", "iB", "Bi", "iC", "Ci", "iD", "Di", "iE", "Ei", "iF", "Fi", "iG", "Gi", "iH", "Hi", "iI", "Ii", "iJ", "Ji", "iK", "Ki", "iL", "Li", "iM", "Mi", "iN", "Ni", "iO", "Oi", "iP", "Pi", "iQ", "Qi", "iR", "Ri", "iS", "Si", "iT", "Ti", "iU", "Ui", "iV", "Vi", "iW", "Wi"}, + }, + } + + gsSet2 := fleet.GameServerSet() + gsSet2.ObjectMeta.Name = "gsSet2" + gsSet2.Status.Lists = map[string]agonesv1.AggregatedListStatus{ + "fullList": { + Capacity: 1000, + Values: []string{"abc"}, + }, + "anotherList": { + Capacity: 10, + Values: []string{"123"}, + }, + } + + m.AgonesClient.AddReactor("list", "gameserversets", + func(action k8stesting.Action) (bool, runtime.Object, error) { + return true, &agonesv1.GameServerSetList{Items: []agonesv1.GameServerSet{*gsSet1, *gsSet2}}, nil + }) + + updated := false + m.AgonesClient.AddReactor("update", "fleets", + func(action k8stesting.Action) (bool, runtime.Object, error) { + updated = true + ua := action.(k8stesting.UpdateAction) + fleet := ua.GetObject().(*agonesv1.Fleet) + + assert.Equal(t, int64(2000), fleet.Status.Lists["fullList"].Capacity) + assert.Equal(t, []string{"ab", "ba", "ac", "ca", "ad", "da", "ae", "ea", "af", "fa", "ag", "ga", "ah", "ha", "ai", "ia", "aj", "ja", "ak", "ka", "al", "la", "am", "ma", "an", "na", "ao", "oa", "ap", "pa", "aq", "qa", "ar", "ra", "as", "sa", "at", "ta", "au", "ua", "av", "va", "aw", "wa", "ax", "xa", "ay", "ya", "az", "za", "aA", "Aa", "aB", "Ba", "aC", "Ca", "aD", "Da", "aE", "Ea", "aF", "Fa", "aG", "Ga", "aH", "Ha", "aI", "Ia", "aJ", "Ja", "aK", "Ka", "aL", "La", "aM", "Ma", "aN", "Na", "aO", "Oa", "aP", "Pa", "aQ", "Qa", "aR", "Ra", "aS", "Sa", "aT", "Ta", "aU", "Ua", "aV", "Va", "aW", "Wa", "aX", "Xa", "aY", "Ya", "aZ", "Za", "a0", "0a", "a1", "1a", "a2", "2a", "a3", "3a", "a4", "4a", "a5", "5a", "a6", "6a", "a7", "7a", "a8", "8a", "a9", "9a", "bc", "cb", "bd", "db", "be", "eb", "bf", "fb", "bg", "gb", "bh", "hb", "bi", "ib", "bj", "jb", "bk", "kb", "bl", "lb", "bm", "mb", "bn", "nb", "bo", "ob", "bp", "pb", "bq", "qb", "br", "rb", "bs", "sb", "bt", "tb", "bu", "ub", "bv", "vb", "bw", "wb", "bx", "xb", "by", "yb", "bz", "zb", "bA", "Ab", "bB", "Bb", "bC", "Cb", "bD", "Db", "bE", "Eb", "bF", "Fb", "bG", "Gb", "bH", "Hb", "bI", "Ib", "bJ", "Jb", "bK", "Kb", "bL", "Lb", "bM", "Mb", "bN", "Nb", "bO", "Ob", "bP", "Pb", "bQ", "Qb", "bR", "Rb", "bS", "Sb", "bT", "Tb", "bU", "Ub", "bV", "Vb", "bW", "Wb", "bX", "Xb", "bY", "Yb", "bZ", "Zb", "b0", "0b", "b1", "1b", "b2", "2b", "b3", "3b", "b4", "4b", "b5", "5b", "b6", "6b", "b7", "7b", "b8", "8b", "b9", "9b", "cd", "dc", "ce", "ec", "cf", "fc", "cg", "gc", "ch", "hc", "ci", "ic", "cj", "jc", "ck", "kc", "cl", "lc", "cm", "mc", "cn", "nc", "co", "oc", "cp", "pc", "cq", "qc", "cr", "rc", "cs", "sc", "ct", "tc", "cu", "uc", "cv", "vc", "cw", "wc", "cx", "xc", "cy", "yc", "cz", "zc", "cA", "Ac", "cB", "Bc", "cC", "Cc", "cD", "Dc", "cE", "Ec", "cF", "Fc", "cG", "Gc", "cH", "Hc", "cI", "Ic", "cJ", "Jc", "cK", "Kc", "cL", "Lc", "cM", "Mc", "cN", "Nc", "cO", "Oc", "cP", "Pc", "cQ", "Qc", "cR", "Rc", "cS", "Sc", "cT", "Tc", "cU", "Uc", "cV", "Vc", "cW", "Wc", "cX", "Xc", "cY", "Yc", "cZ", "Zc", "c0", "0c", "c1", "1c", "c2", "2c", "c3", "3c", "c4", "4c", "c5", "5c", "c6", "6c", "c7", "7c", "c8", "8c", "c9", "9c", "de", "ed", "df", "fd", "dg", "gd", "dh", "hd", "di", "id", "dj", "jd", "dk", "kd", "dl", "ld", "dm", "md", "dn", "nd", "do", "od", "dp", "pd", "dq", "qd", "dr", "rd", "ds", "sd", "dt", "td", "du", "ud", "dv", "vd", "dw", "wd", "dx", "xd", "dy", "yd", "dz", "zd", "dA", "Ad", "dB", "Bd", "dC", "Cd", "dD", "Dd", "dE", "Ed", "dF", "Fd", "dG", "Gd", "dH", "Hd", "dI", "Id", "dJ", "Jd", "dK", "Kd", "dL", "Ld", "dM", "Md", "dN", "Nd", "dO", "Od", "dP", "Pd", "dQ", "Qd", "dR", "Rd", "dS", "Sd", "dT", "Td", "dU", "Ud", "dV", "Vd", "dW", "Wd", "dX", "Xd", "dY", "Yd", "dZ", "Zd", "d0", "0d", "d1", "1d", "d2", "2d", "d3", "3d", "d4", "4d", "d5", "5d", "d6", "6d", "d7", "7d", "d8", "8d", "d9", "9d", "ef", "fe", "eg", "ge", "eh", "he", "ei", "ie", "ej", "je", "ek", "ke", "el", "le", "em", "me", "en", "ne", "eo", "oe", "ep", "pe", "eq", "qe", "er", "re", "es", "se", "et", "te", "eu", "ue", "ev", "ve", "ew", "we", "ex", "xe", "ey", "ye", "ez", "ze", "eA", "Ae", "eB", "Be", "eC", "Ce", "eD", "De", "eE", "Ee", "eF", "Fe", "eG", "Ge", "eH", "He", "eI", "Ie", "eJ", "Je", "eK", "Ke", "eL", "Le", "eM", "Me", "eN", "Ne", "eO", "Oe", "eP", "Pe", "eQ", "Qe", "eR", "Re", "eS", "Se", "eT", "Te", "eU", "Ue", "eV", "Ve", "eW", "We", "eX", "Xe", "eY", "Ye", "eZ", "Ze", "e0", "0e", "e1", "1e", "e2", "2e", "e3", "3e", "e4", "4e", "e5", "5e", "e6", "6e", "e7", "7e", "e8", "8e", "e9", "9e", "fg", "gf", "fh", "hf", "fi", "if", "fj", "jf", "fk", "kf", "fl", "lf", "fm", "mf", "fn", "nf", "fo", "of", "fp", "pf", "fq", "qf", "fr", "rf", "fs", "sf", "ft", "tf", "fu", "uf", "fv", "vf", "fw", "wf", "fx", "xf", "fy", "yf", "fz", "zf", "fA", "Af", "fB", "Bf", "fC", "Cf", "fD", "Df", "fE", "Ef", "fF", "Ff", "fG", "Gf", "fH", "Hf", "fI", "If", "fJ", "Jf", "fK", "Kf", "fL", "Lf", "fM", "Mf", "fN", "Nf", "fO", "Of", "fP", "Pf", "fQ", "Qf", "fR", "Rf", "fS", "Sf", "fT", "Tf", "fU", "Uf", "fV", "Vf", "fW", "Wf", "fX", "Xf", "fY", "Yf", "fZ", "Zf", "f0", "0f", "f1", "1f", "f2", "2f", "f3", "3f", "f4", "4f", "f5", "5f", "f6", "6f", "f7", "7f", "f8", "8f", "f9", "9f", "gh", "hg", "gi", "ig", "gj", "jg", "gk", "kg", "gl", "lg", "gm", "mg", "gn", "ng", "go", "og", "gp", "pg", "gq", "qg", "gr", "rg", "gs", "sg", "gt", "tg", "gu", "ug", "gv", "vg", "gw", "wg", "gx", "xg", "gy", "yg", "gz", "zg", "gA", "Ag", "gB", "Bg", "gC", "Cg", "gD", "Dg", "gE", "Eg", "gF", "Fg", "gG", "Gg", "gH", "Hg", "gI", "Ig", "gJ", "Jg", "gK", "Kg", "gL", "Lg", "gM", "Mg", "gN", "Ng", "gO", "Og", "gP", "Pg", "gQ", "Qg", "gR", "Rg", "gS", "Sg", "gT", "Tg", "gU", "Ug", "gV", "Vg", "gW", "Wg", "gX", "Xg", "gY", "Yg", "gZ", "Zg", "g0", "0g", "g1", "1g", "g2", "2g", "g3", "3g", "g4", "4g", "g5", "5g", "g6", "6g", "g7", "7g", "g8", "8g", "g9", "9g", "hi", "ih", "hj", "jh", "hk", "kh", "hl", "lh", "hm", "mh", "hn", "nh", "ho", "oh", "hp", "ph", "hq", "qh", "hr", "rh", "hs", "sh", "ht", "th", "hu", "uh", "hv", "vh", "hw", "wh", "hx", "xh", "hy", "yh", "hz", "zh", "hA", "Ah", "hB", "Bh", "hC", "Ch", "hD", "Dh", "hE", "Eh", "hF", "Fh", "hG", "Gh", "hH", "Hh", "hI", "Ih", "hJ", "Jh", "hK", "Kh", "hL", "Lh", "hM", "Mh", "hN", "Nh", "hO", "Oh", "hP", "Ph", "hQ", "Qh", "hR", "Rh", "hS", "Sh", "hT", "Th", "hU", "Uh", "hV", "Vh", "hW", "Wh", "hX", "Xh", "hY", "Yh", "hZ", "Zh", "h0", "0h", "h1", "1h", "h2", "2h", "h3", "3h", "h4", "4h", "h5", "5h", "h6", "6h", "h7", "7h", "h8", "8h", "h9", "9h", "ij", "ji", "ik", "ki", "il", "li", "im", "mi", "in", "ni", "io", "oi", "ip", "pi", "iq", "qi", "ir", "ri", "is", "si", "it", "ti", "iu", "ui", "iv", "vi", "iw", "wi", "ix", "xi", "iy", "yi", "iz", "zi", "iA", "Ai", "iB", "Bi", "iC", "Ci", "iD", "Di", "iE", "Ei", "iF", "Fi", "iG", "Gi", "iH", "Hi", "iI", "Ii", "iJ", "Ji", "iK", "Ki", "iL", "Li", "iM", "Mi", "iN", "Ni", "iO", "Oi", "iP", "Pi", "iQ", "Qi", "iR", "Ri", "iS", "Si", "iT", "Ti", "iU", "Ui", "iV", "Vi", "iW", "Wi", "abc"}, fleet.Status.Lists["fullList"].Values) + assert.Equal(t, int64(10), fleet.Status.Lists["anotherList"].Capacity) + assert.Equal(t, []string{"123"}, fleet.Status.Lists["anotherList"].Values) + + return true, fleet, nil + }) + + ctx, cancel := agtesting.StartInformers(m, c.fleetSynced, c.gameServerSetSynced) + defer cancel() + + err := c.updateFleetStatus(ctx, fleet) + assert.Nil(t, err) + assert.True(t, updated) +} + func TestControllerFilterGameServerSetByActive(t *testing.T) { t.Parallel() diff --git a/pkg/gameserversets/controller.go b/pkg/gameserversets/controller.go index 52cf100899..ab6aed73b8 100644 --- a/pkg/gameserversets/controller.go +++ b/pkg/gameserversets/controller.go @@ -33,6 +33,7 @@ import ( "agones.dev/agones/pkg/util/runtime" "agones.dev/agones/pkg/util/webhooks" "agones.dev/agones/pkg/util/workerqueue" + "github.com/google/go-cmp/cmp" "github.com/heptiolabs/healthcheck" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -588,7 +589,7 @@ func (c *Controller) syncGameServerSetStatus(ctx context.Context, gsSet *agonesv // updateStatusIfChanged updates GameServerSet status if it's different than provided. func (c *Controller) updateStatusIfChanged(ctx context.Context, gsSet *agonesv1.GameServerSet, status agonesv1.GameServerSetStatus) error { - if gsSet.Status != status { + if !cmp.Equal(gsSet.Status, status) { gsSetCopy := gsSet.DeepCopy() gsSetCopy.Status = status _, err := c.gameServerSetGetter.GameServerSets(gsSet.ObjectMeta.Namespace).UpdateStatus(ctx, gsSetCopy, metav1.UpdateOptions{}) @@ -618,6 +619,14 @@ func computeStatus(list []*agonesv1.GameServer) agonesv1.GameServerSetStatus { case agonesv1.GameServerStateReserved: status.ReservedReplicas++ } + + // TODO: Aggregates all Counters and Lists for all GameServer States that are not Deleting. This + // means that unlike player tracking below, this will aggregate values during GameServerStateCreating. + // Should I mimic player tracking below and only aggregate for cases Ready, Reserved, and Allocated? + if runtime.FeatureEnabled(runtime.FeatureCountsAndLists) { + status.Counters = aggregateCounters(status.Counters, gs.Status.Counters) + status.Lists = aggregateLists(status.Lists, gs.Status.Lists) + } } if runtime.FeatureEnabled(runtime.FeaturePlayerTracking) { @@ -640,3 +649,47 @@ func computeStatus(list []*agonesv1.GameServer) agonesv1.GameServerSetStatus { return status } + +// aggregateCounters adds the contents of a CounterStatus map to an AggregatedCounterStatus map. +func aggregateCounters(aggCounterStatus map[string]agonesv1.AggregatedCounterStatus, counterStatus map[string]agonesv1.CounterStatus) map[string]agonesv1.AggregatedCounterStatus { + if aggCounterStatus == nil { + aggCounterStatus = make(map[string]agonesv1.AggregatedCounterStatus) + } + + for key, val := range counterStatus { + // If the Counter exists in both maps, aggregate the values. + if counter, ok := aggCounterStatus[key]; ok { + counter.Count += val.Count + counter.Capacity += val.Capacity + aggCounterStatus[key] = counter + } else { + aggCounterStatus[key] = agonesv1.AggregatedCounterStatus(*val.DeepCopy()) + } + } + + return aggCounterStatus +} + +// aggregateLists adds the contents of a ListStatus map to an AggregatedListStatus map. +func aggregateLists(aggListStatus map[string]agonesv1.AggregatedListStatus, listStatus map[string]agonesv1.ListStatus) map[string]agonesv1.AggregatedListStatus { + if aggListStatus == nil { + aggListStatus = make(map[string]agonesv1.AggregatedListStatus) + } + + for key, val := range listStatus { + // If the List exists in both maps, aggregate the values. + // TODO: Will this cause issues with install/helm/agones/templates/crds/gameserverset.yaml because in + // the CRD we define a maximum capacity and maximum number of values as 1000? (Also a possible + // issue with there being a max of 1000 Lists in a GameServerSet per the CRD?) + if list, ok := aggListStatus[key]; ok { + list.Capacity += val.Capacity + // We do not remove duplicates here. + list.Values = append(list.Values, val.Values...) + aggListStatus[key] = list + } else { + aggListStatus[key] = agonesv1.AggregatedListStatus(*val.DeepCopy()) + } + } + + return aggListStatus +} diff --git a/pkg/gameserversets/controller_test.go b/pkg/gameserversets/controller_test.go index ab14ef2f72..87a3d4fd8e 100644 --- a/pkg/gameserversets/controller_test.go +++ b/pkg/gameserversets/controller_test.go @@ -335,6 +335,102 @@ func TestComputeStatus(t *testing.T) { assert.Equal(t, expected, computeStatus(list)) }) + + t.Run("counters", func(t *testing.T) { + utilruntime.FeatureTestMutex.Lock() + defer utilruntime.FeatureTestMutex.Unlock() + + require.NoError(t, utilruntime.ParseFeatures(string(utilruntime.FeatureCountsAndLists)+"=true")) + + var list []*agonesv1.GameServer + gs1 := gsWithState(agonesv1.GameServerStateAllocated) + gs1.Status.Counters = map[string]agonesv1.CounterStatus{ + "firstCounter": {Count: 5, Capacity: 10}, + "secondCounter": {Count: 100, Capacity: 1000}, + } + gs2 := gsWithState(agonesv1.GameServerStateReserved) + gs2.Status.Counters = map[string]agonesv1.CounterStatus{ + "firstCounter": {Count: 10, Capacity: 15}, + } + gs3 := gsWithState(agonesv1.GameServerStateCreating) + gs3.Status.Counters = map[string]agonesv1.CounterStatus{ + "firstCounter": {Count: 20, Capacity: 30}, + "secondCounter": {Count: 100, Capacity: 1000}, + } + gs4 := gsWithState(agonesv1.GameServerStateReady) + gs4.Status.Counters = map[string]agonesv1.CounterStatus{ + "firstCounter": {Count: 15, Capacity: 30}, + } + list = append(list, gs1, gs2, gs3, gs4) + + expected := agonesv1.GameServerSetStatus{ + Replicas: 4, + ReadyReplicas: 1, + ReservedReplicas: 1, + AllocatedReplicas: 1, + Counters: map[string]agonesv1.AggregatedCounterStatus{ + "firstCounter": { + Count: 50, + Capacity: 85, + }, + "secondCounter": { + Count: 200, + Capacity: 2000, + }, + }, + Lists: map[string]agonesv1.AggregatedListStatus{}, + } + + assert.Equal(t, expected, computeStatus(list)) + }) + + t.Run("lists", func(t *testing.T) { + utilruntime.FeatureTestMutex.Lock() + defer utilruntime.FeatureTestMutex.Unlock() + + require.NoError(t, utilruntime.ParseFeatures(string(utilruntime.FeatureCountsAndLists)+"=true")) + + var list []*agonesv1.GameServer + gs1 := gsWithState(agonesv1.GameServerStateAllocated) + gs1.Status.Lists = map[string]agonesv1.ListStatus{ + "firstList": {Capacity: 10, Values: []string{"a", "b"}}, + "secondList": {Capacity: 1000, Values: []string{"1", "2"}}, + } + gs2 := gsWithState(agonesv1.GameServerStateReserved) + gs2.Status.Lists = map[string]agonesv1.ListStatus{ + "firstList": {Capacity: 15, Values: []string{"c"}}, + } + gs3 := gsWithState(agonesv1.GameServerStateCreating) + gs3.Status.Lists = map[string]agonesv1.ListStatus{ + "firstList": {Capacity: 30, Values: []string{"d"}}, + "secondList": {Capacity: 1000, Values: []string{"3"}}, + } + gs4 := gsWithState(agonesv1.GameServerStateReady) + gs4.Status.Lists = map[string]agonesv1.ListStatus{ + "firstList": {Capacity: 30}, + } + list = append(list, gs1, gs2, gs3, gs4) + + expected := agonesv1.GameServerSetStatus{ + Replicas: 4, + ReadyReplicas: 1, + ReservedReplicas: 1, + AllocatedReplicas: 1, + Counters: map[string]agonesv1.AggregatedCounterStatus{}, + Lists: map[string]agonesv1.AggregatedListStatus{ + "firstList": { + Capacity: 85, + Values: []string{"a", "b", "c", "d"}, + }, + "secondList": { + Capacity: 2000, + Values: []string{"1", "2", "3"}, + }, + }, + } + + assert.Equal(t, expected, computeStatus(list)) + }) } func TestControllerWatchGameServers(t *testing.T) { From 4b969ea91ec647257faefca8b586075f1e403a7c Mon Sep 17 00:00:00 2001 From: Ivy Gooch Date: Thu, 25 May 2023 17:17:37 +0000 Subject: [PATCH 2/6] Updates GameServerSet to only aggregate Counters and Lists on GameServer States Allocated, Ready, or Reserved --- pkg/fleets/controller.go | 3 --- pkg/gameserversets/controller.go | 12 +++++------- pkg/gameserversets/controller_test.go | 22 ++++++++++++---------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/pkg/fleets/controller.go b/pkg/fleets/controller.go index 78d8ba4637..a88925c281 100644 --- a/pkg/fleets/controller.go +++ b/pkg/fleets/controller.go @@ -730,9 +730,6 @@ func mergeLists(l1, l2 map[string]agonesv1.AggregatedListStatus) map[string]agon for key, val := range l2 { // If the List exists in both maps, aggregate the values. - // TODO: Will this cause issues with install/helm/agones/templates/crds/fleet.yaml because in - // the CRD we define a maximum capacity and maximum number of values as 1000? (Also a possible - // issue with there being a max of 1000 Lists in a Fleet per the CRD?) So far it passes unit tests... if list, ok := l1[key]; ok { list.Capacity += val.Capacity // We do not remove duplicates here. diff --git a/pkg/gameserversets/controller.go b/pkg/gameserversets/controller.go index ab6aed73b8..99a392a8a4 100644 --- a/pkg/gameserversets/controller.go +++ b/pkg/gameserversets/controller.go @@ -620,10 +620,11 @@ func computeStatus(list []*agonesv1.GameServer) agonesv1.GameServerSetStatus { status.ReservedReplicas++ } - // TODO: Aggregates all Counters and Lists for all GameServer States that are not Deleting. This - // means that unlike player tracking below, this will aggregate values during GameServerStateCreating. - // Should I mimic player tracking below and only aggregate for cases Ready, Reserved, and Allocated? - if runtime.FeatureEnabled(runtime.FeatureCountsAndLists) { + // Aggregates all Counters and Lists only for GameServer states Ready, Reserved, or Allocated. + if runtime.FeatureEnabled(runtime.FeatureCountsAndLists) && + (gs.Status.State == agonesv1.GameServerStateReady || + gs.Status.State == agonesv1.GameServerStateAllocated || + gs.Status.State == agonesv1.GameServerStateReserved) { status.Counters = aggregateCounters(status.Counters, gs.Status.Counters) status.Lists = aggregateLists(status.Lists, gs.Status.Lists) } @@ -678,9 +679,6 @@ func aggregateLists(aggListStatus map[string]agonesv1.AggregatedListStatus, list for key, val := range listStatus { // If the List exists in both maps, aggregate the values. - // TODO: Will this cause issues with install/helm/agones/templates/crds/gameserverset.yaml because in - // the CRD we define a maximum capacity and maximum number of values as 1000? (Also a possible - // issue with there being a max of 1000 Lists in a GameServerSet per the CRD?) if list, ok := aggListStatus[key]; ok { list.Capacity += val.Capacity // We do not remove duplicates here. diff --git a/pkg/gameserversets/controller_test.go b/pkg/gameserversets/controller_test.go index 87a3d4fd8e..f2fda95b5a 100644 --- a/pkg/gameserversets/controller_test.go +++ b/pkg/gameserversets/controller_test.go @@ -359,7 +359,8 @@ func TestComputeStatus(t *testing.T) { } gs4 := gsWithState(agonesv1.GameServerStateReady) gs4.Status.Counters = map[string]agonesv1.CounterStatus{ - "firstCounter": {Count: 15, Capacity: 30}, + "firstCounter": {Count: 15, Capacity: 30}, + "secondCounter": {Count: 20, Capacity: 200}, } list = append(list, gs1, gs2, gs3, gs4) @@ -370,12 +371,12 @@ func TestComputeStatus(t *testing.T) { AllocatedReplicas: 1, Counters: map[string]agonesv1.AggregatedCounterStatus{ "firstCounter": { - Count: 50, - Capacity: 85, + Count: 30, + Capacity: 55, }, "secondCounter": { - Count: 200, - Capacity: 2000, + Count: 120, + Capacity: 1200, }, }, Lists: map[string]agonesv1.AggregatedListStatus{}, @@ -407,7 +408,8 @@ func TestComputeStatus(t *testing.T) { } gs4 := gsWithState(agonesv1.GameServerStateReady) gs4.Status.Lists = map[string]agonesv1.ListStatus{ - "firstList": {Capacity: 30}, + "firstList": {Capacity: 30}, + "secondList": {Capacity: 100, Values: []string{"4"}}, } list = append(list, gs1, gs2, gs3, gs4) @@ -419,12 +421,12 @@ func TestComputeStatus(t *testing.T) { Counters: map[string]agonesv1.AggregatedCounterStatus{}, Lists: map[string]agonesv1.AggregatedListStatus{ "firstList": { - Capacity: 85, - Values: []string{"a", "b", "c", "d"}, + Capacity: 55, + Values: []string{"a", "b", "c"}, }, "secondList": { - Capacity: 2000, - Values: []string{"1", "2", "3"}, + Capacity: 1100, + Values: []string{"1", "2", "4"}, }, }, } From 58e990823461331aed6c08ba0a6c6b1092992404 Mon Sep 17 00:00:00 2001 From: Ivy Gooch Date: Fri, 26 May 2023 18:28:29 +0000 Subject: [PATCH 3/6] Update GameServerSet and Fleet to aggregate list values Follows fleet.yaml example in github issue #2716 status: # ... usual fleet status values counters: # aggregate counter values rooms: total: 43 # total of count values for key rooms capacity: 100 # total capacity count in all GameServers across the fleet rooms key lists: # aggregate list values players: count: 58 # total number of list items in all GameServers across the Fleet under player key capacity: 200 # total capacity count in all GameServers across the Fleet player key frogs: count: 12 capacity: 88 --- .../agones/templates/crds/gameserverset.yaml | 20 +- pkg/apis/agones/v1/common.go | 4 +- pkg/fleets/controller.go | 7 +- pkg/fleets/controller_test.go | 242 +++++++++++------- pkg/gameserversets/controller.go | 10 +- pkg/gameserversets/controller_test.go | 6 +- 6 files changed, 172 insertions(+), 117 deletions(-) diff --git a/install/helm/agones/templates/crds/gameserverset.yaml b/install/helm/agones/templates/crds/gameserverset.yaml index 78b242cd08..c473be35ea 100644 --- a/install/helm/agones/templates/crds/gameserverset.yaml +++ b/install/helm/agones/templates/crds/gameserverset.yaml @@ -131,13 +131,12 @@ spec: additionalProperties: type: object properties: - count: # initial count + count: # Aggregated count of the Counter across the GameServerSet type: integer default: 0 minimum: 0 - capacity: # max capacity of the counter + capacity: # Aggregated maximum capacity of the Counter across the GameServerSet type: integer - default: 1000 minimum: 0 lists: type: object @@ -147,18 +146,13 @@ spec: additionalProperties: type: object properties: - capacity: # max capacity of the array (can be less than or equal to value of maxItems) + capacity: # Aggregated maximum capacity of the List across the GameServerSet type: integer minimum: 0 - default: 1000 - maximum: 1000 # must be equal to values.maxItems - values: - type: array - x-kubernetes-list-type: set # Requires items in the array to be unique - maxItems: 1000 # max possible size of the value array (cannot be updated) - items: # name of the item (player1, session1, room1, etc.) - type: string - default: [] + count: # Aggregated number of items in the List across the GameServerSet + type: integer + minimum: 0 + default: 0 subresources: # status enables the status subresource. status: { } diff --git a/pkg/apis/agones/v1/common.go b/pkg/apis/agones/v1/common.go index 91cdddbf67..8fb4d69d87 100644 --- a/pkg/apis/agones/v1/common.go +++ b/pkg/apis/agones/v1/common.go @@ -54,8 +54,8 @@ type AggregatedCounterStatus struct { // AggregatedListStatus stores total List tracking values type AggregatedListStatus struct { - Capacity int64 `json:"capacity"` - Values []string `json:"values"` + Count int64 `json:"count"` + Capacity int64 `json:"capacity"` } // crd is an interface to get Name and Kind of CRD diff --git a/pkg/fleets/controller.go b/pkg/fleets/controller.go index a88925c281..a97988e4e8 100644 --- a/pkg/fleets/controller.go +++ b/pkg/fleets/controller.go @@ -702,7 +702,7 @@ func (c *Controller) filterGameServerSetByActive(fleet *agonesv1.Fleet, list []* return active, rest } -// mergeCounters adds the contents of c2 into c1. +// mergeCounters adds the contents of AggregatedCounterStatus c2 into c1. func mergeCounters(c1, c2 map[string]agonesv1.AggregatedCounterStatus) map[string]agonesv1.AggregatedCounterStatus { if c1 == nil { c1 = make(map[string]agonesv1.AggregatedCounterStatus) @@ -722,7 +722,7 @@ func mergeCounters(c1, c2 map[string]agonesv1.AggregatedCounterStatus) map[strin return c1 } -// mergeLists adds the contents of l2 into l1. +// mergeLists adds the contents of AggregatedListStatus l2 into l1. func mergeLists(l1, l2 map[string]agonesv1.AggregatedListStatus) map[string]agonesv1.AggregatedListStatus { if l1 == nil { l1 = make(map[string]agonesv1.AggregatedListStatus) @@ -732,8 +732,7 @@ func mergeLists(l1, l2 map[string]agonesv1.AggregatedListStatus) map[string]agon // If the List exists in both maps, aggregate the values. if list, ok := l1[key]; ok { list.Capacity += val.Capacity - // We do not remove duplicates here. - list.Values = append(list.Values, val.Values...) + list.Count += val.Count l1[key] = list } else { l1[key] = *val.DeepCopy() diff --git a/pkg/fleets/controller_test.go b/pkg/fleets/controller_test.go index 2c87519cfe..daf84496a5 100644 --- a/pkg/fleets/controller_test.go +++ b/pkg/fleets/controller_test.go @@ -18,6 +18,7 @@ package fleets import ( "context" "encoding/json" + "fmt" "net/http" "testing" "time" @@ -685,126 +686,183 @@ func TestControllerUpdateFleetPlayerStatus(t *testing.T) { assert.True(t, updated) } +// nolint Errors on duplicate code to TestControllerUpdateFleetListStatus func TestControllerUpdateFleetCounterStatus(t *testing.T) { t.Parallel() - utilruntime.FeatureTestMutex.Lock() - defer utilruntime.FeatureTestMutex.Unlock() + testCases := map[string]struct { + feature string + gsSet1StatusCounters map[string]agonesv1.AggregatedCounterStatus + gsSet2StatusCounters map[string]agonesv1.AggregatedCounterStatus + want map[string]agonesv1.AggregatedCounterStatus + }{ + "Full Counter": { + feature: fmt.Sprintf("%s=true", utilruntime.FeatureCountsAndLists), + gsSet1StatusCounters: map[string]agonesv1.AggregatedCounterStatus{ + "fullCounter": { + Capacity: 100, + Count: 100, + }, + }, + gsSet2StatusCounters: map[string]agonesv1.AggregatedCounterStatus{ + "fullCounter": { + Capacity: 10, + Count: 10, + }, + }, + want: map[string]agonesv1.AggregatedCounterStatus{ + "fullCounter": { + Capacity: 110, + Count: 110, + }, + }, + }, + "One Counter": { + feature: fmt.Sprintf("%s=true", utilruntime.FeatureCountsAndLists), + gsSet2StatusCounters: map[string]agonesv1.AggregatedCounterStatus{ + "oneCounter": { + Capacity: 100, + Count: 1, + }, + }, + want: map[string]agonesv1.AggregatedCounterStatus{ + "oneCounter": { + Capacity: 100, + Count: 1, + }, + }, + }, + } - require.NoError(t, utilruntime.ParseFeatures(string(utilruntime.FeatureCountsAndLists)+"=true")) + for name, tc := range testCases { + t.Run(name, func(t *testing.T) { + err := utilruntime.ParseFeatures(tc.feature) + assert.NoError(t, err) - fleet := defaultFixture() - c, m := newFakeController() + fleet := defaultFixture() - gsSet1 := fleet.GameServerSet() - gsSet1.ObjectMeta.Name = "gsSet1" - gsSet1.Status.Counters = map[string]agonesv1.AggregatedCounterStatus{ - "fullCounter": { - Capacity: 1000, - Count: 1000, - }, - } + gsSet1 := fleet.GameServerSet() + gsSet1.ObjectMeta.Name = "gsSet1" + gsSet1.Status.Counters = tc.gsSet1StatusCounters - gsSet2 := fleet.GameServerSet() - gsSet2.ObjectMeta.Name = "gsSet2" - gsSet2.Status.Counters = map[string]agonesv1.AggregatedCounterStatus{ - "fullCounter": { - Capacity: 1000, - Count: 1000, - }, - "anotherCounter": { - Capacity: 10, - Count: 0, - }, - } + gsSet2 := fleet.GameServerSet() + gsSet2.ObjectMeta.Name = "gsSet2" + gsSet2.Status.Counters = tc.gsSet2StatusCounters - m.AgonesClient.AddReactor("list", "gameserversets", - func(action k8stesting.Action) (bool, runtime.Object, error) { - return true, &agonesv1.GameServerSetList{Items: []agonesv1.GameServerSet{*gsSet1, *gsSet2}}, nil - }) + c, m := newFakeController() - updated := false - m.AgonesClient.AddReactor("update", "fleets", - func(action k8stesting.Action) (bool, runtime.Object, error) { - updated = true - ua := action.(k8stesting.UpdateAction) - fleet := ua.GetObject().(*agonesv1.Fleet) + m.AgonesClient.AddReactor("list", "gameserversets", + func(action k8stesting.Action) (bool, runtime.Object, error) { + return true, &agonesv1.GameServerSetList{Items: []agonesv1.GameServerSet{*gsSet1, *gsSet2}}, nil + }) - assert.Equal(t, int64(2000), fleet.Status.Counters["fullCounter"].Capacity) - assert.Equal(t, int64(2000), fleet.Status.Counters["fullCounter"].Count) - assert.Equal(t, int64(10), fleet.Status.Counters["anotherCounter"].Capacity) - assert.Equal(t, int64(0), fleet.Status.Counters["anotherCounter"].Count) + updated := false - return true, fleet, nil - }) + m.AgonesClient.AddReactor("update", "fleets", + func(action k8stesting.Action) (bool, runtime.Object, error) { + updated = true + ua := action.(k8stesting.UpdateAction) + fleet := ua.GetObject().(*agonesv1.Fleet) - ctx, cancel := agtesting.StartInformers(m, c.fleetSynced, c.gameServerSetSynced) - defer cancel() + assert.Equal(t, tc.want, fleet.Status.Counters) - err := c.updateFleetStatus(ctx, fleet) - assert.Nil(t, err) - assert.True(t, updated) + return true, fleet, nil + }) + + ctx, cancel := agtesting.StartInformers(m, c.fleetSynced, c.gameServerSetSynced) + defer cancel() + + err = c.updateFleetStatus(ctx, fleet) + assert.Nil(t, err) + assert.True(t, updated) + }) + } } +// nolint Errors on duplicate code to TestControllerUpdateFleetCounterStatus func TestControllerUpdateFleetListStatus(t *testing.T) { t.Parallel() - utilruntime.FeatureTestMutex.Lock() - defer utilruntime.FeatureTestMutex.Unlock() + testCases := map[string]struct { + feature string + gsSet1StatusLists map[string]agonesv1.AggregatedListStatus + gsSet2StatusLists map[string]agonesv1.AggregatedListStatus + want map[string]agonesv1.AggregatedListStatus + }{ + "Full List": { + feature: fmt.Sprintf("%s=true", utilruntime.FeatureCountsAndLists), + gsSet1StatusLists: map[string]agonesv1.AggregatedListStatus{ + "fullList": { + Capacity: 1000, + Count: 1000, + }, + }, + gsSet2StatusLists: map[string]agonesv1.AggregatedListStatus{ + "fullList": { + Capacity: 2000, + Count: 2000, + }, + "anotherList": { + Capacity: 10, + Count: 1, + }, + }, + want: map[string]agonesv1.AggregatedListStatus{ + "fullList": { + Capacity: 3000, + Count: 3000, + }, + "anotherList": { + Capacity: 10, + Count: 1, + }, + }, + }, + } - require.NoError(t, utilruntime.ParseFeatures(string(utilruntime.FeatureCountsAndLists)+"=true")) + for name, tc := range testCases { + t.Run(name, func(t *testing.T) { + err := utilruntime.ParseFeatures(tc.feature) + assert.NoError(t, err) - fleet := defaultFixture() - c, m := newFakeController() + fleet := defaultFixture() - gsSet1 := fleet.GameServerSet() - gsSet1.ObjectMeta.Name = "gsSet1" - gsSet1.Status.Lists = map[string]agonesv1.AggregatedListStatus{ - "fullList": { - Capacity: 1000, - Values: []string{"ab", "ba", "ac", "ca", "ad", "da", "ae", "ea", "af", "fa", "ag", "ga", "ah", "ha", "ai", "ia", "aj", "ja", "ak", "ka", "al", "la", "am", "ma", "an", "na", "ao", "oa", "ap", "pa", "aq", "qa", "ar", "ra", "as", "sa", "at", "ta", "au", "ua", "av", "va", "aw", "wa", "ax", "xa", "ay", "ya", "az", "za", "aA", "Aa", "aB", "Ba", "aC", "Ca", "aD", "Da", "aE", "Ea", "aF", "Fa", "aG", "Ga", "aH", "Ha", "aI", "Ia", "aJ", "Ja", "aK", "Ka", "aL", "La", "aM", "Ma", "aN", "Na", "aO", "Oa", "aP", "Pa", "aQ", "Qa", "aR", "Ra", "aS", "Sa", "aT", "Ta", "aU", "Ua", "aV", "Va", "aW", "Wa", "aX", "Xa", "aY", "Ya", "aZ", "Za", "a0", "0a", "a1", "1a", "a2", "2a", "a3", "3a", "a4", "4a", "a5", "5a", "a6", "6a", "a7", "7a", "a8", "8a", "a9", "9a", "bc", "cb", "bd", "db", "be", "eb", "bf", "fb", "bg", "gb", "bh", "hb", "bi", "ib", "bj", "jb", "bk", "kb", "bl", "lb", "bm", "mb", "bn", "nb", "bo", "ob", "bp", "pb", "bq", "qb", "br", "rb", "bs", "sb", "bt", "tb", "bu", "ub", "bv", "vb", "bw", "wb", "bx", "xb", "by", "yb", "bz", "zb", "bA", "Ab", "bB", "Bb", "bC", "Cb", "bD", "Db", "bE", "Eb", "bF", "Fb", "bG", "Gb", "bH", "Hb", "bI", "Ib", "bJ", "Jb", "bK", "Kb", "bL", "Lb", "bM", "Mb", "bN", "Nb", "bO", "Ob", "bP", "Pb", "bQ", "Qb", "bR", "Rb", "bS", "Sb", "bT", "Tb", "bU", "Ub", "bV", "Vb", "bW", "Wb", "bX", "Xb", "bY", "Yb", "bZ", "Zb", "b0", "0b", "b1", "1b", "b2", "2b", "b3", "3b", "b4", "4b", "b5", "5b", "b6", "6b", "b7", "7b", "b8", "8b", "b9", "9b", "cd", "dc", "ce", "ec", "cf", "fc", "cg", "gc", "ch", "hc", "ci", "ic", "cj", "jc", "ck", "kc", "cl", "lc", "cm", "mc", "cn", "nc", "co", "oc", "cp", "pc", "cq", "qc", "cr", "rc", "cs", "sc", "ct", "tc", "cu", "uc", "cv", "vc", "cw", "wc", "cx", "xc", "cy", "yc", "cz", "zc", "cA", "Ac", "cB", "Bc", "cC", "Cc", "cD", "Dc", "cE", "Ec", "cF", "Fc", "cG", "Gc", "cH", "Hc", "cI", "Ic", "cJ", "Jc", "cK", "Kc", "cL", "Lc", "cM", "Mc", "cN", "Nc", "cO", "Oc", "cP", "Pc", "cQ", "Qc", "cR", "Rc", "cS", "Sc", "cT", "Tc", "cU", "Uc", "cV", "Vc", "cW", "Wc", "cX", "Xc", "cY", "Yc", "cZ", "Zc", "c0", "0c", "c1", "1c", "c2", "2c", "c3", "3c", "c4", "4c", "c5", "5c", "c6", "6c", "c7", "7c", "c8", "8c", "c9", "9c", "de", "ed", "df", "fd", "dg", "gd", "dh", "hd", "di", "id", "dj", "jd", "dk", "kd", "dl", "ld", "dm", "md", "dn", "nd", "do", "od", "dp", "pd", "dq", "qd", "dr", "rd", "ds", "sd", "dt", "td", "du", "ud", "dv", "vd", "dw", "wd", "dx", "xd", "dy", "yd", "dz", "zd", "dA", "Ad", "dB", "Bd", "dC", "Cd", "dD", "Dd", "dE", "Ed", "dF", "Fd", "dG", "Gd", "dH", "Hd", "dI", "Id", "dJ", "Jd", "dK", "Kd", "dL", "Ld", "dM", "Md", "dN", "Nd", "dO", "Od", "dP", "Pd", "dQ", "Qd", "dR", "Rd", "dS", "Sd", "dT", "Td", "dU", "Ud", "dV", "Vd", "dW", "Wd", "dX", "Xd", "dY", "Yd", "dZ", "Zd", "d0", "0d", "d1", "1d", "d2", "2d", "d3", "3d", "d4", "4d", "d5", "5d", "d6", "6d", "d7", "7d", "d8", "8d", "d9", "9d", "ef", "fe", "eg", "ge", "eh", "he", "ei", "ie", "ej", "je", "ek", "ke", "el", "le", "em", "me", "en", "ne", "eo", "oe", "ep", "pe", "eq", "qe", "er", "re", "es", "se", "et", "te", "eu", "ue", "ev", "ve", "ew", "we", "ex", "xe", "ey", "ye", "ez", "ze", "eA", "Ae", "eB", "Be", "eC", "Ce", "eD", "De", "eE", "Ee", "eF", "Fe", "eG", "Ge", "eH", "He", "eI", "Ie", "eJ", "Je", "eK", "Ke", "eL", "Le", "eM", "Me", "eN", "Ne", "eO", "Oe", "eP", "Pe", "eQ", "Qe", "eR", "Re", "eS", "Se", "eT", "Te", "eU", "Ue", "eV", "Ve", "eW", "We", "eX", "Xe", "eY", "Ye", "eZ", "Ze", "e0", "0e", "e1", "1e", "e2", "2e", "e3", "3e", "e4", "4e", "e5", "5e", "e6", "6e", "e7", "7e", "e8", "8e", "e9", "9e", "fg", "gf", "fh", "hf", "fi", "if", "fj", "jf", "fk", "kf", "fl", "lf", "fm", "mf", "fn", "nf", "fo", "of", "fp", "pf", "fq", "qf", "fr", "rf", "fs", "sf", "ft", "tf", "fu", "uf", "fv", "vf", "fw", "wf", "fx", "xf", "fy", "yf", "fz", "zf", "fA", "Af", "fB", "Bf", "fC", "Cf", "fD", "Df", "fE", "Ef", "fF", "Ff", "fG", "Gf", "fH", "Hf", "fI", "If", "fJ", "Jf", "fK", "Kf", "fL", "Lf", "fM", "Mf", "fN", "Nf", "fO", "Of", "fP", "Pf", "fQ", "Qf", "fR", "Rf", "fS", "Sf", "fT", "Tf", "fU", "Uf", "fV", "Vf", "fW", "Wf", "fX", "Xf", "fY", "Yf", "fZ", "Zf", "f0", "0f", "f1", "1f", "f2", "2f", "f3", "3f", "f4", "4f", "f5", "5f", "f6", "6f", "f7", "7f", "f8", "8f", "f9", "9f", "gh", "hg", "gi", "ig", "gj", "jg", "gk", "kg", "gl", "lg", "gm", "mg", "gn", "ng", "go", "og", "gp", "pg", "gq", "qg", "gr", "rg", "gs", "sg", "gt", "tg", "gu", "ug", "gv", "vg", "gw", "wg", "gx", "xg", "gy", "yg", "gz", "zg", "gA", "Ag", "gB", "Bg", "gC", "Cg", "gD", "Dg", "gE", "Eg", "gF", "Fg", "gG", "Gg", "gH", "Hg", "gI", "Ig", "gJ", "Jg", "gK", "Kg", "gL", "Lg", "gM", "Mg", "gN", "Ng", "gO", "Og", "gP", "Pg", "gQ", "Qg", "gR", "Rg", "gS", "Sg", "gT", "Tg", "gU", "Ug", "gV", "Vg", "gW", "Wg", "gX", "Xg", "gY", "Yg", "gZ", "Zg", "g0", "0g", "g1", "1g", "g2", "2g", "g3", "3g", "g4", "4g", "g5", "5g", "g6", "6g", "g7", "7g", "g8", "8g", "g9", "9g", "hi", "ih", "hj", "jh", "hk", "kh", "hl", "lh", "hm", "mh", "hn", "nh", "ho", "oh", "hp", "ph", "hq", "qh", "hr", "rh", "hs", "sh", "ht", "th", "hu", "uh", "hv", "vh", "hw", "wh", "hx", "xh", "hy", "yh", "hz", "zh", "hA", "Ah", "hB", "Bh", "hC", "Ch", "hD", "Dh", "hE", "Eh", "hF", "Fh", "hG", "Gh", "hH", "Hh", "hI", "Ih", "hJ", "Jh", "hK", "Kh", "hL", "Lh", "hM", "Mh", "hN", "Nh", "hO", "Oh", "hP", "Ph", "hQ", "Qh", "hR", "Rh", "hS", "Sh", "hT", "Th", "hU", "Uh", "hV", "Vh", "hW", "Wh", "hX", "Xh", "hY", "Yh", "hZ", "Zh", "h0", "0h", "h1", "1h", "h2", "2h", "h3", "3h", "h4", "4h", "h5", "5h", "h6", "6h", "h7", "7h", "h8", "8h", "h9", "9h", "ij", "ji", "ik", "ki", "il", "li", "im", "mi", "in", "ni", "io", "oi", "ip", "pi", "iq", "qi", "ir", "ri", "is", "si", "it", "ti", "iu", "ui", "iv", "vi", "iw", "wi", "ix", "xi", "iy", "yi", "iz", "zi", "iA", "Ai", "iB", "Bi", "iC", "Ci", "iD", "Di", "iE", "Ei", "iF", "Fi", "iG", "Gi", "iH", "Hi", "iI", "Ii", "iJ", "Ji", "iK", "Ki", "iL", "Li", "iM", "Mi", "iN", "Ni", "iO", "Oi", "iP", "Pi", "iQ", "Qi", "iR", "Ri", "iS", "Si", "iT", "Ti", "iU", "Ui", "iV", "Vi", "iW", "Wi"}, - }, - } + gsSet1 := fleet.GameServerSet() + gsSet1.ObjectMeta.Name = "gsSet1" + gsSet1.Status.Lists = tc.gsSet1StatusLists - gsSet2 := fleet.GameServerSet() - gsSet2.ObjectMeta.Name = "gsSet2" - gsSet2.Status.Lists = map[string]agonesv1.AggregatedListStatus{ - "fullList": { - Capacity: 1000, - Values: []string{"abc"}, - }, - "anotherList": { - Capacity: 10, - Values: []string{"123"}, - }, - } + gsSet2 := fleet.GameServerSet() + gsSet2.ObjectMeta.Name = "gsSet2" + gsSet2.Status.Lists = tc.gsSet2StatusLists - m.AgonesClient.AddReactor("list", "gameserversets", - func(action k8stesting.Action) (bool, runtime.Object, error) { - return true, &agonesv1.GameServerSetList{Items: []agonesv1.GameServerSet{*gsSet1, *gsSet2}}, nil - }) + c, m := newFakeController() - updated := false - m.AgonesClient.AddReactor("update", "fleets", - func(action k8stesting.Action) (bool, runtime.Object, error) { - updated = true - ua := action.(k8stesting.UpdateAction) - fleet := ua.GetObject().(*agonesv1.Fleet) + m.AgonesClient.AddReactor("list", "gameserversets", + func(action k8stesting.Action) (bool, runtime.Object, error) { + return true, &agonesv1.GameServerSetList{Items: []agonesv1.GameServerSet{*gsSet1, *gsSet2}}, nil + }) - assert.Equal(t, int64(2000), fleet.Status.Lists["fullList"].Capacity) - assert.Equal(t, []string{"ab", "ba", "ac", "ca", "ad", "da", "ae", "ea", "af", "fa", "ag", "ga", "ah", "ha", "ai", "ia", "aj", "ja", "ak", "ka", "al", "la", "am", "ma", "an", "na", "ao", "oa", "ap", "pa", "aq", "qa", "ar", "ra", "as", "sa", "at", "ta", "au", "ua", "av", "va", "aw", "wa", "ax", "xa", "ay", "ya", "az", "za", "aA", "Aa", "aB", "Ba", "aC", "Ca", "aD", "Da", "aE", "Ea", "aF", "Fa", "aG", "Ga", "aH", "Ha", "aI", "Ia", "aJ", "Ja", "aK", "Ka", "aL", "La", "aM", "Ma", "aN", "Na", "aO", "Oa", "aP", "Pa", "aQ", "Qa", "aR", "Ra", "aS", "Sa", "aT", "Ta", "aU", "Ua", "aV", "Va", "aW", "Wa", "aX", "Xa", "aY", "Ya", "aZ", "Za", "a0", "0a", "a1", "1a", "a2", "2a", "a3", "3a", "a4", "4a", "a5", "5a", "a6", "6a", "a7", "7a", "a8", "8a", "a9", "9a", "bc", "cb", "bd", "db", "be", "eb", "bf", "fb", "bg", "gb", "bh", "hb", "bi", "ib", "bj", "jb", "bk", "kb", "bl", "lb", "bm", "mb", "bn", "nb", "bo", "ob", "bp", "pb", "bq", "qb", "br", "rb", "bs", "sb", "bt", "tb", "bu", "ub", "bv", "vb", "bw", "wb", "bx", "xb", "by", "yb", "bz", "zb", "bA", "Ab", "bB", "Bb", "bC", "Cb", "bD", "Db", "bE", "Eb", "bF", "Fb", "bG", "Gb", "bH", "Hb", "bI", "Ib", "bJ", "Jb", "bK", "Kb", "bL", "Lb", "bM", "Mb", "bN", "Nb", "bO", "Ob", "bP", "Pb", "bQ", "Qb", "bR", "Rb", "bS", "Sb", "bT", "Tb", "bU", "Ub", "bV", "Vb", "bW", "Wb", "bX", "Xb", "bY", "Yb", "bZ", "Zb", "b0", "0b", "b1", "1b", "b2", "2b", "b3", "3b", "b4", "4b", "b5", "5b", "b6", "6b", "b7", "7b", "b8", "8b", "b9", "9b", "cd", "dc", "ce", "ec", "cf", "fc", "cg", "gc", "ch", "hc", "ci", "ic", "cj", "jc", "ck", "kc", "cl", "lc", "cm", "mc", "cn", "nc", "co", "oc", "cp", "pc", "cq", "qc", "cr", "rc", "cs", "sc", "ct", "tc", "cu", "uc", "cv", "vc", "cw", "wc", "cx", "xc", "cy", "yc", "cz", "zc", "cA", "Ac", "cB", "Bc", "cC", "Cc", "cD", "Dc", "cE", "Ec", "cF", "Fc", "cG", "Gc", "cH", "Hc", "cI", "Ic", "cJ", "Jc", "cK", "Kc", "cL", "Lc", "cM", "Mc", "cN", "Nc", "cO", "Oc", "cP", "Pc", "cQ", "Qc", "cR", "Rc", "cS", "Sc", "cT", "Tc", "cU", "Uc", "cV", "Vc", "cW", "Wc", "cX", "Xc", "cY", "Yc", "cZ", "Zc", "c0", "0c", "c1", "1c", "c2", "2c", "c3", "3c", "c4", "4c", "c5", "5c", "c6", "6c", "c7", "7c", "c8", "8c", "c9", "9c", "de", "ed", "df", "fd", "dg", "gd", "dh", "hd", "di", "id", "dj", "jd", "dk", "kd", "dl", "ld", "dm", "md", "dn", "nd", "do", "od", "dp", "pd", "dq", "qd", "dr", "rd", "ds", "sd", "dt", "td", "du", "ud", "dv", "vd", "dw", "wd", "dx", "xd", "dy", "yd", "dz", "zd", "dA", "Ad", "dB", "Bd", "dC", "Cd", "dD", "Dd", "dE", "Ed", "dF", "Fd", "dG", "Gd", "dH", "Hd", "dI", "Id", "dJ", "Jd", "dK", "Kd", "dL", "Ld", "dM", "Md", "dN", "Nd", "dO", "Od", "dP", "Pd", "dQ", "Qd", "dR", "Rd", "dS", "Sd", "dT", "Td", "dU", "Ud", "dV", "Vd", "dW", "Wd", "dX", "Xd", "dY", "Yd", "dZ", "Zd", "d0", "0d", "d1", "1d", "d2", "2d", "d3", "3d", "d4", "4d", "d5", "5d", "d6", "6d", "d7", "7d", "d8", "8d", "d9", "9d", "ef", "fe", "eg", "ge", "eh", "he", "ei", "ie", "ej", "je", "ek", "ke", "el", "le", "em", "me", "en", "ne", "eo", "oe", "ep", "pe", "eq", "qe", "er", "re", "es", "se", "et", "te", "eu", "ue", "ev", "ve", "ew", "we", "ex", "xe", "ey", "ye", "ez", "ze", "eA", "Ae", "eB", "Be", "eC", "Ce", "eD", "De", "eE", "Ee", "eF", "Fe", "eG", "Ge", "eH", "He", "eI", "Ie", "eJ", "Je", "eK", "Ke", "eL", "Le", "eM", "Me", "eN", "Ne", "eO", "Oe", "eP", "Pe", "eQ", "Qe", "eR", "Re", "eS", "Se", "eT", "Te", "eU", "Ue", "eV", "Ve", "eW", "We", "eX", "Xe", "eY", "Ye", "eZ", "Ze", "e0", "0e", "e1", "1e", "e2", "2e", "e3", "3e", "e4", "4e", "e5", "5e", "e6", "6e", "e7", "7e", "e8", "8e", "e9", "9e", "fg", "gf", "fh", "hf", "fi", "if", "fj", "jf", "fk", "kf", "fl", "lf", "fm", "mf", "fn", "nf", "fo", "of", "fp", "pf", "fq", "qf", "fr", "rf", "fs", "sf", "ft", "tf", "fu", "uf", "fv", "vf", "fw", "wf", "fx", "xf", "fy", "yf", "fz", "zf", "fA", "Af", "fB", "Bf", "fC", "Cf", "fD", "Df", "fE", "Ef", "fF", "Ff", "fG", "Gf", "fH", "Hf", "fI", "If", "fJ", "Jf", "fK", "Kf", "fL", "Lf", "fM", "Mf", "fN", "Nf", "fO", "Of", "fP", "Pf", "fQ", "Qf", "fR", "Rf", "fS", "Sf", "fT", "Tf", "fU", "Uf", "fV", "Vf", "fW", "Wf", "fX", "Xf", "fY", "Yf", "fZ", "Zf", "f0", "0f", "f1", "1f", "f2", "2f", "f3", "3f", "f4", "4f", "f5", "5f", "f6", "6f", "f7", "7f", "f8", "8f", "f9", "9f", "gh", "hg", "gi", "ig", "gj", "jg", "gk", "kg", "gl", "lg", "gm", "mg", "gn", "ng", "go", "og", "gp", "pg", "gq", "qg", "gr", "rg", "gs", "sg", "gt", "tg", "gu", "ug", "gv", "vg", "gw", "wg", "gx", "xg", "gy", "yg", "gz", "zg", "gA", "Ag", "gB", "Bg", "gC", "Cg", "gD", "Dg", "gE", "Eg", "gF", "Fg", "gG", "Gg", "gH", "Hg", "gI", "Ig", "gJ", "Jg", "gK", "Kg", "gL", "Lg", "gM", "Mg", "gN", "Ng", "gO", "Og", "gP", "Pg", "gQ", "Qg", "gR", "Rg", "gS", "Sg", "gT", "Tg", "gU", "Ug", "gV", "Vg", "gW", "Wg", "gX", "Xg", "gY", "Yg", "gZ", "Zg", "g0", "0g", "g1", "1g", "g2", "2g", "g3", "3g", "g4", "4g", "g5", "5g", "g6", "6g", "g7", "7g", "g8", "8g", "g9", "9g", "hi", "ih", "hj", "jh", "hk", "kh", "hl", "lh", "hm", "mh", "hn", "nh", "ho", "oh", "hp", "ph", "hq", "qh", "hr", "rh", "hs", "sh", "ht", "th", "hu", "uh", "hv", "vh", "hw", "wh", "hx", "xh", "hy", "yh", "hz", "zh", "hA", "Ah", "hB", "Bh", "hC", "Ch", "hD", "Dh", "hE", "Eh", "hF", "Fh", "hG", "Gh", "hH", "Hh", "hI", "Ih", "hJ", "Jh", "hK", "Kh", "hL", "Lh", "hM", "Mh", "hN", "Nh", "hO", "Oh", "hP", "Ph", "hQ", "Qh", "hR", "Rh", "hS", "Sh", "hT", "Th", "hU", "Uh", "hV", "Vh", "hW", "Wh", "hX", "Xh", "hY", "Yh", "hZ", "Zh", "h0", "0h", "h1", "1h", "h2", "2h", "h3", "3h", "h4", "4h", "h5", "5h", "h6", "6h", "h7", "7h", "h8", "8h", "h9", "9h", "ij", "ji", "ik", "ki", "il", "li", "im", "mi", "in", "ni", "io", "oi", "ip", "pi", "iq", "qi", "ir", "ri", "is", "si", "it", "ti", "iu", "ui", "iv", "vi", "iw", "wi", "ix", "xi", "iy", "yi", "iz", "zi", "iA", "Ai", "iB", "Bi", "iC", "Ci", "iD", "Di", "iE", "Ei", "iF", "Fi", "iG", "Gi", "iH", "Hi", "iI", "Ii", "iJ", "Ji", "iK", "Ki", "iL", "Li", "iM", "Mi", "iN", "Ni", "iO", "Oi", "iP", "Pi", "iQ", "Qi", "iR", "Ri", "iS", "Si", "iT", "Ti", "iU", "Ui", "iV", "Vi", "iW", "Wi", "abc"}, fleet.Status.Lists["fullList"].Values) - assert.Equal(t, int64(10), fleet.Status.Lists["anotherList"].Capacity) - assert.Equal(t, []string{"123"}, fleet.Status.Lists["anotherList"].Values) + updated := false - return true, fleet, nil - }) + m.AgonesClient.AddReactor("update", "fleets", + func(action k8stesting.Action) (bool, runtime.Object, error) { + updated = true + ua := action.(k8stesting.UpdateAction) + fleet := ua.GetObject().(*agonesv1.Fleet) - ctx, cancel := agtesting.StartInformers(m, c.fleetSynced, c.gameServerSetSynced) - defer cancel() + assert.Equal(t, tc.want, fleet.Status.Lists) - err := c.updateFleetStatus(ctx, fleet) - assert.Nil(t, err) - assert.True(t, updated) + return true, fleet, nil + }) + + ctx, cancel := agtesting.StartInformers(m, c.fleetSynced, c.gameServerSetSynced) + defer cancel() + + err = c.updateFleetStatus(ctx, fleet) + assert.Nil(t, err) + assert.True(t, updated) + }) + } } func TestControllerFilterGameServerSetByActive(t *testing.T) { diff --git a/pkg/gameserversets/controller.go b/pkg/gameserversets/controller.go index 99a392a8a4..46e66d78e9 100644 --- a/pkg/gameserversets/controller.go +++ b/pkg/gameserversets/controller.go @@ -681,11 +681,15 @@ func aggregateLists(aggListStatus map[string]agonesv1.AggregatedListStatus, list // If the List exists in both maps, aggregate the values. if list, ok := aggListStatus[key]; ok { list.Capacity += val.Capacity - // We do not remove duplicates here. - list.Values = append(list.Values, val.Values...) + // We do include duplicates in the Count. + list.Count += int64(len(val.Values)) aggListStatus[key] = list } else { - aggListStatus[key] = agonesv1.AggregatedListStatus(*val.DeepCopy()) + tmp := val.DeepCopy() + aggListStatus[key] = agonesv1.AggregatedListStatus{ + Capacity: tmp.Capacity, + Count: int64(len(tmp.Values)), + } } } diff --git a/pkg/gameserversets/controller_test.go b/pkg/gameserversets/controller_test.go index f2fda95b5a..7fd64accbc 100644 --- a/pkg/gameserversets/controller_test.go +++ b/pkg/gameserversets/controller_test.go @@ -409,7 +409,7 @@ func TestComputeStatus(t *testing.T) { gs4 := gsWithState(agonesv1.GameServerStateReady) gs4.Status.Lists = map[string]agonesv1.ListStatus{ "firstList": {Capacity: 30}, - "secondList": {Capacity: 100, Values: []string{"4"}}, + "secondList": {Capacity: 100, Values: []string{"4", "5", "6"}}, } list = append(list, gs1, gs2, gs3, gs4) @@ -422,11 +422,11 @@ func TestComputeStatus(t *testing.T) { Lists: map[string]agonesv1.AggregatedListStatus{ "firstList": { Capacity: 55, - Values: []string{"a", "b", "c"}, + Count: 3, }, "secondList": { Capacity: 1100, - Values: []string{"1", "2", "4"}, + Count: 5, }, }, } From 499cf1c3c2fce97dd63e0d5e125294d418d93de2 Mon Sep 17 00:00:00 2001 From: Ivy Gooch Date: Fri, 26 May 2023 19:27:15 +0000 Subject: [PATCH 4/6] Generated Files --- install/yaml/install.yaml | 20 +- pkg/apis/agones/v1/zz_generated.deepcopy.go | 60 + .../Reference/agones_crd_api_reference.html | 6516 +++++++++-------- 3 files changed, 3468 insertions(+), 3128 deletions(-) diff --git a/install/yaml/install.yaml b/install/yaml/install.yaml index c49437feb2..0694f11ee3 100644 --- a/install/yaml/install.yaml +++ b/install/yaml/install.yaml @@ -15517,13 +15517,12 @@ spec: additionalProperties: type: object properties: - count: # initial count + count: # Aggregated count of the Counter across the GameServerSet type: integer default: 0 minimum: 0 - capacity: # max capacity of the counter + capacity: # Aggregated maximum capacity of the Counter across the GameServerSet type: integer - default: 1000 minimum: 0 lists: type: object @@ -15533,18 +15532,13 @@ spec: additionalProperties: type: object properties: - capacity: # max capacity of the array (can be less than or equal to value of maxItems) + capacity: # Aggregated maximum capacity of the List across the GameServerSet type: integer minimum: 0 - default: 1000 - maximum: 1000 # must be equal to values.maxItems - values: - type: array - x-kubernetes-list-type: set # Requires items in the array to be unique - maxItems: 1000 # max possible size of the value array (cannot be updated) - items: # name of the item (player1, session1, room1, etc.) - type: string - default: [] + count: # Aggregated number of items in the List across the GameServerSet + type: integer + minimum: 0 + default: 0 subresources: # status enables the status subresource. status: { } diff --git a/pkg/apis/agones/v1/zz_generated.deepcopy.go b/pkg/apis/agones/v1/zz_generated.deepcopy.go index ade739b9a7..61ed4452d9 100644 --- a/pkg/apis/agones/v1/zz_generated.deepcopy.go +++ b/pkg/apis/agones/v1/zz_generated.deepcopy.go @@ -25,6 +25,38 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AggregatedCounterStatus) DeepCopyInto(out *AggregatedCounterStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AggregatedCounterStatus. +func (in *AggregatedCounterStatus) DeepCopy() *AggregatedCounterStatus { + if in == nil { + return nil + } + out := new(AggregatedCounterStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AggregatedListStatus) DeepCopyInto(out *AggregatedListStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AggregatedListStatus. +func (in *AggregatedListStatus) DeepCopy() *AggregatedListStatus { + if in == nil { + return nil + } + out := new(AggregatedListStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AggregatedPlayerStatus) DeepCopyInto(out *AggregatedPlayerStatus) { *out = *in @@ -195,6 +227,20 @@ func (in *FleetStatus) DeepCopyInto(out *FleetStatus) { *out = new(AggregatedPlayerStatus) **out = **in } + if in.Counters != nil { + in, out := &in.Counters, &out.Counters + *out = make(map[string]AggregatedCounterStatus, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Lists != nil { + in, out := &in.Lists, &out.Lists + *out = make(map[string]AggregatedListStatus, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } return } @@ -381,6 +427,20 @@ func (in *GameServerSetStatus) DeepCopyInto(out *GameServerSetStatus) { *out = new(AggregatedPlayerStatus) **out = **in } + if in.Counters != nil { + in, out := &in.Counters, &out.Counters + *out = make(map[string]AggregatedCounterStatus, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Lists != nil { + in, out := &in.Lists, &out.Lists + *out = make(map[string]AggregatedListStatus, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } return } 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 9c9678e63f..209341b0d0 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.32.0" %}} +{{% feature expiryVersion="1.33.0" %}}

Packages:

-

allocation.agones.dev/v1

+

autoscaling.agones.dev/v1

Package v1 is the v1 version of the API.

Resource Types: -

GameServerAllocation +

FleetAutoscaler

-

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

+

FleetAutoscaler is the data structure for a FleetAutoscaler resource

@@ -47,7 +46,7 @@

GameServerAllocation string

@@ -56,7 +55,7 @@

GameServerAllocation kind
string -

+ @@ -87,135 +86,162 @@

GameServerAllocation

-allocation.agones.dev/v1 +autoscaling.agones.dev/v1
GameServerAllocationFleetAutoscaler
@@ -76,8 +75,8 @@

GameServerAllocation

spec
- -GameServerAllocationSpec + +FleetAutoscalerSpec
+ +
-multiClusterSetting
+fleetName
- -MultiClusterSetting - +string
-

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

-required
+policy
- -GameServerSelector + +FleetAutoscalerPolicy
-

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.

+

Autoscaling policy

-preferred
+sync
- -[]GameServerSelector + +FleetAutoscalerSync
-

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

+(Optional) +

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

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

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

+ + +

BufferPolicy +

+

+(Appears on: +FleetAutoscalerPolicy) +

+

+

BufferPolicy controls the desired behavior of the buffer policy.

+

+ + + + + + + + +
FieldDescription
-selectors
+maxReplicas
- -[]GameServerSelector - +int32
-

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

+

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

-metadata
+bufferSize
- -MetaPatch - +k8s.io/apimachinery/pkg/util/intstr.IntOrString
-

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

+

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)

- +

FixedIntervalSync +

+

+(Appears on: +FleetAutoscalerSync) +

+

+

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

+

+ + + + + + +
FieldDescription
-status
+seconds
- -GameServerAllocationStatus - +int32
+

Seconds defines how often we run fleet autoscaling in seconds

-

CounterSelector +

FleetAutoscaleRequest

(Appears on: -GameServerSelector) +FleetAutoscaleReview)

-

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

+

FleetAutoscaleRequest defines the request to webhook autoscaler endpoint

@@ -227,54 +253,63 @@

CounterSelector

-minCount
+uid
-int64 +k8s.io/apimachinery/pkg/types.UID
+

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.

-maxCount
+name
-int64 +string
+

Name is the name of the Fleet being scaled

-minAvailable
+namespace
-int64 +string
+

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

-maxAvailable
+status
-int64 + +FleetStatus +
+

The Fleet’s status values

-

GameServerAllocationSpec +

FleetAutoscaleResponse

(Appears on: -GameServerAllocation) +FleetAutoscaleReview)

-

GameServerAllocationSpec is the spec for a GameServerAllocation

+

FleetAutoscaleResponse defines the response of webhook autoscaler endpoint

@@ -286,128 +321,88 @@

GameServerAllocationS

+ +
-multiClusterSetting
+uid
- -MultiClusterSetting - +k8s.io/apimachinery/pkg/types.UID
-

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

+

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

-required
+scale
- -GameServerSelector - +bool
-

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.

+

Set to false if no scaling should occur to the Fleet

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

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

+

The targeted replica count

+

FleetAutoscaleReview +

+

+

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

+

+ + + + + + + + - - - - - - - -
FieldDescription
-priorities
+request
- -[]Priority + +FleetAutoscaleRequest
-(Optional) -

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

-selectors
+response
- -[]GameServerSelector - - -
-

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

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

Scheduling strategy. Defaults to “Packed”.

-
-metadata
- - -MetaPatch + +FleetAutoscaleResponse
-

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

-

GameServerAllocationState -(string alias)

-

-(Appears on: -GameServerAllocationStatus) -

-

-

GameServerAllocationState is the Allocation state

-

-

GameServerAllocationStatus +

FleetAutoscalerPolicy

(Appears on: -GameServerAllocation) +FleetAutoscalerSpec)

-

GameServerAllocationStatus is the status for an GameServerAllocation resource

+

FleetAutoscalerPolicy describes how to scale a fleet

@@ -419,42 +414,77 @@

GameServerAllocatio

+ +
-state
+type
- -GameServerAllocationState + +FleetAutoscalerPolicyType
-

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

+

Type of autoscaling policy.

-gameServerName
+buffer
-string + +BufferPolicy +
+(Optional) +

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

-ports
+webhook
- -[]GameServerStatusPort + +WebhookPolicy
+(Optional) +

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

+

FleetAutoscalerPolicyType +(string alias)

+

+(Appears on: +FleetAutoscalerPolicy) +

+

+

FleetAutoscalerPolicyType is the policy for autoscaling +for a given Fleet

+

+

FleetAutoscalerSpec +

+

+(Appears on: +FleetAutoscaler) +

+

+

FleetAutoscalerSpec is the spec for a Fleet Scaler

+

+ + + + + + + +
FieldDescription
-address
+fleetName
string @@ -464,37 +494,43 @@

GameServerAllocatio

-nodeName
+policy
-string + +FleetAutoscalerPolicy +
+

Autoscaling policy

-source
+sync
-string + +FleetAutoscalerSync +
-

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

+(Optional) +

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

-

GameServerSelector +

FleetAutoscalerStatus

(Appears on: -GameServerAllocationSpec) +FleetAutoscaler)

-

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

+

FleetAutoscalerStatus defines the current status of a FleetAutoscaler

@@ -506,100 +542,75 @@

GameServerSelector

-LabelSelector
+currentReplicas
- -Kubernetes meta/v1.LabelSelector - +int32
-

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

-

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

+

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

-gameServerState
+desiredReplicas
- -GameServerState - +int32
-(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.

+

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

-players
+lastScaleTime
- -PlayerSelector + +Kubernetes meta/v1.Time
(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.

+

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

-counters
+ableToScale
- -map[string]agones.dev/agones/pkg/apis/allocation/v1.CounterSelector - +bool
-(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.

+

AbleToScale indicates that we can access the target fleet

-lists
+scalingLimited
- -map[string]agones.dev/agones/pkg/apis/allocation/v1.ListSelector - +bool
-(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.

+

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

-

ListSelector +

FleetAutoscalerSync

(Appears on: -GameServerSelector) +FleetAutoscalerSpec)

-

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: “”

+

FleetAutoscalerSync describes when to sync a fleet

@@ -611,44 +622,52 @@

ListSelector

- - - -
-containsValue
- -string - -
-
-minAvailable
+type
-int64 + +FleetAutoscalerSyncType +
+

Type of autoscaling sync.

-maxAvailable
+fixedInterval
-int64 + +FixedIntervalSync +
+(Optional) +

FixedInterval config params. Present only if FleetAutoscalerSyncType = FixedInterval.

-

MetaPatch +

FleetAutoscalerSyncType +(string alias)

+

+(Appears on: +FleetAutoscalerSync) +

+

+

FleetAutoscalerSyncType is the sync strategy for a given Fleet

+

+

WebhookPolicy

(Appears on: -GameServerAllocationSpec) +FleetAutoscalerPolicy)

-

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

+

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

@@ -660,173 +679,79 @@

MetaPatch

- - - - - - - -
-labels
- -map[string]string - -
-
-annotations
+url
-map[string]string - -
-
-

MultiClusterSetting -

-

-(Appears on: -GameServerAllocationSpec) -

-

-

MultiClusterSetting specifies settings for multi-cluster allocation.

-

- - - - - - - - - - - - -
FieldDescription
-enabled
- -bool +string
+(Optional) +

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

+

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

+

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

+

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

+

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

+

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

-policySelector
+service
- -Kubernetes meta/v1.LabelSelector + +Kubernetes admissionregistration/v1.ServiceReference
-
-

PlayerSelector -

-

-(Appears on: -GameServerSelector) -

-

-

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

-

- - - - - - - - - - - - - - - - - -
FieldDescription
-minAvailable
- -int64 - -
-
-maxAvailable
- -int64 - -
-
-

Priority -

-

-(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.

-

- - - - - - - - - - - - - - -
FieldDescription
-priorityType
- -string - -
-
-key
- -string - -
+(Optional) +

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

+

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

-order
+caBundle
-string +[]byte
+(Optional) +

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


-

autoscaling.agones.dev/v1

+

multicluster.agones.dev/v1

Package v1 is the v1 version of the API.

Resource Types: -

FleetAutoscaler +

GameServerAllocationPolicy

-

FleetAutoscaler is the data structure for a FleetAutoscaler resource

+

GameServerAllocationPolicy is the Schema for the gameserverallocationpolicies API

@@ -842,7 +767,7 @@

FleetAutoscaler string

@@ -851,7 +776,7 @@

FleetAutoscaler kind
string -

+ @@ -882,9 +807,9 @@

FleetAutoscaler

-autoscaling.agones.dev/v1 +multicluster.agones.dev/v1
FleetAutoscalerGameServerAllocationPolicy
@@ -871,8 +796,8 @@

FleetAutoscaler

spec
- -FleetAutoscalerSpec + +GameServerAllocationPolicySpec
-fleetName
+priority
-string +int32
@@ -892,58 +817,39 @@

FleetAutoscaler

-policy
+weight
- -FleetAutoscalerPolicy - +int
-

Autoscaling policy

-sync
+connectionInfo
- -FleetAutoscalerSync + +ClusterConnectionInfo
-(Optional) -

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

- - -status
- - -FleetAutoscalerStatus - - - - - - -

BufferPolicy +

ClusterConnectionInfo

(Appears on: -FleetAutoscalerPolicy) +GameServerAllocationPolicySpec)

-

BufferPolicy controls the desired behavior of the buffer policy.

+

ClusterConnectionInfo defines the connection information for a cluster

@@ -955,89 +861,67 @@

BufferPolicy

- -
-maxReplicas
+clusterName
-int32 +string
-

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

+

Optional: the name of the targeted cluster

-minReplicas
+allocationEndpoints
-int32 +[]string
-

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

+

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

-bufferSize
+secretName
-k8s.io/apimachinery/pkg/util/intstr.IntOrString +string
-

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)

+

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

-

FixedIntervalSync -

-

-(Appears on: -FleetAutoscalerSync) -

-

-

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

-

- - - - - - - - + + + +
FieldDescription
-seconds
+namespace
-int32 +string
-

Seconds defines how often we run fleet autoscaling in seconds

+

The cluster namespace from which to allocate gameservers

+
+serverCa
+ +[]byte + +
+

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

-

FleetAutoscaleRequest +

ConnectionInfoIterator

-(Appears on: -FleetAutoscaleReview) -

-

-

FleetAutoscaleRequest defines the request to webhook autoscaler endpoint

+

ConnectionInfoIterator an iterator on ClusterConnectionInfo

@@ -1049,63 +933,58 @@

FleetAutoscaleRequest

-uid
+currPriority
-k8s.io/apimachinery/pkg/types.UID +int
-

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.

+

currPriority Current priority index from the orderedPriorities

-name
+orderedPriorities
-string +[]int32
-

Name is the name of the Fleet being scaled

+

orderedPriorities list of ordered priorities

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

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

+

priorityToCluster Map of priority to cluster-policies map

-status
+clusterBlackList
- -FleetStatus - +map[string]bool
-

The Fleet’s status values

+

clusterBlackList the cluster blacklist for the clusters that has already returned

-

FleetAutoscaleResponse +

GameServerAllocationPolicySpec

(Appears on: -FleetAutoscaleReview) +GameServerAllocationPolicy)

-

FleetAutoscaleResponse defines the response of webhook autoscaler endpoint

+

GameServerAllocationPolicySpec defines the desired state of GameServerAllocationPolicy

@@ -1117,45 +996,55 @@

FleetAutoscaleResponse

-uid
+priority
-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.

-scale
+weight
-bool +int
-

Set to false if no scaling should occur to the Fleet

-replicas
+connectionInfo
-int32 + +ClusterConnectionInfo +
-

The targeted replica count

-

FleetAutoscaleReview +
+

agones.dev/v1

+

+

Package v1 is the v1 version of the API.

+

+Resource Types: + +

Fleet

-

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

+

Fleet is the data structure for a Fleet resource

@@ -1167,166 +1056,138 @@

FleetAutoscaleReview

+ + + + + + + + - - -
-request
+apiVersion
+string
+ +agones.dev/v1 + +
+kind
+string +
Fleet
+metadata
- -FleetAutoscaleRequest + +Kubernetes meta/v1.ObjectMeta
+Refer to the Kubernetes API documentation for the fields of the +metadata field.
-response
+spec
- -FleetAutoscaleResponse + +FleetSpec
-
-

FleetAutoscalerPolicy -

-

-(Appears on: -FleetAutoscalerSpec) -

-

-

FleetAutoscalerPolicy describes how to scale a fleet

-

+
+
- - - - - - - - -
FieldDescription
-type
+replicas
- -FleetAutoscalerPolicyType - +int32
-

Type of autoscaling policy.

+

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

-buffer
+allocationOverflow
- -BufferPolicy + +AllocationOverflow
(Optional) -

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

+

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

-webhook
+strategy
- -WebhookPolicy + +Kubernetes apps/v1.DeploymentStrategy
-(Optional) -

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

+

Deployment strategy

-

FleetAutoscalerPolicyType -(string alias)

-

-(Appears on: -FleetAutoscalerPolicy) -

-

-

FleetAutoscalerPolicyType is the policy for autoscaling -for a given Fleet

-

-

FleetAutoscalerSpec -

-

-(Appears on: -FleetAutoscaler) -

-

-

FleetAutoscalerSpec is the spec for a Fleet Scaler

-

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

Scheduling strategy. Defaults to “Packed”.

-policy
+template
- -FleetAutoscalerPolicy + +GameServerTemplateSpec
-

Autoscaling policy

+

Template the GameServer template to apply for this Fleet

+
-sync
+status
- -FleetAutoscalerSync + +FleetStatus -(Optional) -

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

-

FleetAutoscalerStatus +

GameServer

-(Appears on: -FleetAutoscaler) -

-

-

FleetAutoscalerStatus defines the current status of a FleetAutoscaler

+

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.

@@ -1338,216 +1199,200 @@

FleetAutoscalerStatus

+ + + + + + + +
-currentReplicas
- -int32 - +apiVersion
+string
+ +agones.dev/v1 +
-

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

+kind
+string
GameServer
-desiredReplicas
+metadata
-int32 + +Kubernetes meta/v1.ObjectMeta +
-

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

+Refer to the Kubernetes API documentation for the fields of the +metadata field.
-lastScaleTime
+spec
- -Kubernetes meta/v1.Time + +GameServerSpec
-(Optional) -

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

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

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

-ableToScale
+ports
-bool + +[]GameServerPort +
-

AbleToScale indicates that we can access the target fleet

+

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

-scalingLimited
+health
-bool + +Health +
-

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

+

Health configures health checking

-

FleetAutoscalerSync -

-

-(Appears on: -FleetAutoscalerSpec) -

-

-

FleetAutoscalerSync describes when to sync a fleet

-

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

Scheduling strategy. Defaults to “Packed”

+
-type
+sdkServer
- -FleetAutoscalerSyncType + +SdkServer
-

Type of autoscaling sync.

+

SdkServer specifies parameters for the Agones SDK Server sidecar container

-fixedInterval
+template
- -FixedIntervalSync + +Kubernetes core/v1.PodTemplateSpec
-(Optional) -

FixedInterval config params. Present only if FleetAutoscalerSyncType = FixedInterval.

+

Template describes the Pod that will be created for the GameServer

-

FleetAutoscalerSyncType -(string alias)

-

-(Appears on: -FleetAutoscalerSync) -

-

-

FleetAutoscalerSyncType is the sync strategy for a given Fleet

-

-

WebhookPolicy -

-

-(Appears on: -FleetAutoscalerPolicy) -

-

-

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

-

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

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

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

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

-

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

-

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

-

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

-

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

-

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

+

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

-service
+lists
- -Kubernetes admissionregistration/v1.ServiceReference + +map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus
-(Optional) -

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

-

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

-caBundle
+eviction
-[]byte + +Eviction +
(Optional) -

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

+

Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

+
+
+status
+ + +GameServerStatus + + +
-
-

multicluster.agones.dev/v1

-

-

Package v1 is the v1 version of the API.

-

-Resource Types: - -

GameServerAllocationPolicy +

GameServerSet

-

GameServerAllocationPolicy is the Schema for the gameserverallocationpolicies API

+

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

@@ -1563,7 +1408,7 @@

GameServerAllocat string

@@ -1572,7 +1417,7 @@

GameServerAllocat kind
string -

+ @@ -1603,49 +1448,82 @@

GameServerAllocat

-multicluster.agones.dev/v1 +agones.dev/v1
GameServerAllocationPolicyGameServerSet
@@ -1592,8 +1437,8 @@

GameServerAllocat

spec
- -GameServerAllocationPolicySpec + +GameServerSetSpec
+ + + +
-priority
+replicas
int32
+

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

-weight
+allocationOverflow
-int + +AllocationOverflow +
+(Optional) +

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

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

Scheduling strategy. Defaults to “Packed”.

+
+template
+ + +GameServerTemplateSpec
+

Template the GameServer template to apply for this GameServerSet

- - -

ClusterConnectionInfo -

-

-(Appears on: -GameServerAllocationPolicySpec) -

-

-

ClusterConnectionInfo defines the connection information for a cluster

+ + +status
+ + +GameServerSetStatus + + + + + + + + +

AggregatedPlayerStatus +

+

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

+

+

AggregatedPlayerStatus stores total player tracking values

@@ -1657,67 +1535,81 @@

ClusterConnectionInfo

+ +
-clusterName
+count
-string +int64
-

Optional: the name of the targeted cluster

-allocationEndpoints
+capacity
-[]string +int64
-

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

+

AllocationOverflow +

+

+(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.

+

+ + - - + + + +
-secretName
- -string - -
-

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

-
FieldDescription
-namespace
+labels
-string +map[string]string
-

The cluster namespace from which to allocate gameservers

+(Optional) +

Labels to be applied to the GameServer

-serverCa
+annotations
-[]byte +map[string]string
-

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

+(Optional) +

Annotations to be applied to the GameServer

-

ConnectionInfoIterator +

CounterStatus

-

ConnectionInfoIterator an iterator on ClusterConnectionInfo

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

+

+

CounterStatus stores the current counter values

@@ -1729,58 +1621,35 @@

ConnectionInfoIterato

- - - - - - - -
-currPriority
- -int - -
-

currPriority Current priority index from the orderedPriorities

-
-orderedPriorities
- -[]int32 - -
-

orderedPriorities list of ordered priorities

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

priorityToCluster Map of priority to cluster-policies map

-clusterBlackList
+capacity
-map[string]bool +int64
-

clusterBlackList the cluster blacklist for the clusters that has already returned

-

GameServerAllocationPolicySpec +

Eviction

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

-

GameServerAllocationPolicySpec defines the desired state of GameServerAllocationPolicy

+

Eviction specifies the eviction tolerance of the GameServer

@@ -1792,55 +1661,39 @@

GameServerAll

- - - - - - - -
-priority
- -int32 - -
-
-weight
- -int - -
-
-connectionInfo
+safe
- -ClusterConnectionInfo + +EvictionSafe
+

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

-
-

agones.dev/v1

+

EvictionSafe +(string alias)

-

Package v1 is the v1 version of the API.

+(Appears on: +Eviction)

-Resource Types: - -

Fleet +

+

EvictionSafe specified whether the game server supports termination via SIGTERM

+

+

FleetSpec

-

Fleet is the data structure for a Fleet resource

+(Appears on: +Fleet) +

+

+

FleetSpec is the spec for a Fleet

@@ -1852,50 +1705,6 @@

Fleet

- - - - - - - - - - - - - +

FleetStatus +

+

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

+

+

FleetStatus is the status of a Fleet

+

+
-apiVersion
-string
- -agones.dev/v1 - -
-kind
-string -
Fleet
-metadata
- - -Kubernetes meta/v1.ObjectMeta - - -
-Refer to the Kubernetes API documentation for the fields of the -metadata field. -
-spec
- - -FleetSpec - - -
-
-
- - - @@ -1959,236 +1768,192 @@

Fleet

Template the GameServer template to apply for this Fleet

+
replicas
int32 @@ -1918,8 +1727,8 @@

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 GameServerSet

+Labels and/or Annotations to apply to overflowing GameServers when the number of Allocated GameServers is more +than the desired replicas on the underlying GameServerSet

-
+ + + + + + - -
FieldDescription
-status
+replicas
- -FleetStatus - +int32
+

Replicas the total number of current GameServer replicas

-

GameServer -

-

-

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.

-

- - - - - - - - - - - - - - - - -
FieldDescription
-apiVersion
-string
- -agones.dev/v1 - -
-kind
-string -
GameServer
-metadata
+readyReplicas
- -Kubernetes meta/v1.ObjectMeta - +int32
-Refer to the Kubernetes API documentation for the fields of the -metadata field. +

ReadyReplicas are the number of Ready GameServer replicas

-spec
- - -GameServerSpec - - -
-
-
- - - - - - - + +
-container
+reservedReplicas
-string +int32
-

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

+

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.

-ports
+allocatedReplicas
- -[]GameServerPort - +int32
-

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

+

AllocatedReplicas are the number of Allocated GameServer replicas

-health
+players
- -Health + +AggregatedPlayerStatus
-

Health configures health checking

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

Scheduling strategy. Defaults to “Packed”

+(Optional) +

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

+

GameServerPort +

+

+(Appears on: +GameServerSpec) +

+

+

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

+

+ + - - + + + + - -
-sdkServer
- - -SdkServer - - -
-

SdkServer specifies parameters for the Agones SDK Server sidecar container

-
FieldDescription
-template
+name
- -Kubernetes core/v1.PodTemplateSpec - +string
-

Template describes the Pod that will be created for the GameServer

+

Name is the descriptive name of the port

-players
+portPolicy
- -PlayersSpec + +PortPolicy
-(Optional) -

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

+

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

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

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

+

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

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

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

-eviction
+hostPort
- -Eviction - +int32
-(Optional) -

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

-
+

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

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

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

-

GameServerSet +

GameServerSetSpec

-

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

+(Appears on: +GameServerSet) +

+

+

GameServerSetSpec the specification for GameServerSet

@@ -2200,50 +1965,6 @@

GameServerSet

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

GameServerSet

Template the GameServer template to apply for this GameServerSet

-
-status
- - -GameServerSetStatus - - -
-
-

AggregatedPlayerStatus +

GameServerSetStatus

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

-

AggregatedPlayerStatus stores total player tracking values

+

GameServerSetStatus is the status of a GameServerSet

@@ -2331,166 +2036,86 @@

AggregatedPlayerStatus

- - - - - -
-count
- -int64 - -
-
-capacity
+replicas
-int64 +int32
+

Replicas is the total number of current GameServer replicas

-

AllocationOverflow -

-

-(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.

-

- - - - - - - - - -
FieldDescription
-labels
+readyReplicas
-map[string]string +int32
-(Optional) -

Labels to be applied to the GameServer

+

ReadyReplicas is the number of Ready GameServer replicas

-annotations
+reservedReplicas
-map[string]string +int32
-(Optional) -

Annotations to be applied to the GameServer

+

ReservedReplicas is the number of Reserved GameServer replicas

-

CounterStatus -

-

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

-

-

CounterStatus stores the current counter values

-

- - - - - - - - - -
FieldDescription
-count
+allocatedReplicas
-int64 +int32
+

AllocatedReplicas is the number of Allocated GameServer replicas

-capacity
+shutdownReplicas
-int64 +int32
+

ShutdownReplicas is the number of Shutdown GameServers replicas

-

Eviction -

-

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

-

-

Eviction specifies the eviction tolerance of the GameServer

-

- - - - - - - -
FieldDescription
-safe
+players
- -EvictionSafe + +AggregatedPlayerStatus
-

(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

+(Optional) +

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

-

EvictionSafe -(string alias)

-

-(Appears on: -Eviction) -

-

-

EvictionSafe specified whether the game server supports termination via SIGTERM

-

-

FleetSpec +

GameServerSpec

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

-

FleetSpec is the spec for a Fleet

+

GameServerSpec is the spec for a GameServer resource

@@ -2502,43 +2127,40 @@

FleetSpec

@@ -2549,114 +2171,109 @@

FleetSpec

- -
-replicas
+container
-int32 +string
-

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

+

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

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

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

+

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

-strategy
+health
- -Kubernetes apps/v1.DeploymentStrategy + +Health
-

Deployment strategy

+

Health configures health checking

-

Scheduling strategy. Defaults to “Packed”.

+

Scheduling strategy. Defaults to “Packed”

-template
+sdkServer
- -GameServerTemplateSpec + +SdkServer
-

Template the GameServer template to apply for this Fleet

+

SdkServer specifies parameters for the Agones SDK Server sidecar container

-

FleetStatus -

-

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

-

-

FleetStatus is the status of a Fleet

-

- - - - - - - -
FieldDescription
-replicas
+template
-int32 + +Kubernetes core/v1.PodTemplateSpec +
-

Replicas the total number of current GameServer replicas

+

Template describes the Pod that will be created for the GameServer

-readyReplicas
+players
-int32 + +PlayersSpec +
-

ReadyReplicas are the number of Ready GameServer replicas

+(Optional) +

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

-reservedReplicas
+counters
-int32 + +map[string]agones.dev/agones/pkg/apis/agones/v1.CounterStatus +
-

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.

+(Optional) +

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

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

AllocatedReplicas are the number of Allocated GameServer replicas

-players
+eviction
- -AggregatedPlayerStatus + +Eviction
(Optional) -

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

+

Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

-

GameServerPort +

GameServerState +(string alias)

+

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

+

+

GameServerState is the state for the GameServer

+

+

GameServerStatus

(Appears on: -GameServerSpec) +GameServer)

-

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

+

GameServerStatus is the status for a GameServer resource

@@ -2668,160 +2285,129 @@

GameServerPort

- - - - - -
-name
+state
-string + +GameServerState +
-

Name is the descriptive name of the port

+

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

-portPolicy
+ports
- -PortPolicy + +[]GameServerStatusPort
-

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

-container
+address
string
-(Optional) -

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

-
-containerPort
- -int32 - -
-

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

-hostPort
+nodeName
-int32 +string
-

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

-protocol
+reservedUntil
- -Kubernetes core/v1.Protocol + +Kubernetes meta/v1.Time
-

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

-

GameServerSetSpec -

-

-(Appears on: -GameServerSet) -

-

-

GameServerSetSpec the specification for GameServerSet

-

- - - - - - - -
FieldDescription
-replicas
+players
-int32 + +PlayerStatus +
-

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

+(Optional) +

[Stage:Alpha] +[FeatureFlag:PlayerTracking]

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

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

+

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

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

Scheduling strategy. Defaults to “Packed”.

+(Optional)
-template
+eviction
- -GameServerTemplateSpec + +Eviction
-

Template the GameServer template to apply for this GameServerSet

+(Optional) +

Eviction specifies the eviction tolerance of the GameServer.

-

GameServerSetStatus +

GameServerStatusPort

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

-

GameServerSetStatus is the status of a GameServerSet

+

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

@@ -2833,95 +2419,71 @@

GameServerSetStatus

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

Replicas is the total number of current GameServer replicas

-
-readyReplicas
+name
-int32 +string
-

ReadyReplicas is the number of Ready GameServer replicas

-reservedReplicas
+port
int32
-

ReservedReplicas is the number of Reserved GameServer replicas

+

GameServerTemplateSpec +

+

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

+

+

GameServerTemplateSpec is a template for GameServers

+

+ + - - + + + + - - -
-allocatedReplicas
- -int32 - -
-

AllocatedReplicas is the number of Allocated GameServer replicas

-
FieldDescription
-shutdownReplicas
+metadata
-int32 + +Kubernetes meta/v1.ObjectMeta +
-

ShutdownReplicas is the number of Shutdown GameServers replicas

+Refer to the Kubernetes API documentation for the fields of the +metadata field.
-players
+spec
- -AggregatedPlayerStatus + +GameServerSpec
-(Optional) -

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

-
-

GameServerSpec -

-

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

-

-

GameServerSpec is the spec for a GameServer resource

-

+
+
- - - - - - - + +
FieldDescription
container
@@ -3048,29 +2610,22 @@

GameServerSpec

(Optional) -

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

+

Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

+
-

GameServerState -(string alias)

-

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

-

-

GameServerState is the state for the GameServer

-

-

GameServerStatus +

Health

(Appears on: -GameServer) +GameServerSpec)

-

GameServerStatus is the status for a GameServer resource

+

Health configures health checking on the GameServer

@@ -3082,56 +2637,73 @@

GameServerStatus

+ +
-state
+disabled
- -GameServerState - +bool
-

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

+

Disabled is whether health checking is disabled or not

-ports
+periodSeconds
- -[]GameServerStatusPort - +int32
+

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

-address
+failureThreshold
-string +int32
+

FailureThreshold how many failures in a row constitutes unhealthy

-nodeName
+initialDelaySeconds
-string +int32
+

InitialDelaySeconds initial delay before checking health

+

ListStatus +

+

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

+

+

ListStatus stores the current list values

+

+ + + + + + + + + +
FieldDescription
-reservedUntil
+capacity
- -Kubernetes meta/v1.Time - +int64
@@ -3139,72 +2711,73 @@

GameServerStatus

-players
+values
- -PlayerStatus - +[]string
-(Optional) -

[Stage:Alpha] -[FeatureFlag:PlayerTracking]

+

PlayerStatus +

+

+(Appears on: +GameServerStatus) +

+

+

PlayerStatus stores the current player capacity values

+

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

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

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

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

-

GameServerStatusPort +

PlayersSpec

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

-

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

+

PlayersSpec tracks the initial player capacity

@@ -3216,35 +2789,102 @@

GameServerStatusPort

+ + + +
-name
+initialCapacity
-string +int64 + +
+
+

PortPolicy +(string alias)

+

+(Appears on: +GameServerPort) +

+

+

PortPolicy is the port policy for the GameServer

+

+

SdkServer +

+

+(Appears on: +GameServerSpec) +

+

+

SdkServer specifies parameters for the Agones SDK Server sidecar container

+

+ + + + + + + + + + + + + +
FieldDescription
+logLevel
+ + +SdkServerLogLevel +
+

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

-port
+grpcPort
+ +int32 + +
+

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

+
+httpPort
int32
+

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

-

GameServerTemplateSpec -

+

SdkServerLogLevel +(string alias)

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

-

GameServerTemplateSpec is a template for GameServers

+

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

+

+
+

allocation.agones.dev/v1

+

+

Package v1 is the v1 version of the API.

+

+Resource Types: + +

GameServerAllocation +

+

+

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

@@ -3256,6 +2896,23 @@

GameServerTemplateSpec

+ + + + + + + + @@ -3283,146 +2940,164 @@

GameServerTemplateSpec

+apiVersion
+string
+ +allocation.agones.dev/v1 + +
+kind
+string +
GameServerAllocation
metadata
@@ -3272,8 +2929,8 @@

GameServerTemplateSpec

spec
- -GameServerSpec + +GameServerAllocationSpec
+
-container
+multiClusterSetting
-string + +MultiClusterSetting +
-

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

+

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

-ports
+required
- -[]GameServerPort + +GameServerSelector
-

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

+

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.

-health
+preferred
- -Health + +[]GameServerSelector
-

Health configures health checking

+

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

-scheduling
+priorities
-agones.dev/agones/pkg/apis.SchedulingStrategy + +[]Priority +
-

Scheduling strategy. Defaults to “Packed”

+(Optional) +

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

-sdkServer
+selectors
- -SdkServer + +[]GameServerSelector
-

SdkServer specifies parameters for the Agones SDK Server sidecar container

+

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

-template
+scheduling
- -Kubernetes core/v1.PodTemplateSpec - +agones.dev/agones/pkg/apis.SchedulingStrategy
-

Template describes the Pod that will be created for the GameServer

+

Scheduling strategy. Defaults to “Packed”.

-players
+metadata
- -PlayersSpec + +MetaPatch
-(Optional) -

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

+

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

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

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

+

(Alpha, CountsAndLists feature flag) Counters and Lists provide a set of actions to perform +on Counters and Lists during allocation.

lists
- -map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus + +map[string]agones.dev/agones/pkg/apis/allocation/v1.ListAction
+ + -eviction
+status
- -Eviction + +GameServerAllocationStatus -(Optional) -

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

- - - -

Health +

CounterAction

(Appears on: -GameServerSpec) +GameServerAllocationSpec)

-

Health configures health checking on the GameServer

+

CounterAction is an optional action that can be performed on a Counter at allocation. +Action: “Increment” or “Decrement” the Counter’s Count (optional). Must also define the Amount. +Amount: The amount to increment or decrement the Count (optional). Must be a positive integer. +Capacity: Update the maximum capacity of the Counter to this number (optional). Min 0, Max int64.

@@ -3434,59 +3109,45 @@

Health

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

Disabled is whether health checking is disabled or not

-
-periodSeconds
+action
-int32 +string
-

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

-failureThreshold
+amount
-int32 +int64
-

FailureThreshold how many failures in a row constitutes unhealthy

-initialDelaySeconds
+capacity
-int32 +int64
-

InitialDelaySeconds initial delay before checking health

-

ListStatus +

CounterSelector

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

-

ListStatus stores the current list values

+

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

@@ -3498,7 +3159,7 @@

ListStatus

+ + + + + + + +
-capacity
+minCount
int64 @@ -3508,9 +3169,29 @@

ListStatus

-values
+maxCount
-[]string +int64 + +
+
+minAvailable
+ +int64 + +
+
+maxAvailable
+ +int64
@@ -3518,14 +3199,14 @@

ListStatus

-

PlayerStatus +

GameServerAllocationSpec

(Appears on: -GameServerStatus) +GameServerAllocation)

-

PlayerStatus stores the current player capacity values

+

GameServerAllocationSpec is the spec for a GameServerAllocation

@@ -3537,58 +3218,131 @@

PlayerStatus

- -
-count
+multiClusterSetting
-int64 + +MultiClusterSetting +
+

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

-capacity
+required
-int64 + +GameServerSelector +
+

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

-ids
+preferred
-[]string + +[]GameServerSelector +
+

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

-

PlayersSpec -

-

-(Appears on: -GameServerSpec) -

-

-

PlayersSpec tracks the initial player capacity

-

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

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

+
-initialCapacity
+selectors
-int64 + +[]GameServerSelector + + +
+

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

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

Scheduling strategy. Defaults to “Packed”.

+
+metadata
+ + +MetaPatch + + +
+

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

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

(Alpha, CountsAndLists feature flag) Counters and Lists provide a set of actions to perform +on Counters and Lists during allocation.

+
+lists
+ + +map[string]agones.dev/agones/pkg/apis/allocation/v1.ListAction +
@@ -3596,23 +3350,23 @@

PlayersSpec

-

PortPolicy +

GameServerAllocationState (string alias)

(Appears on: -GameServerPort) +GameServerAllocationStatus)

-

PortPolicy is the port policy for the GameServer

+

GameServerAllocationState is the Allocation state

-

SdkServer +

GameServerAllocationStatus

(Appears on: -GameServerSpec) +GameServerAllocation)

-

SdkServer specifies parameters for the Agones SDK Server sidecar container

+

GameServerAllocationStatus is the status for an GameServerAllocation resource

@@ -3624,83 +3378,82 @@

SdkServer

- -
-logLevel
+state
- -SdkServerLogLevel + +GameServerAllocationState
-

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

+

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

-grpcPort
+gameServerName
-int32 +string
-

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

-httpPort
+ports
-int32 + +[]GameServerStatusPort +
-

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

-

SdkServerLogLevel -(string alias)

-

-(Appears on: -SdkServer) -

-

-

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

-

-
-

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

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

Packages:

- -

autoscaling.agones.dev/v1

+ + +address
+ +string + + + + + + + +nodeName
+ +string + + + + + + + +source
+ +string + + + +

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

+ + + + +

GameServerSelector +

-

Package v1 is the v1 version of the API.

+(Appears on: +GameServerAllocationSpec)

-Resource Types: - -

FleetAutoscaler -

-

FleetAutoscaler is the data structure for a FleetAutoscaler resource

+

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

@@ -3712,97 +3465,123 @@

FleetAutoscaler

- - - -
-apiVersion
-string
- -autoscaling.agones.dev/v1 - +LabelSelector
+ + +Kubernetes meta/v1.LabelSelector + +
-kind
-string +

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

+

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

FleetAutoscaler
-metadata
+gameServerState
- -Kubernetes meta/v1.ObjectMeta + +GameServerState
-Refer to the Kubernetes API documentation for the fields of the -metadata field. +(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.

-spec
+players
- -FleetAutoscalerSpec + +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.

+ + + +
-fleetName
+counters
-string + +map[string]agones.dev/agones/pkg/apis/allocation/v1.CounterSelector +
+(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.

-policy
+lists
- -FleetAutoscalerPolicy + +map[string]agones.dev/agones/pkg/apis/allocation/v1.ListSelector
-

Autoscaling policy

+(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.

+

ListAction +

+

+(Appears on: +GameServerAllocationSpec) +

+

+

ListAction is an optional action that can be performed on a List at allocation. +AddValues: Append values to a List’s Values array (optional). Any duplicate values will be ignored. +Capacity: Update the maximum capacity of the Counter to this number (optional). Min 0, Max 1000.

+

+ + + + + + + + - -
FieldDescription
-sync
+addValues
- -FleetAutoscalerSync - +[]string
-(Optional) -

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

-
-status
+capacity
- -FleetAutoscalerStatus - +int64
@@ -3810,14 +3589,17 @@

FleetAutoscaler

-

BufferPolicy +

ListSelector

(Appears on: -FleetAutoscalerPolicy) +GameServerSelector)

-

BufferPolicy controls the desired behavior of the buffer policy.

+

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: “”

@@ -3829,59 +3611,44 @@

BufferPolicy

-maxReplicas
+containsValue
-int32 +string
-

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

-minReplicas
+minAvailable
-int32 +int64
-

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

-bufferSize
+maxAvailable
-k8s.io/apimachinery/pkg/util/intstr.IntOrString +int64
-

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)

-

FixedIntervalSync +

MetaPatch

(Appears on: -FleetAutoscalerSync) +GameServerAllocationSpec)

-

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

+

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

@@ -3893,25 +3660,34 @@

FixedIntervalSync

+ + + +
-seconds
+labels
-int32 +map[string]string + +
+
+annotations
+ +map[string]string
-

Seconds defines how often we run fleet autoscaling in seconds

-

FleetAutoscaleRequest +

MultiClusterSetting

(Appears on: -FleetAutoscaleReview) +GameServerAllocationSpec)

-

FleetAutoscaleRequest defines the request to webhook autoscaler endpoint

+

MultiClusterSetting specifies settings for multi-cluster allocation.

@@ -3923,63 +3699,80 @@

FleetAutoscaleRequest

- - +
-uid
+enabled
-k8s.io/apimachinery/pkg/types.UID +bool
-

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
+policySelector
-string + +Kubernetes meta/v1.LabelSelector +
-

Name is the name of the Fleet being scaled

-namespace
+
+

PlayerSelector +

+

+(Appears on: +GameServerSelector) +

+

+

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

+

+ + + + + + + + + +
FieldDescription
+minAvailable
-string +int64
-

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

-status
+maxAvailable
- -FleetStatus - +int64
-

The Fleet’s status values

-

FleetAutoscaleResponse +

Priority

(Appears on: -FleetAutoscaleReview) +GameServerAllocationSpec)

-

FleetAutoscaleResponse defines the response of webhook autoscaler endpoint

+

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.

@@ -3991,45 +3784,73 @@

FleetAutoscaleResponse

-uid
+priorityType
-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.

-scale
+key
-bool +string
-

Set to false if no scaling should occur to the Fleet

-replicas
+order
-int32 +string
-

The targeted replica count

-

FleetAutoscaleReview +
+

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

+{{% /feature %}} +{{% feature publishVersion="1.33.0" %}} +

Packages:

+ +

agones.dev/v1

+

+

Package v1 is the v1 version of the API.

+

+Resource Types: + +

Fleet

-

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

+

Fleet is the data structure for a Fleet resource

@@ -4041,166 +3862,138 @@

FleetAutoscaleReview

+ + + + + + + + - - -
-request
+apiVersion
+string
+ +agones.dev/v1 + +
+kind
+string +
Fleet
+metadata
- -FleetAutoscaleRequest + +Kubernetes meta/v1.ObjectMeta
+Refer to the Kubernetes API documentation for the fields of the +metadata field.
-response
+spec
- -FleetAutoscaleResponse + +FleetSpec
-
-

FleetAutoscalerPolicy -

-

-(Appears on: -FleetAutoscalerSpec) -

-

-

FleetAutoscalerPolicy describes how to scale a fleet

-

+
+
- - - - - - - - -
FieldDescription
-type
+replicas
- -FleetAutoscalerPolicyType - +int32
-

Type of autoscaling policy.

+

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

-buffer
+allocationOverflow
- -BufferPolicy + +AllocationOverflow
(Optional) -

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

+

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

-webhook
+strategy
- -WebhookPolicy + +Kubernetes apps/v1.DeploymentStrategy
-(Optional) -

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

+

Deployment strategy

-

FleetAutoscalerPolicyType -(string alias)

-

-(Appears on: -FleetAutoscalerPolicy) -

-

-

FleetAutoscalerPolicyType is the policy for autoscaling -for a given Fleet

-

-

FleetAutoscalerSpec -

-

-(Appears on: -FleetAutoscaler) -

-

-

FleetAutoscalerSpec is the spec for a Fleet Scaler

-

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

Scheduling strategy. Defaults to “Packed”.

-policy
+template
- -FleetAutoscalerPolicy + +GameServerTemplateSpec
-

Autoscaling policy

+

Template the GameServer template to apply for this Fleet

+
-sync
+status
- -FleetAutoscalerSync + +FleetStatus -(Optional) -

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

-

FleetAutoscalerStatus +

GameServer

-(Appears on: -FleetAutoscaler) -

-

-

FleetAutoscalerStatus defines the current status of a FleetAutoscaler

+

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.

@@ -4212,216 +4005,200 @@

FleetAutoscalerStatus

+apiVersion
+string - + +agones.dev/v1 + + + + + + + + + + +
-currentReplicas
- -int32 - -
-

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

-
-desiredReplicas
+kind
+string +
GameServer
+metadata
-int32 + +Kubernetes meta/v1.ObjectMeta +
-

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

+Refer to the Kubernetes API documentation for the fields of the +metadata field.
-lastScaleTime
+spec
- -Kubernetes meta/v1.Time + +GameServerSpec
-(Optional) -

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

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

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

-ableToScale
+ports
-bool + +[]GameServerPort +
-

AbleToScale indicates that we can access the target fleet

+

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

-scalingLimited
+health
-bool + +Health +
-

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

+

Health configures health checking

-

FleetAutoscalerSync -

-

-(Appears on: -FleetAutoscalerSpec) -

-

-

FleetAutoscalerSync describes when to sync a fleet

-

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

Scheduling strategy. Defaults to “Packed”

+
-type
+sdkServer
- -FleetAutoscalerSyncType + +SdkServer
-

Type of autoscaling sync.

+

SdkServer specifies parameters for the Agones SDK Server sidecar container

-fixedInterval
+template
- -FixedIntervalSync + +Kubernetes core/v1.PodTemplateSpec
-(Optional) -

FixedInterval config params. Present only if FleetAutoscalerSyncType = FixedInterval.

+

Template describes the Pod that will be created for the GameServer

-

FleetAutoscalerSyncType -(string alias)

-

-(Appears on: -FleetAutoscalerSync) -

-

-

FleetAutoscalerSyncType is the sync strategy for a given Fleet

-

-

WebhookPolicy -

-

-(Appears on: -FleetAutoscalerPolicy) -

-

-

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

-

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

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

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

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

-

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

-

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

-

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

-

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

-

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

+

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

-service
+lists
- -Kubernetes admissionregistration/v1.ServiceReference + +map[string]agones.dev/agones/pkg/apis/agones/v1.ListStatus
-(Optional) -

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

-

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

-caBundle
+eviction
-[]byte + +Eviction +
(Optional) -

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

+

Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

+
+
+status
+ + +GameServerStatus + + +
-
-

multicluster.agones.dev/v1

-

-

Package v1 is the v1 version of the API.

-

-Resource Types: - -

GameServerAllocationPolicy +

GameServerSet

-

GameServerAllocationPolicy is the Schema for the gameserverallocationpolicies API

+

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

@@ -4437,7 +4214,7 @@

GameServerAllocat string

@@ -4446,7 +4223,7 @@

GameServerAllocat kind
string -

+ @@ -4477,121 +4254,122 @@

GameServerAllocat

-multicluster.agones.dev/v1 +agones.dev/v1
GameServerAllocationPolicyGameServerSet
@@ -4466,8 +4243,8 @@

GameServerAllocat

spec
- -GameServerAllocationPolicySpec + +GameServerSetSpec
-
-priority
+replicas
int32
+

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

-weight
+allocationOverflow
-int + +AllocationOverflow +
+(Optional) +

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

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

Scheduling strategy. Defaults to “Packed”.

- - - - -

ClusterConnectionInfo -

-

-(Appears on: -GameServerAllocationPolicySpec) -

-

-

ClusterConnectionInfo defines the connection information for a cluster

-

- - - - - - - - - - -
FieldDescription
-clusterName
+template
-string + +GameServerTemplateSpec +
-

Optional: the name of the targeted cluster

+

Template the GameServer template to apply for this GameServerSet

-allocationEndpoints
- -[]string - -
-

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

+
-secretName
+status
-string + +GameServerSetStatus + -

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

+ + +

AggregatedCounterStatus +

+

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

+

+

AggregatedCounterStatus stores total Counter tracking values

+

+ + + + + + + +
FieldDescription
-namespace
+count
-string +int64
-

The cluster namespace from which to allocate gameservers

-serverCa
+capacity
-[]byte +int64
-

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

-

ConnectionInfoIterator +

AggregatedListStatus

-

ConnectionInfoIterator an iterator on ClusterConnectionInfo

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

+

+

AggregatedListStatus stores total List tracking values

@@ -4603,58 +4381,77 @@

ConnectionInfoIterato

+ +
-currPriority
+count
-int +int64
-

currPriority Current priority index from the orderedPriorities

-orderedPriorities
+capacity
-[]int32 +int64
-

orderedPriorities list of ordered priorities

+

AggregatedPlayerStatus +

+

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

+

+

AggregatedPlayerStatus stores total player tracking values

+

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

priorityToCluster Map of priority to cluster-policies map

-clusterBlackList
+capacity
-map[string]bool +int64
-

clusterBlackList the cluster blacklist for the clusters that has already returned

-

GameServerAllocationPolicySpec +

AllocationOverflow

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

-

GameServerAllocationPolicySpec defines the desired state of GameServerAllocationPolicy

+

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.

@@ -4666,55 +4463,39 @@

GameServerAll

- - - -
-priority
- -int32 - -
-
-weight
+labels
-int +map[string]string
+(Optional) +

Labels to be applied to the GameServer

-connectionInfo
+annotations
- -ClusterConnectionInfo - +map[string]string
+(Optional) +

Annotations to be applied to the GameServer

-
-

agones.dev/v1

+

CounterStatus +

-

Package v1 is the v1 version of the API.

+(Appears on: +GameServerSpec, +GameServerStatus)

-Resource Types: - -

Fleet -

-

Fleet is the data structure for a Fleet resource

+

CounterStatus stores the current counter values

@@ -4726,48 +4507,88 @@

Fleet

- - - - + +
-apiVersion
-string
- -agones.dev/v1 - +count
+ +int64 +
-kind
-string
Fleet
-metadata
+capacity
- -Kubernetes meta/v1.ObjectMeta - +int64
-Refer to the Kubernetes API documentation for the fields of the -metadata field.
+

Eviction +

+

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

+

+

Eviction specifies the eviction tolerance of the GameServer

+

+ + + + + + + + + + +
FieldDescription
-spec
+safe
- -FleetSpec + +EvictionSafe
-
-
+

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

+
+

EvictionSafe +(string alias)

+

+(Appears on: +Eviction) +

+

+

EvictionSafe specified whether the game server supports termination via SIGTERM

+

+

FleetSpec +

+

+(Appears on: +Fleet) +

+

+

FleetSpec is the spec for a Fleet

+

+ + + + + + + +
FieldDescription
replicas
@@ -4833,31 +4654,17 @@

Fleet

Template the GameServer template to apply for this Fleet

- - - - -status
- - -FleetStatus - - - - - - - - -

GameServer +

FleetStatus

-

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

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

+

+

FleetStatus is the status of a Fleet

@@ -4869,200 +4676,200 @@

GameServer

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

Replicas the total number of current GameServer replicas

-spec
+readyReplicas
- -GameServerSpec - +int32
-
-
- +

ReadyReplicas are the number of Ready GameServer replicas

+ + + +
-container
+reservedReplicas
-string +int32
-

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

+

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.

-ports
+allocatedReplicas
- -[]GameServerPort - +int32
-

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

+

AllocatedReplicas are the number of Allocated GameServer replicas

-health
+players
- -Health + +AggregatedPlayerStatus
-

Health configures health checking

+(Optional) +

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

-scheduling
+counters
-agones.dev/agones/pkg/apis.SchedulingStrategy + +map[string]agones.dev/agones/pkg/apis/agones/v1.AggregatedCounterStatus +
-

Scheduling strategy. Defaults to “Packed”

+(Optional) +

(Alpha, CountsAndLists feature flag) Counters provides aggregated Counter capacity and Counter +count for this Fleet.

-sdkServer
+lists
- -SdkServer + +map[string]agones.dev/agones/pkg/apis/agones/v1.AggregatedListStatus
-

SdkServer specifies parameters for the Agones SDK Server sidecar container

+(Optional) +

(Alpha, CountsAndLists feature flag) Lists provides aggregated List capacityv and List values +for this Fleet.

+

GameServerPort +

+

+(Appears on: +GameServerSpec) +

+

+

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

+

+ + + + + + + + - -
FieldDescription
-template
+name
- -Kubernetes core/v1.PodTemplateSpec - +string
-

Template describes the Pod that will be created for the GameServer

+

Name is the descriptive name of the port

-players
+portPolicy
- -PlayersSpec + +PortPolicy
-(Optional) -

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

+

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

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

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

+

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

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

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

-eviction
+hostPort
- -Eviction - +int32
-(Optional) -

Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

-
+

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

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

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

-

GameServerSet +

GameServerSetSpec

-

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

+(Appears on: +GameServerSet) +

+

+

GameServerSetSpec the specification for GameServerSet

@@ -5074,50 +4881,6 @@

GameServerSet

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

GameServerSet

Template the GameServer template to apply for this GameServerSet

-
-status
- - -GameServerSetStatus - - -
-
-

AggregatedPlayerStatus +

GameServerSetStatus

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

-

AggregatedPlayerStatus stores total player tracking values

+

GameServerSetStatus is the status of a GameServerSet

@@ -5205,165 +4952,116 @@

AggregatedPlayerStatus

- -
-count
+replicas
-int64 +int32
+

Replicas is the total number of current GameServer replicas

-capacity
+readyReplicas
-int64 +int32
+

ReadyReplicas is the number of Ready GameServer replicas

-

AllocationOverflow -

-

-(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.

-

- - - - - - - - - -
FieldDescription
-labels
+reservedReplicas
-map[string]string +int32
-(Optional) -

Labels to be applied to the GameServer

+

ReservedReplicas is the number of Reserved GameServer replicas

-annotations
+allocatedReplicas
-map[string]string +int32
-(Optional) -

Annotations to be applied to the GameServer

+

AllocatedReplicas is the number of Allocated GameServer replicas

-

CounterStatus -

-

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

-

-

CounterStatus stores the current counter values

-

- - - - - - - - - -
FieldDescription
-count
+shutdownReplicas
-int64 +int32
+

ShutdownReplicas is the number of Shutdown GameServers replicas

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

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

-

Eviction -

-

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

-

-

Eviction specifies the eviction tolerance of the GameServer

-

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

(Alpha, CountsAndLists feature flag) Counters provides aggregated Counter capacity and Counter +count for this GameServerSet.

+
-safe
+lists
- -EvictionSafe + +map[string]agones.dev/agones/pkg/apis/agones/v1.AggregatedListStatus
-

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

+(Optional) +

(Alpha, CountsAndLists feature flag) Lists provides aggregated List capacity and List values +for this GameServerSet.

-

EvictionSafe -(string alias)

-

-(Appears on: -Eviction) -

-

-

EvictionSafe specified whether the game server supports termination via SIGTERM

-

-

FleetSpec +

GameServerSpec

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

-

FleetSpec is the spec for a Fleet

+

GameServerSpec is the spec for a GameServer resource

@@ -5375,43 +5073,40 @@

FleetSpec

@@ -5422,114 +5117,109 @@

FleetSpec

- -
-replicas
+container
-int32 +string
-

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

+

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

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

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

+

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

-strategy
+health
- -Kubernetes apps/v1.DeploymentStrategy + +Health
-

Deployment strategy

+

Health configures health checking

-

Scheduling strategy. Defaults to “Packed”.

+

Scheduling strategy. Defaults to “Packed”

-template
+sdkServer
- -GameServerTemplateSpec + +SdkServer
-

Template the GameServer template to apply for this Fleet

+

SdkServer specifies parameters for the Agones SDK Server sidecar container

-

FleetStatus -

-

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

-

-

FleetStatus is the status of a Fleet

-

- - - - - - - -
FieldDescription
-replicas
+template
-int32 + +Kubernetes core/v1.PodTemplateSpec +
-

Replicas the total number of current GameServer replicas

+

Template describes the Pod that will be created for the GameServer

-readyReplicas
+players
-int32 + +PlayersSpec +
-

ReadyReplicas are the number of Ready GameServer replicas

+(Optional) +

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

-reservedReplicas
+counters
-int32 + +map[string]agones.dev/agones/pkg/apis/agones/v1.CounterStatus +
-

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.

+(Optional) +

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

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

AllocatedReplicas are the number of Allocated GameServer replicas

-players
+eviction
- -AggregatedPlayerStatus + +Eviction
(Optional) -

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

+

Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

-

GameServerPort +

GameServerState +(string alias)

+

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

+

+

GameServerState is the state for the GameServer

+

+

GameServerStatus

(Appears on: -GameServerSpec) +GameServer)

-

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

+

GameServerStatus is the status for a GameServer resource

@@ -5541,160 +5231,129 @@

GameServerPort

- - - - - -
-name
+state
-string + +GameServerState +
-

Name is the descriptive name of the port

+

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

-portPolicy
+ports
- -PortPolicy + +[]GameServerStatusPort
-

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

-container
+address
string
-(Optional) -

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

-
-containerPort
- -int32 - -
-

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

-hostPort
+nodeName
-int32 +string
-

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

-protocol
+reservedUntil
- -Kubernetes core/v1.Protocol + +Kubernetes meta/v1.Time
-

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

-

GameServerSetSpec -

-

-(Appears on: -GameServerSet) -

-

-

GameServerSetSpec the specification for GameServerSet

-

- - - - - - - -
FieldDescription
-replicas
+players
-int32 + +PlayerStatus +
-

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

+(Optional) +

[Stage:Alpha] +[FeatureFlag:PlayerTracking]

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

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

+

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

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

Scheduling strategy. Defaults to “Packed”.

+(Optional)
-template
+eviction
- -GameServerTemplateSpec + +Eviction
-

Template the GameServer template to apply for this GameServerSet

+(Optional) +

Eviction specifies the eviction tolerance of the GameServer.

-

GameServerSetStatus +

GameServerStatusPort

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

-

GameServerSetStatus is the status of a GameServerSet

+

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

@@ -5706,95 +5365,71 @@

GameServerSetStatus

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

Replicas is the total number of current GameServer replicas

-
-readyReplicas
+name
-int32 +string
-

ReadyReplicas is the number of Ready GameServer replicas

-reservedReplicas
+port
int32
-

ReservedReplicas is the number of Reserved GameServer replicas

+

GameServerTemplateSpec +

+

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

+

+

GameServerTemplateSpec is a template for GameServers

+

+ + - - + + + + - - -
-allocatedReplicas
- -int32 - -
-

AllocatedReplicas is the number of Allocated GameServer replicas

-
FieldDescription
-shutdownReplicas
+metadata
-int32 + +Kubernetes meta/v1.ObjectMeta +
-

ShutdownReplicas is the number of Shutdown GameServers replicas

+Refer to the Kubernetes API documentation for the fields of the +metadata field.
-players
+spec
- -AggregatedPlayerStatus + +GameServerSpec
-(Optional) -

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

-
-

GameServerSpec -

-

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

-

-

GameServerSpec is the spec for a GameServer resource

-

+
+
- - - - - - - +
FieldDescription
container
@@ -5924,26 +5559,19 @@

GameServerSpec

Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

+ + -

GameServerState -(string alias)

-

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

-

-

GameServerState is the state for the GameServer

-

-

GameServerStatus +

Health

(Appears on: -GameServer) +GameServerSpec)

-

GameServerStatus is the status for a GameServer resource

+

Health configures health checking on the GameServer

@@ -5955,56 +5583,73 @@

GameServerStatus

+ +
-state
+disabled
- -GameServerState - +bool
-

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

+

Disabled is whether health checking is disabled or not

-ports
+periodSeconds
- -[]GameServerStatusPort - +int32
+

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

-address
+failureThreshold
-string +int32
+

FailureThreshold how many failures in a row constitutes unhealthy

-nodeName
+initialDelaySeconds
-string +int32
+

InitialDelaySeconds initial delay before checking health

+

ListStatus +

+

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

+

+

ListStatus stores the current list values

+

+ + - + + + + + + + +
-reservedUntil
- - -Kubernetes meta/v1.Time - +
FieldDescription
+capacity
+ +int64
@@ -6012,72 +5657,73 @@

GameServerStatus

-players
+values
- -PlayerStatus - +[]string
-(Optional) -

[Stage:Alpha] -[FeatureFlag:PlayerTracking]

+

PlayerStatus +

+

+(Appears on: +GameServerStatus) +

+

+

PlayerStatus stores the current player capacity values

+

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

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

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

Eviction specifies the eviction tolerance of the GameServer.

-

GameServerStatusPort +

PlayersSpec

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

-

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

+

PlayersSpec tracks the initial player capacity

@@ -6089,35 +5735,102 @@

GameServerStatusPort

+ + + +
-name
+initialCapacity
-string +int64 + +
+
+

PortPolicy +(string alias)

+

+(Appears on: +GameServerPort) +

+

+

PortPolicy is the port policy for the GameServer

+

+

SdkServer +

+

+(Appears on: +GameServerSpec) +

+

+

SdkServer specifies parameters for the Agones SDK Server sidecar container

+

+ + + + + + + + + + + + + +
FieldDescription
+logLevel
+ + +SdkServerLogLevel +
+

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

-port
+grpcPort
+ +int32 + +
+

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

+
+httpPort
int32
+

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

-

GameServerTemplateSpec -

+

SdkServerLogLevel +(string alias)

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

-

GameServerTemplateSpec is a template for GameServers

+

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

+

+
+

allocation.agones.dev/v1

+

+

Package v1 is the v1 version of the API.

+

+Resource Types: + +

GameServerAllocation +

+

+

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

@@ -6129,6 +5842,23 @@

GameServerTemplateSpec

+ + + + + + + + @@ -6156,210 +5886,164 @@

GameServerTemplateSpec

+apiVersion
+string
+ +allocation.agones.dev/v1 + +
+kind
+string +
GameServerAllocation
metadata
@@ -6145,8 +5875,8 @@

GameServerTemplateSpec

spec
- -GameServerSpec + +GameServerAllocationSpec
- - - - - -
-container
+multiClusterSetting
-string + +MultiClusterSetting +
-

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

+

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

-ports
+required
- -[]GameServerPort + +GameServerSelector
-

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

+

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.

-health
+preferred
- -Health + +[]GameServerSelector
-

Health configures health checking

+

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

-scheduling
+priorities
-agones.dev/agones/pkg/apis.SchedulingStrategy + +[]Priority +
-

Scheduling strategy. Defaults to “Packed”

+(Optional) +

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

-sdkServer
+selectors
- -SdkServer + +[]GameServerSelector
-

SdkServer specifies parameters for the Agones SDK Server sidecar container

+

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

-template
+scheduling
- -Kubernetes core/v1.PodTemplateSpec - +agones.dev/agones/pkg/apis.SchedulingStrategy
-

Template describes the Pod that will be created for the GameServer

+

Scheduling strategy. Defaults to “Packed”.

-players
+metadata
- -PlayersSpec + +MetaPatch
-(Optional) -

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

+

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

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

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

+

(Alpha, CountsAndLists feature flag) Counters and Lists provide a set of actions to perform +on Counters and Lists during allocation.

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

Eviction specifies the eviction tolerance of the GameServer. Defaults to “Never”.

-
- -

Health -

-

-(Appears on: -GameServerSpec) -

-

-

Health configures health checking on the GameServer

-

- - - - - - - - - - - - - - - - - - -
FieldDescription
-disabled
- -bool - -
-

Disabled is whether health checking is disabled or not

-
-periodSeconds
- -int32 - -
-

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

-
-failureThreshold
- -int32 - -
-

FailureThreshold how many failures in a row constitutes unhealthy

-initialDelaySeconds
+status
-int32 + +GameServerAllocationStatus +
-

InitialDelaySeconds initial delay before checking health

-

ListStatus +

CounterAction

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

-

ListStatus stores the current list values

+

CounterAction is an optional action that can be performed on a Counter at allocation. +Action: “Increment” or “Decrement” the Counter’s Count (optional). Must also define the Amount. +Amount: The amount to increment or decrement the Count (optional). Must be a positive integer. +Capacity: Update the maximum capacity of the Counter to this number (optional). Min 0, Max int64.

@@ -6371,46 +6055,17 @@

ListStatus

- - - - - -
-capacity
- -int64 - -
-
-values
+action
-[]string +string
-

PlayerStatus -

-

-(Appears on: -GameServerStatus) -

-

-

PlayerStatus stores the current player capacity values

-

- - - - - - - - - - - -
FieldDescription
-count
+amount
int64 @@ -6428,26 +6083,17 @@

PlayerStatus

-ids
- -[]string - -
-
-

PlayersSpec +

CounterSelector

(Appears on: -GameServerSpec) +GameServerSelector)

-

PlayersSpec tracks the initial player capacity

+

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

@@ -6459,7 +6105,7 @@

PlayersSpec

- -
-initialCapacity
+minCount
int64 @@ -6467,94 +6113,46 @@

PlayersSpec

-

PortPolicy -(string alias)

-

-(Appears on: -GameServerPort) -

-

-

PortPolicy is the port policy for the GameServer

-

-

SdkServer -

-

-(Appears on: -GameServerSpec) -

-

-

SdkServer specifies parameters for the Agones SDK Server sidecar container

-

- - - - - - - -
FieldDescription
-logLevel
+maxCount
- -SdkServerLogLevel - +int64
-

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

-grpcPort
+minAvailable
-int32 +int64
-

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

-httpPort
+maxAvailable
-int32 +int64
-

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

-

SdkServerLogLevel -(string alias)

+

GameServerAllocationSpec +

(Appears on: -SdkServer) -

-

-

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

-

-
-

allocation.agones.dev/v1

-

-

Package v1 is the v1 version of the API.

+GameServerAllocation)

-Resource Types: - -

GameServerAllocation -

-

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

+

GameServerAllocationSpec is the spec for a GameServerAllocation

@@ -6566,50 +6164,6 @@

GameServerAllocation

- - - - - - - - - - - - - - - +

GameServerAllocationState +(string alias)

+

+(Appears on: +GameServerAllocationStatus) +

+

+

GameServerAllocationState is the Allocation state

+

+

GameServerAllocationStatus +

+

+(Appears on: +GameServerAllocation) +

+

+

GameServerAllocationStatus is the status for an GameServerAllocation resource

+

+
-apiVersion
-string
- -allocation.agones.dev/v1 - -
-kind
-string -
GameServerAllocation
-metadata
- - -Kubernetes meta/v1.ObjectMeta - - -
-Refer to the Kubernetes API documentation for the fields of the -metadata field. -
-spec
- - -GameServerAllocationSpec - - -
-
-
- - - +
multiClusterSetting
@@ -6740,34 +6294,112 @@

GameServerAllocation

-
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
FieldDescription
-status
+state
- -GameServerAllocationStatus + +GameServerAllocationState + + +
+

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

+
+gameServerName
+ +string + +
+
+ports
+ + +[]GameServerStatusPort
+address
+ +string + +
+
+nodeName
+ +string + +
+
+source
+ +string + +
+

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

+
-

CounterAction +

GameServerSelector

(Appears on: GameServerAllocationSpec)

-

CounterAction is an optional action that can be performed on a Counter at allocation. -Action: “Increment” or “Decrement” the Counter’s Count (optional). Must also define the Amount. -Amount: The amount to increment or decrement the Count (optional). Must be a positive integer. -Capacity: Update the maximum capacity of the Counter to this number (optional). Min 0, Max int64.

+

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

@@ -6779,7 +6411,153 @@

CounterAction

+ + + + + + + + + + + + + + + + + + + +
-action
+LabelSelector
+ + +Kubernetes meta/v1.LabelSelector + + +
+

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

+

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

+
+gameServerState
+ + +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.

+
+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.

+
+counters
+ + +map[string]agones.dev/agones/pkg/apis/allocation/v1.CounterSelector + + +
+(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.

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

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

+
+

ListAction +

+

+(Appears on: +GameServerAllocationSpec) +

+

+

ListAction is an optional action that can be performed on a List at allocation. +AddValues: Append values to a List’s Values array (optional). Any duplicate values will be ignored. +Capacity: Update the maximum capacity of the Counter to this number (optional). Min 0, Max 1000.

+

+ + + + + + + + + + + + + + + + + +
FieldDescription
+addValues
+ +[]string + +
+
+capacity
+ +int64 + +
+
+

ListSelector +

+

+(Appears on: +GameServerSelector) +

+

+

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: “”

+

+ + + + + + + + + + + + + +
FieldDescription
+containsValue
string @@ -6789,7 +6567,7 @@

CounterAction

-amount
+minAvailable
int64 @@ -6799,25 +6577,644 @@

CounterAction

-capacity
+maxAvailable
+ +int64 + +
+
+

MetaPatch +

+

+(Appears on: +GameServerAllocationSpec) +

+

+

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

+

+ + + + + + + + + + + + + + + + + +
FieldDescription
+labels
+ +map[string]string + +
+
+annotations
+ +map[string]string + +
+
+

MultiClusterSetting +

+

+(Appears on: +GameServerAllocationSpec) +

+

+

MultiClusterSetting specifies settings for multi-cluster allocation.

+

+ + + + + + + + + + + + + + + + + +
FieldDescription
+enabled
+ +bool + +
+
+policySelector
+ + +Kubernetes meta/v1.LabelSelector + + +
+
+

PlayerSelector +

+

+(Appears on: +GameServerSelector) +

+

+

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

+

+ + + + + + + + + + + + + + + + + +
FieldDescription
+minAvailable
+ +int64 + +
+
+maxAvailable
+ +int64 + +
+
+

Priority +

+

+(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.

+

+ + + + + + + + + + + + + + + + + + + + + +
FieldDescription
+priorityType
+ +string + +
+
+key
+ +string + +
+
+order
+ +string + +
+
+
+

autoscaling.agones.dev/v1

+

+

Package v1 is the v1 version of the API.

+

+Resource Types: + +

FleetAutoscaler +

+

+

FleetAutoscaler is the data structure for a FleetAutoscaler resource

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FieldDescription
+apiVersion
+string
+ +autoscaling.agones.dev/v1 + +
+kind
+string +
FleetAutoscaler
+metadata
+ + +Kubernetes meta/v1.ObjectMeta + + +
+Refer to the Kubernetes API documentation for the fields of the +metadata field. +
+spec
+ + +FleetAutoscalerSpec + + +
+
+
+ + + + + + + + + + + + + +
+fleetName
+ +string + +
+
+policy
+ + +FleetAutoscalerPolicy + + +
+

Autoscaling policy

+
+sync
+ + +FleetAutoscalerSync + + +
+(Optional) +

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

+
+
+status
+ + +FleetAutoscalerStatus + + +
+
+

BufferPolicy +

+

+(Appears on: +FleetAutoscalerPolicy) +

+

+

BufferPolicy controls the desired behavior of the buffer policy.

+

+ + + + + + + + + + + + + + + + + + + + + +
FieldDescription
+maxReplicas
+ +int32 + +
+

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

+
+minReplicas
+ +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

+
+bufferSize
+ +k8s.io/apimachinery/pkg/util/intstr.IntOrString + +
+

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)

+
+

FixedIntervalSync +

+

+(Appears on: +FleetAutoscalerSync) +

+

+

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

+

+ + + + + + + + + + + + + +
FieldDescription
+seconds
+ +int32 + +
+

Seconds defines how often we run fleet autoscaling in seconds

+
+

FleetAutoscaleRequest +

+

+(Appears on: +FleetAutoscaleReview) +

+

+

FleetAutoscaleRequest defines the request to webhook autoscaler endpoint

+

+ + + + + + + + + + + + + + + + + + + + + + + + + +
FieldDescription
+uid
+ +k8s.io/apimachinery/pkg/types.UID + +
+

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
+ +string + +
+

Name is the name of the Fleet being scaled

+
+namespace
+ +string + +
+

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

+
+status
+ + +FleetStatus + + +
+

The Fleet’s status values

+
+

FleetAutoscaleResponse +

+

+(Appears on: +FleetAutoscaleReview) +

+

+

FleetAutoscaleResponse defines the response of webhook autoscaler endpoint

+

+ + + + + + + + + + + + + + + + + + + + + +
FieldDescription
+uid
+ +k8s.io/apimachinery/pkg/types.UID + +
+

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

+
+scale
+ +bool + +
+

Set to false if no scaling should occur to the Fleet

+
+replicas
+ +int32 + +
+

The targeted replica count

+
+

FleetAutoscaleReview +

+

+

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

+

+ + + + + + + + + + + + + + + + + +
FieldDescription
+request
+ + +FleetAutoscaleRequest + + +
+
+response
+ + +FleetAutoscaleResponse + + +
+
+

FleetAutoscalerPolicy +

+

+(Appears on: +FleetAutoscalerSpec) +

+

+

FleetAutoscalerPolicy describes how to scale a fleet

+

+ + + + + + + + + + + + + + + + + +
FieldDescription
+type
+ + +FleetAutoscalerPolicyType + + +
+

Type of autoscaling policy.

+
+buffer
+ + +BufferPolicy + + +
+(Optional) +

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

+
+webhook
-int64 + +WebhookPolicy +
+(Optional) +

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

-

CounterSelector +

FleetAutoscalerPolicyType +(string alias)

+

+(Appears on: +FleetAutoscalerPolicy) +

+

+

FleetAutoscalerPolicyType is the policy for autoscaling +for a given Fleet

+

+

FleetAutoscalerSpec

(Appears on: -GameServerSelector) +FleetAutoscaler)

-

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

+

FleetAutoscalerSpec is the spec for a Fleet Scaler

@@ -6829,19 +7226,9 @@

CounterSelector

- - - -
-minCount
- -int64 - -
-
-maxCount
+fleetName
-int64 +string
@@ -6849,34 +7236,43 @@

CounterSelector

-minAvailable
+policy
-int64 + +FleetAutoscalerPolicy +
+

Autoscaling policy

-maxAvailable
+sync
-int64 + +FleetAutoscalerSync +
+(Optional) +

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

-

GameServerAllocationSpec +

FleetAutoscalerStatus

(Appears on: -GameServerAllocation) +FleetAutoscaler)

-

GameServerAllocationSpec is the spec for a GameServerAllocation

+

FleetAutoscalerStatus defines the current status of a FleetAutoscaler

@@ -6888,155 +7284,132 @@

GameServerAllocationS

- - - - + +
-multiClusterSetting
- - -MultiClusterSetting - - -
-

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

-
-required
+currentReplicas
- -GameServerSelector - +int32
-

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.

+

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

-preferred
+desiredReplicas
- -[]GameServerSelector - +int32
-

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

+

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

-priorities
+lastScaleTime
- -[]Priority + +Kubernetes meta/v1.Time
(Optional) -

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

+

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

-selectors
+ableToScale
- -[]GameServerSelector - +bool
-

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

+

AbleToScale indicates that we can access the target fleet

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

Scheduling strategy. Defaults to “Packed”.

+

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

+

FleetAutoscalerSync +

+

+(Appears on: +FleetAutoscalerSpec) +

+

+

FleetAutoscalerSync describes when to sync a fleet

+

+ + - - + + + +
-metadata
- - -MetaPatch - - -
-

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

-
FieldDescription
-counters
+type
- -map[string]agones.dev/agones/pkg/apis/allocation/v1.CounterAction + +FleetAutoscalerSyncType
-(Optional) -

(Alpha, CountsAndLists feature flag) Counters and Lists provide a set of actions to perform -on Counters and Lists during allocation.

+

Type of autoscaling sync.

-lists
+fixedInterval
- -map[string]agones.dev/agones/pkg/apis/allocation/v1.ListAction + +FixedIntervalSync
+(Optional) +

FixedInterval config params. Present only if FleetAutoscalerSyncType = FixedInterval.

-

GameServerAllocationState +

FleetAutoscalerSyncType (string alias)

(Appears on: -GameServerAllocationStatus) +FleetAutoscalerSync)

-

GameServerAllocationState is the Allocation state

+

FleetAutoscalerSyncType is the sync strategy for a given Fleet

-

GameServerAllocationStatus +

WebhookPolicy

(Appears on: -GameServerAllocation) +FleetAutoscalerPolicy)

-

GameServerAllocationStatus is the status for an GameServerAllocation resource

+

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

@@ -7048,82 +7421,79 @@

GameServerAllocatio

- - - - - - - - - - - -
-state
- - -GameServerAllocationState - - -
-

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

-
-gameServerName
+url
string
+(Optional) +

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

+

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

+

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

+

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

+

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

+

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

-ports
+service
- -[]GameServerStatusPort + +Kubernetes admissionregistration/v1.ServiceReference
+(Optional) +

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

+

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

-address
- -string - -
-
-nodeName
- -string - -
-
-source
+caBundle
-string +[]byte
-

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

+(Optional) +

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

-

GameServerSelector -

+
+

multicluster.agones.dev/v1

-(Appears on: -GameServerAllocationSpec) +

Package v1 is the v1 version of the API.

+Resource Types: + +

GameServerAllocationPolicy +

-

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

+

GameServerAllocationPolicy is the Schema for the gameserverallocationpolicies API

@@ -7135,113 +7505,63 @@

GameServerSelector

+apiVersion
+string - + - +
+
+
-LabelSelector
- - -Kubernetes meta/v1.LabelSelector - - -
-

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

-

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

+ +multicluster.agones.dev/v1 +
-gameServerState
- - -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.

+kind
+string
GameServerAllocationPolicy
-players
+metadata
- -PlayerSelector + +Kubernetes meta/v1.ObjectMeta
-(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.

+Refer to the Kubernetes API documentation for the fields of the +metadata field.
-counters
+spec
- -map[string]agones.dev/agones/pkg/apis/allocation/v1.CounterSelector + +GameServerAllocationPolicySpec
-(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.

-
- -
-lists
+priority
- -map[string]agones.dev/agones/pkg/apis/allocation/v1.ListSelector - +int32
-(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.

-

ListAction -

-

-(Appears on: -GameServerAllocationSpec) -

-

-

ListAction is an optional action that can be performed on a List at allocation. -AddValues: Append values to a List’s Values array (optional). Any duplicate values will be ignored. -Capacity: Update the maximum capacity of the Counter to this number (optional). Min 0, Max 1000.

-

- - - - - - - - +
FieldDescription
-addValues
+weight
-[]string +int
@@ -7249,27 +7569,29 @@

ListAction

-capacity
+connectionInfo
-int64 + +ClusterConnectionInfo +
+ + -

ListSelector +

ClusterConnectionInfo

(Appears on: -GameServerSelector) +GameServerAllocationPolicySpec)

-

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: “”

+

ClusterConnectionInfo defines the connection information for a cluster

@@ -7281,83 +7603,67 @@

ListSelector

- -
-containsValue
+clusterName
string
+

Optional: the name of the targeted cluster

-minAvailable
+allocationEndpoints
-int64 +[]string
+

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

-maxAvailable
+secretName
-int64 +string
+

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

-

MetaPatch -

-

-(Appears on: -GameServerAllocationSpec) -

-

-

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

-

- - - - - - - -
FieldDescription
-labels
+namespace
-map[string]string +string
+

The cluster namespace from which to allocate gameservers

-annotations
+serverCa
-map[string]string +[]byte
+

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

-

MultiClusterSetting +

ConnectionInfoIterator

-(Appears on: -GameServerAllocationSpec) -

-

-

MultiClusterSetting specifies settings for multi-cluster allocation.

+

ConnectionInfoIterator an iterator on ClusterConnectionInfo

@@ -7369,80 +7675,58 @@

MultiClusterSetting

- -
-enabled
+currPriority
-bool +int
+

currPriority Current priority index from the orderedPriorities

-policySelector
+orderedPriorities
- -Kubernetes meta/v1.LabelSelector - +[]int32
+

orderedPriorities list of ordered priorities

-

PlayerSelector -

-

-(Appears on: -GameServerSelector) -

-

-

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

-

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

priorityToCluster Map of priority to cluster-policies map

-maxAvailable
+clusterBlackList
-int64 +map[string]bool
+

clusterBlackList the cluster blacklist for the clusters that has already returned

-

Priority +

GameServerAllocationPolicySpec

(Appears on: -GameServerAllocationSpec) +GameServerAllocationPolicy)

-

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.

+

GameServerAllocationPolicySpec defines the desired state of GameServerAllocationPolicy

@@ -7454,9 +7738,9 @@

Priority

-priorityType
+priority
-string +int32
@@ -7464,9 +7748,9 @@

Priority

-key
+weight
-string +int
@@ -7474,9 +7758,11 @@

Priority

-order
+connectionInfo
-string + +ClusterConnectionInfo +
From e1fb9052d2dabb4016c78b164ea69c28d7af7fe8 Mon Sep 17 00:00:00 2001 From: Ivy Gooch Date: Tue, 30 May 2023 18:44:09 +0000 Subject: [PATCH 5/6] Fixes failing TestControllerUpdateFleetPlayerStatus --- pkg/fleets/controller_test.go | 244 +++++++++++++--------------------- 1 file changed, 94 insertions(+), 150 deletions(-) diff --git a/pkg/fleets/controller_test.go b/pkg/fleets/controller_test.go index daf84496a5..32e834a5bb 100644 --- a/pkg/fleets/controller_test.go +++ b/pkg/fleets/controller_test.go @@ -18,7 +18,6 @@ package fleets import ( "context" "encoding/json" - "fmt" "net/http" "testing" "time" @@ -686,183 +685,128 @@ func TestControllerUpdateFleetPlayerStatus(t *testing.T) { assert.True(t, updated) } -// nolint Errors on duplicate code to TestControllerUpdateFleetListStatus +// nolint // Linter errors on lines are duplicate of TestControllerUpdateFleetListStatus func TestControllerUpdateFleetCounterStatus(t *testing.T) { t.Parallel() - testCases := map[string]struct { - feature string - gsSet1StatusCounters map[string]agonesv1.AggregatedCounterStatus - gsSet2StatusCounters map[string]agonesv1.AggregatedCounterStatus - want map[string]agonesv1.AggregatedCounterStatus - }{ - "Full Counter": { - feature: fmt.Sprintf("%s=true", utilruntime.FeatureCountsAndLists), - gsSet1StatusCounters: map[string]agonesv1.AggregatedCounterStatus{ - "fullCounter": { - Capacity: 100, - Count: 100, - }, - }, - gsSet2StatusCounters: map[string]agonesv1.AggregatedCounterStatus{ - "fullCounter": { - Capacity: 10, - Count: 10, - }, - }, - want: map[string]agonesv1.AggregatedCounterStatus{ - "fullCounter": { - Capacity: 110, - Count: 110, - }, - }, - }, - "One Counter": { - feature: fmt.Sprintf("%s=true", utilruntime.FeatureCountsAndLists), - gsSet2StatusCounters: map[string]agonesv1.AggregatedCounterStatus{ - "oneCounter": { - Capacity: 100, - Count: 1, - }, - }, - want: map[string]agonesv1.AggregatedCounterStatus{ - "oneCounter": { - Capacity: 100, - Count: 1, - }, - }, - }, - } - - for name, tc := range testCases { - t.Run(name, func(t *testing.T) { - err := utilruntime.ParseFeatures(tc.feature) - assert.NoError(t, err) - - fleet := defaultFixture() + utilruntime.FeatureTestMutex.Lock() + defer utilruntime.FeatureTestMutex.Unlock() - gsSet1 := fleet.GameServerSet() - gsSet1.ObjectMeta.Name = "gsSet1" - gsSet1.Status.Counters = tc.gsSet1StatusCounters + require.NoError(t, utilruntime.ParseFeatures(string(utilruntime.FeatureCountsAndLists)+"=true")) - gsSet2 := fleet.GameServerSet() - gsSet2.ObjectMeta.Name = "gsSet2" - gsSet2.Status.Counters = tc.gsSet2StatusCounters + fleet := defaultFixture() + c, m := newFakeController() - c, m := newFakeController() + gsSet1 := fleet.GameServerSet() + gsSet1.ObjectMeta.Name = "gsSet1" + gsSet1.Status.Counters = map[string]agonesv1.AggregatedCounterStatus{ + "fullCounter": { + Capacity: 1000, + Count: 1000, + }, + } - m.AgonesClient.AddReactor("list", "gameserversets", - func(action k8stesting.Action) (bool, runtime.Object, error) { - return true, &agonesv1.GameServerSetList{Items: []agonesv1.GameServerSet{*gsSet1, *gsSet2}}, nil - }) + gsSet2 := fleet.GameServerSet() + gsSet2.ObjectMeta.Name = "gsSet2" + gsSet2.Status.Counters = map[string]agonesv1.AggregatedCounterStatus{ + "fullCounter": { + Capacity: 1000, + Count: 1000, + }, + "anotherCounter": { + Capacity: 10, + Count: 0, + }, + } - updated := false + m.AgonesClient.AddReactor("list", "gameserversets", + func(action k8stesting.Action) (bool, runtime.Object, error) { + return true, &agonesv1.GameServerSetList{Items: []agonesv1.GameServerSet{*gsSet1, *gsSet2}}, nil + }) - m.AgonesClient.AddReactor("update", "fleets", - func(action k8stesting.Action) (bool, runtime.Object, error) { - updated = true - ua := action.(k8stesting.UpdateAction) - fleet := ua.GetObject().(*agonesv1.Fleet) + updated := false + m.AgonesClient.AddReactor("update", "fleets", + func(action k8stesting.Action) (bool, runtime.Object, error) { + updated = true + ua := action.(k8stesting.UpdateAction) + fleet := ua.GetObject().(*agonesv1.Fleet) - assert.Equal(t, tc.want, fleet.Status.Counters) + assert.Equal(t, int64(2000), fleet.Status.Counters["fullCounter"].Capacity) + assert.Equal(t, int64(2000), fleet.Status.Counters["fullCounter"].Count) + assert.Equal(t, int64(10), fleet.Status.Counters["anotherCounter"].Capacity) + assert.Equal(t, int64(0), fleet.Status.Counters["anotherCounter"].Count) - return true, fleet, nil - }) + return true, fleet, nil + }) - ctx, cancel := agtesting.StartInformers(m, c.fleetSynced, c.gameServerSetSynced) - defer cancel() + ctx, cancel := agtesting.StartInformers(m, c.fleetSynced, c.gameServerSetSynced) + defer cancel() - err = c.updateFleetStatus(ctx, fleet) - assert.Nil(t, err) - assert.True(t, updated) - }) - } + err := c.updateFleetStatus(ctx, fleet) + assert.Nil(t, err) + assert.True(t, updated) } -// nolint Errors on duplicate code to TestControllerUpdateFleetCounterStatus +// nolint // Linter errors on lines are duplicate of TestControllerUpdateFleetCounterStatus func TestControllerUpdateFleetListStatus(t *testing.T) { t.Parallel() - testCases := map[string]struct { - feature string - gsSet1StatusLists map[string]agonesv1.AggregatedListStatus - gsSet2StatusLists map[string]agonesv1.AggregatedListStatus - want map[string]agonesv1.AggregatedListStatus - }{ - "Full List": { - feature: fmt.Sprintf("%s=true", utilruntime.FeatureCountsAndLists), - gsSet1StatusLists: map[string]agonesv1.AggregatedListStatus{ - "fullList": { - Capacity: 1000, - Count: 1000, - }, - }, - gsSet2StatusLists: map[string]agonesv1.AggregatedListStatus{ - "fullList": { - Capacity: 2000, - Count: 2000, - }, - "anotherList": { - Capacity: 10, - Count: 1, - }, - }, - want: map[string]agonesv1.AggregatedListStatus{ - "fullList": { - Capacity: 3000, - Count: 3000, - }, - "anotherList": { - Capacity: 10, - Count: 1, - }, - }, - }, - } - - for name, tc := range testCases { - t.Run(name, func(t *testing.T) { - err := utilruntime.ParseFeatures(tc.feature) - assert.NoError(t, err) - - fleet := defaultFixture() + utilruntime.FeatureTestMutex.Lock() + defer utilruntime.FeatureTestMutex.Unlock() - gsSet1 := fleet.GameServerSet() - gsSet1.ObjectMeta.Name = "gsSet1" - gsSet1.Status.Lists = tc.gsSet1StatusLists + require.NoError(t, utilruntime.ParseFeatures(string(utilruntime.FeatureCountsAndLists)+"=true")) - gsSet2 := fleet.GameServerSet() - gsSet2.ObjectMeta.Name = "gsSet2" - gsSet2.Status.Lists = tc.gsSet2StatusLists + fleet := defaultFixture() + c, m := newFakeController() - c, m := newFakeController() + gsSet1 := fleet.GameServerSet() + gsSet1.ObjectMeta.Name = "gsSet1" + gsSet1.Status.Lists = map[string]agonesv1.AggregatedListStatus{ + "fullList": { + Capacity: 1000, + Count: 1000, + }, + } - m.AgonesClient.AddReactor("list", "gameserversets", - func(action k8stesting.Action) (bool, runtime.Object, error) { - return true, &agonesv1.GameServerSetList{Items: []agonesv1.GameServerSet{*gsSet1, *gsSet2}}, nil - }) + gsSet2 := fleet.GameServerSet() + gsSet2.ObjectMeta.Name = "gsSet2" + gsSet2.Status.Lists = map[string]agonesv1.AggregatedListStatus{ + "fullList": { + Capacity: 200, + Count: 200, + }, + "anotherList": { + Capacity: 10, + Count: 1, + }, + } - updated := false + m.AgonesClient.AddReactor("list", "gameserversets", + func(action k8stesting.Action) (bool, runtime.Object, error) { + return true, &agonesv1.GameServerSetList{Items: []agonesv1.GameServerSet{*gsSet1, *gsSet2}}, nil + }) - m.AgonesClient.AddReactor("update", "fleets", - func(action k8stesting.Action) (bool, runtime.Object, error) { - updated = true - ua := action.(k8stesting.UpdateAction) - fleet := ua.GetObject().(*agonesv1.Fleet) + updated := false + m.AgonesClient.AddReactor("update", "fleets", + func(action k8stesting.Action) (bool, runtime.Object, error) { + updated = true + ua := action.(k8stesting.UpdateAction) + fleet := ua.GetObject().(*agonesv1.Fleet) - assert.Equal(t, tc.want, fleet.Status.Lists) + assert.Equal(t, int64(1200), fleet.Status.Lists["fullList"].Capacity) + assert.Equal(t, int64(1200), fleet.Status.Lists["fullList"].Count) + assert.Equal(t, int64(10), fleet.Status.Lists["anotherList"].Capacity) + assert.Equal(t, int64(1), fleet.Status.Lists["anotherList"].Count) - return true, fleet, nil - }) + return true, fleet, nil + }) - ctx, cancel := agtesting.StartInformers(m, c.fleetSynced, c.gameServerSetSynced) - defer cancel() + ctx, cancel := agtesting.StartInformers(m, c.fleetSynced, c.gameServerSetSynced) + defer cancel() - err = c.updateFleetStatus(ctx, fleet) - assert.Nil(t, err) - assert.True(t, updated) - }) - } + err := c.updateFleetStatus(ctx, fleet) + assert.Nil(t, err) + assert.True(t, updated) } func TestControllerFilterGameServerSetByActive(t *testing.T) { From 702d3462d779688298ff4b54717e82a0f8f4f81a Mon Sep 17 00:00:00 2001 From: Ivy Gooch Date: Thu, 1 Jun 2023 19:59:51 +0000 Subject: [PATCH 6/6] Minor changes per reviewer comments --- pkg/apis/agones/v1/gameserver.go | 14 ++++++++++++++ pkg/fleets/controller_test.go | 4 ++-- pkg/gameserversets/controller.go | 5 +---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/pkg/apis/agones/v1/gameserver.go b/pkg/apis/agones/v1/gameserver.go index 73552ac57f..ede5c4f26e 100644 --- a/pkg/apis/agones/v1/gameserver.go +++ b/pkg/apis/agones/v1/gameserver.go @@ -700,6 +700,20 @@ func (gs *GameServer) IsBeforeReady() bool { return false } +// IsReady returns true if the GameServer status is Ready, Reserved, or Allocated state. +func (gs *GameServer) IsReady() bool { + switch gs.Status.State { + case GameServerStateAllocated: + return true + case GameServerStateReady: + return true + case GameServerStateReserved: + return true + } + + return false +} + // FindContainer returns the container specified by the name parameter. Returns the index and the value. // Returns an error if not found. func (gss *GameServerSpec) FindContainer(name string) (int, corev1.Container, error) { diff --git a/pkg/fleets/controller_test.go b/pkg/fleets/controller_test.go index 32e834a5bb..def58db3f4 100644 --- a/pkg/fleets/controller_test.go +++ b/pkg/fleets/controller_test.go @@ -685,7 +685,7 @@ func TestControllerUpdateFleetPlayerStatus(t *testing.T) { assert.True(t, updated) } -// nolint // Linter errors on lines are duplicate of TestControllerUpdateFleetListStatus +// nolint:dupl // Linter errors on lines are duplicate of TestControllerUpdateFleetListStatus func TestControllerUpdateFleetCounterStatus(t *testing.T) { t.Parallel() @@ -747,7 +747,7 @@ func TestControllerUpdateFleetCounterStatus(t *testing.T) { assert.True(t, updated) } -// nolint // Linter errors on lines are duplicate of TestControllerUpdateFleetCounterStatus +// nolint:dupl // Linter errors on lines are duplicate of TestControllerUpdateFleetCounterStatus func TestControllerUpdateFleetListStatus(t *testing.T) { t.Parallel() diff --git a/pkg/gameserversets/controller.go b/pkg/gameserversets/controller.go index 46e66d78e9..e0462b0f65 100644 --- a/pkg/gameserversets/controller.go +++ b/pkg/gameserversets/controller.go @@ -621,10 +621,7 @@ func computeStatus(list []*agonesv1.GameServer) agonesv1.GameServerSetStatus { } // Aggregates all Counters and Lists only for GameServer states Ready, Reserved, or Allocated. - if runtime.FeatureEnabled(runtime.FeatureCountsAndLists) && - (gs.Status.State == agonesv1.GameServerStateReady || - gs.Status.State == agonesv1.GameServerStateAllocated || - gs.Status.State == agonesv1.GameServerStateReserved) { + if runtime.FeatureEnabled(runtime.FeatureCountsAndLists) && gs.IsReady() { status.Counters = aggregateCounters(status.Counters, gs.Status.Counters) status.Lists = aggregateLists(status.Lists, gs.Status.Lists) }