Skip to content

Commit

Permalink
CRD values for Aggregate Player Tracking (#1551)
Browse files Browse the repository at this point in the history
This PR is only the structure to store aggregate values for player
tracking data across Fleets and GameServerSets.

Later PRs will implement the logic.

Work on #1033
  • Loading branch information
markmandel committed May 15, 2020
1 parent 1474c20 commit f7cf180
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 4 deletions.
6 changes: 6 additions & 0 deletions pkg/apis/agones/v1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ const (
ErrContainerNameInvalid = "Container must be empty or the name of a container in the pod template"
)

// AggregatedPlayerStatus stores total player tracking values
type AggregatedPlayerStatus struct {
Count int64 `json:"count"`
Capacity int64 `json:"capacity"`
}

// crd is an interface to get Name and Kind of CRD
type crd interface {
GetName() string
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/agones/v1/fleet.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ type FleetStatus struct {
ReservedReplicas int32 `json:"reservedReplicas"`
// AllocatedReplicas are the number of Allocated GameServer replicas
AllocatedReplicas int32 `json:"allocatedReplicas"`
// [Stage:Alpha]
// [FeatureFlag:PlayerTracking]
// Players are the current total player capacity and count for this Fleet
// +optional
Players *AggregatedPlayerStatus `json:"players,omitempty"`
}

// GameServerSet returns a single GameServerSet for this Fleet definition
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/agones/v1/gameserverset.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ type GameServerSetStatus struct {
AllocatedReplicas int32 `json:"allocatedReplicas"`
// ShutdownReplicas are the number of Shutdown GameServers replicas
ShutdownReplicas int32 `json:"shutdownReplicas"`
// [Stage:Alpha]
// [FeatureFlag:PlayerTracking]
// Players are the current total player capacity and count for this GameServerSet
// +optional
Players *AggregatedPlayerStatus `json:"players,omitempty"`
}

// ValidateUpdate validates when updates occur. The argument
Expand Down
30 changes: 28 additions & 2 deletions pkg/apis/agones/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/apis/autoscaling/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 72 additions & 0 deletions site/content/en/docs/Reference/agones_crd_api_reference.html
Original file line number Diff line number Diff line change
Expand Up @@ -3114,6 +3114,46 @@ <h3 id="GameServerSet">GameServerSet
</tr>
</tbody>
</table>
<h3 id="AggregatedPlayerStatus">AggregatedPlayerStatus
</h3>
<p>
(<em>Appears on:</em>
<a href="#FleetStatus">FleetStatus</a>,
<a href="#GameServerSetStatus">GameServerSetStatus</a>)
</p>
<p>
<p>AggregatedPlayerStatus stores total player tracking values</p>
</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>count</code></br>
<em>
int64
</em>
</td>
<td>
</td>
</tr>
<tr>
<td>
<code>capacity</code></br>
<em>
int64
</em>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<h3 id="FleetSpec">FleetSpec
</h3>
<p>
Expand Down Expand Up @@ -3244,6 +3284,22 @@ <h3 id="FleetStatus">FleetStatus
<p>AllocatedReplicas are the number of Allocated GameServer replicas</p>
</td>
</tr>
<tr>
<td>
<code>players</code></br>
<em>
<a href="#AggregatedPlayerStatus">
AggregatedPlayerStatus
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>[Stage:Alpha]
[FeatureFlag:PlayerTracking]
Players are the current total player capacity and count for this Fleet</p>
</td>
</tr>
</tbody>
</table>
<h3 id="GameServerPort">GameServerPort
Expand Down Expand Up @@ -3468,6 +3524,22 @@ <h3 id="GameServerSetStatus">GameServerSetStatus
<p>ShutdownReplicas are the number of Shutdown GameServers replicas</p>
</td>
</tr>
<tr>
<td>
<code>players</code></br>
<em>
<a href="#AggregatedPlayerStatus">
AggregatedPlayerStatus
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>[Stage:Alpha]
[FeatureFlag:PlayerTracking]
Players are the current total player capacity and count for this GameServerSet</p>
</td>
</tr>
</tbody>
</table>
<h3 id="GameServerSpec">GameServerSpec
Expand Down

0 comments on commit f7cf180

Please sign in to comment.