-
Notifications
You must be signed in to change notification settings - Fork 775
/
allocation.proto
173 lines (148 loc) · 6.04 KB
/
allocation.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
// Copyright 2020 Google LLC All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package allocation;
option go_package = "./allocation";
import "google/api/annotations.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
title: "proto/allocation/allocation.proto";
version: "version not set";
};
schemes: HTTPS;
consumes: "application/json";
produces: "application/json";
};
service AllocationService {
rpc Allocate(AllocationRequest) returns (AllocationResponse) {
option (google.api.http) = {
post: "/gameserverallocation"
body: "*"
};
}
}
message AllocationRequest {
// The k8s namespace that is hosting the targeted fleet of gameservers to be allocated
string namespace = 1;
// If specified, multi-cluster policies are applied. Otherwise, allocation will happen locally.
MultiClusterSetting multiClusterSetting = 2;
// Deprecated: Please use gameServerSelectors instead. This field is ignored if the
// gameServerSelectors field is set
// The required allocation. Defaults to all GameServers.
GameServerSelector requiredGameServerSelector = 3 [deprecated = true];
// Deprecated: Please use gameServerSelectors instead. This field is ignored if the
// gameServerSelectors field is set
// The 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.
repeated GameServerSelector preferredGameServerSelectors = 4 [deprecated = true];
// Scheduling strategy. Defaults to "Packed".
SchedulingStrategy scheduling = 5;
enum SchedulingStrategy {
Packed = 0;
Distributed = 1;
}
// Deprecated: Please use metadata instead. This field is ignored if the
// metadata field is set
MetaPatch metaPatch = 6;
// Metadata is optional custom metadata that is added to the game server at
// allocation. You can use this to tell the server necessary session data
MetaPatch metadata = 7;
// Ordered list of GameServer label selectors.
// 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.
// Note: This field can only be set if neither Required or Preferred is set.
repeated GameServerSelector gameServerSelectors = 8;
// (Alpha, CountsAndLists feature flag) The first Priority on the array of Priorities is the most
// important for sorting. The allocator will use the first priority for sorting GameServers in the
// Selector set, and will only use any following priority for tie-breaking during sort.
// Impacts which GameServer is checked first.
repeated Priority priorities = 9;
}
message AllocationResponse {
string gameServerName = 2;
repeated GameServerStatusPort ports = 3;
string address = 4;
string nodeName = 5;
string source = 6;
// The gameserver port info that is allocated.
message GameServerStatusPort {
string name = 1;
int32 port = 2;
}
}
// Specifies settings for multi-cluster allocation.
message MultiClusterSetting {
// If set to true, multi-cluster allocation is enabled.
bool enabled = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {format: "boolean"}];
// Selects multi-cluster allocation policies to apply. If not specified, all multi-cluster allocation policies are to be applied.
LabelSelector policySelector = 2;
}
// MetaPatch is the metadata used to patch the GameServer metadata on allocation
message MetaPatch {
map<string, string> labels = 1;
map<string, string> annotations = 2;
}
// LabelSelector used for finding a GameServer with matching labels.
message LabelSelector {
// Labels to match.
map<string, string> matchLabels = 1;
}
// GameServerSelector used for finding a GameServer with matching filters.
message GameServerSelector {
// Labels to match.
map<string, string> matchLabels = 1;
enum GameServerState {
READY = 0;
ALLOCATED = 1;
};
GameServerState gameServerState = 2;
PlayerSelector players = 3;
map<string, CounterSelector> counters = 4;
map<string, ListSelector> lists = 5;
}
// PlayerSelector is filter for player capacity values.
// minAvailable should always be less or equal to maxAvailable.
message PlayerSelector {
uint64 minAvailable = 1;
uint64 maxAvailable = 2;
}
// CounterSelector is the filter options for a GameServer based on the count and/or available capacity.
// 0 for MaxCount or MaxAvailable means unlimited maximum. Default for all fields: 0
message CounterSelector {
int64 minCount = 1;
int64 maxCount = 2;
int64 minAvailable = 3;
int64 maxAvailable = 4;
}
// ListSelector is the filter options for a GameServer based on List available capacity and/or the
// existence of a value in a List.
// 0 for MaxAvailable means unlimited maximum. Default for integer fields: 0
// "" for ContainsValue means ignore field. Default for string field: ""
message ListSelector {
string containsValue = 1;
int64 minAvailable = 2;
int64 maxAvailable = 3;
}
// Priority is a sorting option for GameServers with Counters or Lists based on the count or
// number of items in a List.
// PriorityType: 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: Sort by "Ascending" or "Descending". Default is "Descending" so bigger count is preferred.
// "Ascending" would be smaller count is preferred.
message Priority {
string priorityType = 1;
string key = 2;
string order = 3;
}