Skip to content

Commit

Permalink
Review updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
markmandel committed Sep 23, 2021
1 parent 6bf0512 commit 2ad4e07
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ game server process deems that is has room to host another game session.
{{< alert title="Info" color="info">}}
To watch for Allocation events, there is the initial `GameServer.status.state` change from `Ready` to `Allocated`,
but it is also useful to know that the value of `GameServer.metadata.annotations["agones.dev/last-allocated"]` will
change with each allocation, regardless of if there is a state change or not.
change as it is set by Agones with each allocation with the current timestamp, regardless of if there
is a state change or not.
{{< /alert >}}

## Example `GameServerAllocation`
Expand Down
23 changes: 17 additions & 6 deletions site/static/diagrams/high-density.puml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ Matchmaker -> Agones: Create: <i>GameServerAllocation</i>
note left
The <i>GameServerAllocation</i> is implemented to
optionally select an already allocated <i>GameServer</i>
with <i>metadata["agones.dev/sdk-available"] = "true"</i>
with <i>metadata.labels["agones.dev/sdk-available"] = "true"</i>
if one exists. At this stage, one does not, so
Agones will allocate a <i>Ready</i> <i>GameServer</i>.
end note
Agones -> GameServer: Finds a <i>Ready</i> <i>GameServer</i>,\nsets it to <i>Allocated</i> State\nand <i>metadata["agones.dev/sdk-available"] = "false"</i>
Agones -> GameServer: Finds a <i>Ready</i> <i>GameServer</i>,\nsets it to <i>Allocated</i> State\nand <i>metadata.labels["agones.dev/sdk-available"] = "false"</i>\nand <i>metadata.annotations["agones.dev/last-allocated"] = current timestamp</i>
note left
By setting the label "agones.dev/last-allocated" to "false"
this remove the `GameServer` from possibly being
Expand All @@ -52,6 +52,12 @@ end note
Matchmaker <-- Agones : <i>GameServerAllocation</i> is returned\nwith <i>GameServer</i> details\nincluding IP and port to connect to.

SDK --> Binary: Sends SDK.WatchGameServer()\nevent for Allocation.
note right
This initial allocation can be determined
as a change in <i>GameServer.status.state</i>
from <i>Ready</i> to <i>Allocated</i>
end note

Binary -> SDK: SDK.SetLabel("available", "true")
note right
Since this game process can handle <i>n</i>
Expand All @@ -60,30 +66,35 @@ optional allocation label selectors, so it can be
re-allocated.
(See example below for more details)
end note
SDK --> GameServer: Sets <i>metadata["agones.dev/sdk-available"] = "true"</i>
SDK --> GameServer: Sets <i>metadata.labels["agones.dev/sdk-available"] = "true"</i>

== Allocated <i>GameServers</i> with room for more sessions ==

Matchmaker -> Agones: Create: <i>GameServerAllocation</i>
note left
The <i>GameServerAllocation</i> will this time
find the Allocated <i>GameServer</i> with the label
<i>metadata["agones.dev/sdk-available"] = "true"</i>,
<i>metadata.labels["agones.dev/sdk-available"] = "true"</i>,
indicating that it can accept more
concurrent game sessions.
end note
Agones -> GameServer: Finds the Allocated <i>GameServer</i>\nwith <i>metadata["agones.dev/sdk-available"] = "true"</i>\n and set <i>metadata["agones.dev/sdk-available"] = "false"</i>.
Agones -> GameServer: Finds the Allocated <i>GameServer</i>\nwith <i>metadata.labels["agones.dev/sdk-available"] = "true"</i>\nand set <i>metadata.labels["agones.dev/sdk-available"] = "false"</i>\nand <i>metadata.annotations["agones.dev/last-allocated"] = current timestamp</i>.
note right
This is the a <i>GameServer</i> that has room
for another concurrent game session.
end note
Matchmaker <-- Agones: returns <i>Allocated GameServer</i> record

SDK --> Binary: Sends SDK.WatchGameServer()\nevent for Allocation.
note right
The game server process can watch for a change
in <i>metadata.annotations["agones.dev/last-allocated"]</i>
to determine there is an allocation event.
end note

alt <i>GameServer</i> can accept more concurrent sessions
Binary -> SDK: SDK.SetLabel("available", "true")
SDK --> GameServer: Sets <i>metadata["agones.dev/sdk-available"] = "true"</i>.
SDK --> GameServer: Sets <i>metadata.labels["agones.dev/sdk-available"] = "true"</i>.
end alt
note right
If the <i>GameServer</i> can accept
Expand Down
Binary file modified site/static/diagrams/high-density.puml.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2ad4e07

Please sign in to comment.