GameServerAllocation Specification
GameServerAllocation
is used to atomically allocate a GameServer out of a set of GameServers. This could be a single Fleet, multiple Fleets, or a self managed group of GameServers.A full GameServerAllocation
specification is available below and in the
example folder
for reference:
apiVersion: "allocation.agones.dev/v1"
kind: GameServerAllocation
spec:
# GameServer selector from which to choose GameServers from.
# GameServers still have the hard requirement to be `Ready` to be allocated from
# however we can also make available `matchExpressions` for even greater
# flexibility.
# Below is an example of a GameServer allocated against a given fleet.
# See: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more details
required:
matchLabels:
game: my-game
matchExpressions:
- {key: tier, operator: In, values: [cache]}
# ordered list of preferred allocations out of the `required` set.
# 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.
# This also support `matchExpressions`
preferred:
- matchLabels:
agones.dev/fleet: green-fleet
- matchLabels:
agones.dev/fleet: blue-fleet
# defines how GameServers are organised across the cluster.
# Options include:
# "Packed" (default) is aimed at dynamic Kubernetes clusters, such as cloud providers, wherein we want to bin pack
# resources
# "Distributed" is aimed at static Kubernetes clusters, wherein we want to distribute resources across the entire
# cluster
scheduling: Packed
# Optional custom metadata that is added to the game server at allocation
# You can use this to tell the server necessary session data
metadata:
labels:
mode: deathmatch
annotations:
map: garden22
We recommend using metadata > generateName
, to declare to Kubernetes that a unique
name for the GameServerAllocation
is generated when the GameServerAllocation
is created.
The spec
field is the actual GameServerAllocation
specification and it is composed as follow:
required
is a label selector (matchLabels and/or matchExpressions) from which to choose GameServers from. GameServers still have the hard requirement to beReady
to be allocated frompreferred
is an order list of label selectors out of therequired
set. 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.scheduling
defines how GameServers are organised across the cluster, in this case specifically when allocatingGameServers
for usage. “Packed” (default) is aimed at dynamic Kubernetes clusters, such as cloud providers, wherein we want to bin pack resources. “Distributed” is aimed at static Kubernetes clusters, wherein we want to distribute resources across the entire cluster. See Scheduling and Autoscaling for more details.metadata
is an optional list of custom labels and/or annotations that will be used to patch the game server’s metadata in the moment of allocation. This can be used to tell the server necessary session data
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.