Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Default Counter Capacity as 1000 #3637

Merged
merged 6 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions examples/counterfleetautoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ spec:
# Value can be an absolute number (ex: 5) or a percentage of the Counter available capacity (ex: 5%).
# An absolute number is calculated from percentage by rounding up. Must be bigger than 0. Required field.
bufferSize: 5
# MinCapacity is the minimum aggregate Counter total capacity across the fleet.
# MinCapacity is the minimum aggregate Counter total capacity across the fleet, defaulting to 1000.
Kalaiselvi84 marked this conversation as resolved.
Show resolved Hide resolved
# If BufferSize is specified as a percentage, MinCapacity is required and cannot be 0.
# If non zero, MinCapacity must be smaller than MaxCapacity and must be greater than or equal to BufferSize.
minCapacity: 10
# MaxCapacity is the maximum aggregate Counter total capacity across the fleet.
# MaxCapacity must be greater than or equal to both MinCapacity and BufferSize. Required field.
# MaxCapacity is the maximum aggregate Counter total capacity across the fleet, defaulting to 1000.
# MaxCapacity must be greater than or equal to both MinCapacity and BufferSize.
# Setting MaxCapacity to max(int64) may result in issues. Required field.
maxCapacity: 100
4 changes: 2 additions & 2 deletions examples/gameserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ spec:
# counters: # counters are int64 counters that can be incremented and decremented by set amounts. Keys must be declared at GameServer creation time.
# games: # arbitrary key.
# count: 1 # initial value.
# capacity: 100 # (Optional) Maximum value for the counter. 0 is max(int64).
# capacity: 100 # (Optional) Defaults to 1000 and setting capacity to max(int64) may lead to issues and is not recommended.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# capacity: 100 # (Optional) Defaults to 1000 and setting capacity to max(int64) may lead to issues and is not recommended.
# capacity: 100 # (Optional) Defaults to 1000 and setting capacity to max(int64) may lead to issues and is not recommended [#3636](https://github.com/googleforgames/agones/issues/3636)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should link back to the GitHub issue so that people can reference the "why". You may need to run make site-server to make sure the link functions correctly on the Agones website https://agones.dev/site/docs/reference/gameserver/.

