agones.dev/agones@v1.53.0/examples/gameserverallocation.yaml (about)

     1  ---
     2  # Copyright 2018 Google LLC All Rights Reserved.
     3  #
     4  # Licensed under the Apache License, Version 2.0 (the "License");
     5  # you may not use this file except in compliance with the License.
     6  # You may obtain a copy of the License at
     7  #
     8  #     http://www.apache.org/licenses/LICENSE-2.0
     9  #
    10  # Unless required by applicable law or agreed to in writing, software
    11  # distributed under the License is distributed on an "AS IS" BASIS,
    12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  # See the License for the specific language governing permissions and
    14  # limitations under the License.
    15  
    16  #
    17  # Full example of a GameServerAllocation. This is used to allocate
    18  # A GameServer out of a set of GameServers. This could be a Fleet,
    19  # multiple Fleets, or a self managed group of GameServers.
    20  #
    21  
    22  #
    23  # For a full reference and details: https://agones.dev/site/docs/reference/gameserverallocation/
    24  #
    25  apiVersion: allocation.agones.dev/v1
    26  kind: GameServerAllocation
    27  metadata:
    28    name: allocation-example
    29  spec:
    30    # GameServer selector from which to choose GameServers from.
    31    # GameServers still have the hard requirement to be `Ready` to be allocated from.
    32    # However, we can also make available `matchExpressions` for even greater flexibility.
    33    # Below is an example of a GameServer allocated against a given fleet.
    34    # See: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more details
    35    # The selectors is an ordered list of allocations set.
    36    # If the first selector is not matched, the selection attempts the second selector, and so on.
    37    # This is useful for things like smoke testing of new game servers.
    38    # This also supports `matchExpressions`
    39    selectors:
    40      - matchLabels:
    41          agones.dev/fleet: green-fleet
    42      - matchLabels:
    43          agones.dev/fleet: blue-fleet
    44      - matchLabels:
    45          game: my-game
    46        matchExpressions:
    47          - {key: tier, operator: In, values: [cache]}
    48        # Specifies which State is the filter to be used when attempting to retrieve a GameServer
    49        # via Allocation. Defaults to "Ready". The only other option is "Allocated", which can be used in conjunction with
    50        # label/annotation/player selectors to retrieve an already Allocated GameServer.
    51        gameServerState: Ready
    52        # [Stage:Beta]
    53        # [FeatureFlag:CountsAndLists]
    54        counters:  # selector for counter current values of a GameServer count
    55          rooms:
    56            minCount: 1  # minimum value. Defaults to 0.
    57            maxCount: 5  # maximum value. Defaults to max(int64)
    58            minAvailable: 1  # minimum available (current capacity - current count). Defaults to 0.
    59            maxAvailable: 10  # maximum available (current capacity - current count) Defaults to max(int64)
    60        lists:
    61          players:
    62            containsValue: "x6k8z"  # only match GameServers who has this value in the list. Defaults to "", which is all.
    63            minAvailable: 1  # minimum available (current capacity - current count). Defaults to 0.
    64            maxAvailable: 10  # maximum available (current capacity - current count) Defaults to 0, which translates to max(int64)
    65        #
    66        # [Stage:Alpha]
    67        # [FeatureFlag:PlayerAllocationFilter]
    68        # Provides a filter on minimum and maximum values for player capacity when retrieving a GameServer
    69        # through Allocation. Defaults to no limits.
    70        players:
    71          minAvailable: 0
    72          maxAvailable: 99
    73    # defines how GameServers are organised across the cluster.
    74    # Options include:
    75    # "Packed" (default) is aimed at dynamic Kubernetes clusters, such as cloud providers, wherein we want to bin pack
    76    # resources
    77    # "Distributed" is aimed at static Kubernetes clusters, wherein we want to distribute resources across the entire
    78    # cluster
    79    scheduling: Packed
    80    # Optional custom metadata that is added to the game server at allocation
    81    # You can use this to tell the server necessary session data
    82    metadata:
    83      labels:
    84        mode: deathmatch
    85      annotations:
    86        map: garden22
    87    # yamllint disable rule:comments-indentation rule:line-length
    88    # [Stage: Beta]
    89    # [FeatureFlag:CountsAndLists]
    90    # `Priorities` configuration alters the order in which `GameServers` are searched for matches to the configured `selectors`.
    91    #
    92    # Priority of sorting is in descending importance. I.e. The position 0 `priority` entry is checked first.
    93    #
    94    # For `Packed` strategy sorting, this priority list will be the tie-breaker within the least utilised infrastructure, to ensure optimal
    95    # infrastructure usage while also allowing some custom prioritisation of `GameServers`.
    96    #
    97    # For `Distributed` strategy sorting, the entire selection of `GameServers` will be sorted by this priority list to provide the
    98    # order that `GameServers` will be allocated by.
    99    # Optional.
   100    priorities:
   101      - type: Counter  # Whether a Counter or a List.
   102        key: rooms  # The name of the Counter or List.
   103        order: Ascending  # "Ascending" lists smaller available capacity first.
   104    # [Stage:Beta]
   105    # [FeatureFlag:CountsAndLists]
   106    # Counter actions to perform during allocation. Optional.
   107    counters:
   108      rooms:
   109        action: Increment  # Either "Increment" or "Decrement" the Counter’s Count.
   110        amount: 1  # Amount is the amount to increment or decrement the Count. Must be a positive integer.
   111        capacity: 5  # Amount to update the maximum capacity of the Counter to this number. Min 0, Max int64.
   112    # List actions to perform during allocation. Optional.
   113    lists:
   114      players:
   115        addValues:  # appends values to a List’s Values array. Any duplicate values will be ignored
   116          - x7un
   117          - 8inz
   118        capacity: 40  # Updates the maximum capacity of the Counter to this number. Min 0, Max 1000.
   119        deleteValues:  # removes values from a List's Valules array. Any nonexistant values are ignored.
   120          - alice
   121          - bob