# sessions:
# count: 1
# count: 1 # Defaults to 1000 and setting count to max(int64) may lead to issues and is not recommended.
Kalaiselvi84 marked this conversation as resolved.
Show resolved Hide resolved
# lists: # lists are lists of values stored against this GameServer that can be added and deleted from. Keys must be declared at GameServer creation time.
# players: # an empty list, with a capacity set to 10.
# capacity: 10 # capacity value, defaults to 1000.
Expand Down
8 changes: 4 additions & 4 deletions examples/gameserverallocation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ spec:
# [FeatureFlag:CountsAndLists]
# counters: # selector for counter current values of a GameServer count
# rooms:
# minCount: 1 # minimum value. Defaults to 0.
# maxCount: 5 # maximum value. Defaults to max(int64)
# minAvailable: 1 # minimum available (current capacity - current count). Defaults to 0.
# maxAvailable: 10 # maximum available (current capacity - current count) Defaults to max(int64)
# minCount: 1 # minimum value. Defaults to 1000.
Kalaiselvi84 marked this conversation as resolved.
Show resolved Hide resolved
# maxCount: 5 # maximum value. Defaults to 1000 and setting count to max(int64) may lead to issues and is not recommended.
# minAvailable: 1 # minimum available (current capacity - current count). Defaults to 1000.
# maxAvailable: 10 # maximum available (current capacity - current count). Defaults to 1000 and setting capacity to max(int64) may lead to issues and is not recommended.
# lists:
# players:
# containsValue: "x6k8z" # only match GameServers who has this value in the list. Defaults to "", which is all.
Expand Down
8 changes: 4 additions & 4 deletions pkg/apis/allocation/v1/gameserverallocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,16 @@ type PlayerSelector struct {

// CounterSelector is the filter options for a GameServer based on the count and/or available capacity.
type CounterSelector struct {
// MinCount is the minimum current value. Defaults to 0.
// MinCount is the minimum current value. Defaults to 1000.
Kalaiselvi84 marked this conversation as resolved.
Show resolved Hide resolved
// +optional
MinCount int64 `json:"minCount"`
// MaxCount is the maximum current value. Defaults to 0, which translates as max(in64).
// MaxCount is the maximum current value. Defaults to 1000 and setting count to max(int64) may lead to issues and is not recommended.
// +optional
MaxCount int64 `json:"maxCount"`
// MinAvailable specifies the minimum capacity (current capacity - current count) available on a GameServer. Defaults to 0.
// MinAvailable specifies the minimum capacity (current capacity - current count) available on a GameServer. Defaults to 1000.
// +optional
MinAvailable int64 `json:"minAvailable"`
// MaxAvailable specifies the maximum capacity (current capacity - current count) available on a GameServer. Defaults to 0, which translates to max(int64).
// MaxAvailable specifies the maximum capacity (current capacity - current count) available on a GameServer. Defaults to 1000 and setting capacity to max(int64) may lead to issues and is not recommended.
// +optional
MaxAvailable int64 `json:"maxAvailable"`
}
Expand Down
4 changes: 3 additions & 1 deletion sdks/go/alpha.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ func (a *Alpha) GetCounterCount(key string) (int64, error) {
}

// IncrementCounter increases a counter by the given nonnegative integer amount.
// Will execute the increment operation against the current CRD value. Will max at max(int64).
// Will execute the increment operation against the current CRD value.
// By default, the counter's capacity is set to 1000. Attempting to set the capacity
Kalaiselvi84 marked this conversation as resolved.
Show resolved Hide resolved
// to max(int64) could lead to issues and is not recommended.
// Will error if the key was not predefined in the GameServer resource on creation.
// Returns false if the count is at the current capacity (to the latest knowledge of the SDK),
// and no increment will occur.
Expand Down
2 changes: 2 additions & 0 deletions site/content/en/docs/Guides/Client SDKs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ to the capacity of that Counter or List.
All functions will return an error if the specified `key` is not predefined in the
[`GameServer.Spec.Counters`][gameserverspec] resource configuration.

**Note:** For Counters, the default settings for both capacity and count are preset to 1000. It is recommended to avoid configuring the capacity or count to max(int64), as doing so could cause problems with [JSON Patch operations](https://github.com/googleforgames/agones/issues/3636).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the yaml and .md files to show the default setting of 1000 for counters. Can you please check if these updates are ok or if this Note section in the Agones Game Server Client SDKs documentation covers everything needed?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the capacity defaults to 1000, the count defaults to 0.


##### Alpha().GetCounterCount(key)

This function retrieves either the [`GameServer.Status.Counters[key].Count`][gameserverstatus] or the SDK awaiting-batch
Expand Down
2 changes: 1 addition & 1 deletion site/content/en/docs/Reference/fleet.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ The `spec` field is the actual `Fleet` specification and it is composed as follo
- `priorities`: (Alpha, requires `CountsAndLists` feature flag): Defines which gameservers in the Fleet are most important to keep around - impacts scale down logic.
- `type`: 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`: Order: Sort by “Ascending” or “Descending”. “Descending” a bigger Capacity is preferred. “Ascending” would be smaller Capacity is preferred.
- `order`: Order: Sort by “Ascending” or “Descending”. “Descending” a bigger Capacity is preferred. “Ascending” would be smaller Capacity is preferred. Note that the default Counters capacity is 1000 and setting Counters capacity to max(int64) may lead to issues and is not recommended.
Kalaiselvi84 marked this conversation as resolved.
Show resolved Hide resolved
- `template` a full `GameServer` configuration template.
See the [GameServer]({{< relref "gameserver.md" >}}) reference for all available fields.

Expand Down
11 changes: 6 additions & 5 deletions site/content/en/docs/Reference/fleetautoscaler.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,13 @@ spec:
# Value can be an absolute number (ex: 5) or a percentage of the Counter available capacity (ex: 5%).
# An absolute number is calculated from percentage by rounding up. Must be bigger than 0. Required field.
bufferSize: 5
# MinCapacity is the minimum aggregate Counter total capacity across the fleet.
# MinCapacity is the minimum aggregate Counter total capacity across the fleet, defaulting to 1000.
Kalaiselvi84 marked this conversation as resolved.
Show resolved Hide resolved
# If BufferSize is specified as a percentage, MinCapacity is required and cannot be 0.
# If non zero, MinCapacity must be smaller than MaxCapacity and must be greater than or equal to BufferSize.
minCapacity: 10
# MaxCapacity is the maximum aggregate Counter total capacity across the fleet.
# MaxCapacity must be greater than or equal to both MinCapacity and BufferSize. Required field.
# MaxCapacity is the maximum aggregate Counter total capacity across the fleet, defaulting to 1000.
# MaxCapacity must be greater than or equal to both MinCapacity and BufferSize.
# Setting MaxCapacity to max(int64) may result in issues. Required field.
maxCapacity: 100
```

Expand Down Expand Up @@ -210,8 +211,8 @@ The `spec` field of the `FleetAutoscaler` is composed as follows:
- `counter` contains the settings for counter-based autoscaling:
- `key` is the name of the counter to use for scaling decisions.
- `bufferSize` is the size of a buffer of counted items that are available in the Fleet (available capacity). Value can be an absolute number or a percentage of desired game server instances. An absolute number is calculated from percentage by rounding up. Must be bigger than 0.
- `minCapacity` is the minimum aggregate Counter total capacity across the fleet. If zero, MinCapacity is ignored. If non zero, MinCapacity must be smaller than MaxCapacity and bigger than BufferSize.
- `maxCapacity` is the maximum aggregate Counter total capacity across the fleet. It must be bigger than both MinCapacity and BufferSize.
- `minCapacity` is the minimum aggregate Counter total capacity across the fleet, defaulting to 1000. If zero, MinCapacity is ignored. If non zero, MinCapacity must be smaller than MaxCapacity and bigger than BufferSize.
- `maxCapacity` is the maximum aggregate Counter total capacity across the fleet, defaulting to 1000. It must be bigger than both MinCapacity and BufferSize. Note that setting capacity to max(int64) may lead to issues and is not recommended.
- `list` parameters of the list policy type
- `list` contains the settings for list-based autoscaling:
- `key` is the name of the list to use for scaling decisions.
Expand Down
6 changes: 3 additions & 3 deletions site/content/en/docs/Reference/gameserver.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ spec:
# counters: # counters are int64 counters that can be incremented and decremented by set amounts. Keys must be declared at GameServer creation time.
# games: # arbitrary key.
# count: 1 # initial value.
# capacity: 100 # (Optional) Maximum value for the counter. 0 is max(int64).
# capacity: 100 # (Optional) Defaults to 1000 and setting capacity to max(int64) may lead to issues and is not recommended.
# sessions:
# count: 1
# count: 1 # Defaults to 1000 and setting count to max(int64) may lead to issues and is not recommended.
# lists: # lists are lists of values stored against this GameServer that can be added and deleted from. Keys must be declared at GameServer creation time.
# players: # an empty list, with a capacity set to 10.
# capacity: 10 # capacity value, defaults to 1000.
Expand Down Expand Up @@ -146,7 +146,7 @@ The `spec` field is the actual GameServer specification and it is composed as fo
- `grpcPort` the port that the SDK Server binds to for gRPC connections
- `httpPort` the port that the SDK Server binds to for HTTP gRPC gateway connections
- `players` (Alpha, behind "PlayerTracking" feature gate), sets this GameServer's initial player capacity
- `counters` (Alpha, requires "CountsAndLists" feature flag) are int64 counters that can be incremented and decremented by set amounts. Keys must be declared at GameServer creation time.
- `counters` (Alpha, requires "CountsAndLists" feature flag) are int64 counters with a default capacity of 1000 that can be incremented and decremented by set amounts. Keys must be declared at GameServer creation time. Note that setting the capacity to max(int64) may lead to issues.
- `lists` (Alpha, requires "CountsAndLists" feature flag) are lists of values stored against this GameServer that can be added and deleted from. Key must be declared at GameServer creation time.
- `template` the [pod spec template]({{% k8s-api-version href="#podtemplatespec-v1-core" %}}) to run your GameServer containers, [see](https://kubernetes.io/docs/concepts/workloads/pods/pod-overview/#pod-templates) for more information.

Expand Down
10 changes: 5 additions & 5 deletions site/content/en/docs/Reference/gameserverallocation.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ spec:
# [FeatureFlag:CountsAndLists]
# counters: # selector for counter current values of a GameServer count
# rooms:
# minCount: 1 # minimum value. Defaults to 0.
# maxCount: 5 # maximum value. Defaults to max(int64)
# minAvailable: 1 # minimum available (current capacity - current count). Defaults to 0.
# maxAvailable: 10 # maximum available (current capacity - current count) Defaults to max(int64)
# minCount: 1 # minimum value. Defaults to 1000.
# maxCount: 5 # maximum value. Defaults to 1000 and setting capacity to max(int64) may lead to issues and is not recommended.
# minAvailable: 1 # minimum available (current capacity - current count). Defaults to 1000.
# maxAvailable: 10 # maximum available (current capacity - current count). Defaults to 1000 and setting capacity to max(int64) may lead to issues and is not recommended.
# lists:
# players:
# containsValue: "x6k8z" # only match GameServers who has this value in the list. Defaults to "", which is all.
Expand Down Expand Up @@ -188,7 +188,7 @@ The `spec` field is the actual `GameServerAllocation` specification, and it is c
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.
- `counters` (Alpha, "CountsAndLists" feature flag) enables filtering based on game server Counter status, such as
the minimum and maximum number of active rooms. This helps in selecting game servers based on their current activity
the minimum and maximum number of active rooms, defaulting to a capacity of 1000. This helps in selecting game servers based on their current activity
or capacity. Optional.
- `lists` (Alpha, "CountsAndLists" feature flag) enables filtering based on game server List status, such as allowing
for inclusion or exclusion of specific players. Optional.
Expand Down
Loading