Skip to content

Commit 4148019

Browse files
authored
Open Match Services: Cleanup and Updates (#261)
* Updated dependencies for Open Match Director * Updated deprecated API calls on Open Match Director. * Remove fake-frontend as nobody was using it, and its dependencies where getting out of date * Update dependencies for the Match Function * Update deprecated APIs for the Match function.
1 parent a0bec03 commit 4148019

File tree

17 files changed

+80
-375
lines changed

17 files changed

+80
-375
lines changed

services/cloudbuild.yaml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ steps:
4444
args: [ "build", ".", "-t", "${_OPEN_MATCH_MATCHFUNCTION_IMAGE}" ]
4545
dir: open-match/matchfunction
4646
waitFor: [ '-' ]
47-
- name: gcr.io/cloud-builders/docker
48-
id: open-match-fake-frontend
49-
args: [ "build", ".", "-t", "${_OPEN_MATCH_FAKE_FRONTEND_IMAGE}" ]
50-
dir: open-match/fake-frontend
51-
waitFor: [ '-' ]
5247

5348
#
5449
# Deployment
@@ -61,7 +56,7 @@ steps:
6156
--annotations=cloud_build=https://console.cloud.google.com/cloud-build/builds/$BUILD_ID \
6257
--delivery-pipeline global-game-services \
6358
--skaffold-file skaffold.yaml \
64-
--images ping-discovery=$_PING_IMAGE,profile=$_PROFILE_IMAGE,frontend=$_FRONTEND_IMAGE,open-match-director=$_OPEN_MATCH_DIRECTOR_IMAGE,open-match-matchfunction=$_OPEN_MATCH_MATCHFUNCTION_IMAGE,open-match-fake-frontend=$_OPEN_MATCH_FAKE_FRONTEND_IMAGE \
59+
--images ping-discovery=$_PING_IMAGE,profile=$_PROFILE_IMAGE,frontend=$_FRONTEND_IMAGE,open-match-director=$_OPEN_MATCH_DIRECTOR_IMAGE,open-match-matchfunction=$_OPEN_MATCH_MATCHFUNCTION_IMAGE \
6560
--region us-central1
6661
automapSubstitutions: true
6762

@@ -72,14 +67,12 @@ artifacts:
7267
- ${_REGISTRY}/frontend
7368
- ${_REGISTRY}/open-match-director
7469
- ${_REGISTRY}/open-match-matchfunction
75-
- ${_REGISTRY}/open-match-fake-frontend
7670
substitutions:
7771
_PING_IMAGE: ${_REGISTRY}/ping-discovery:${BUILD_ID}
7872
_PROFILE_IMAGE: ${_REGISTRY}/profile:${BUILD_ID}
7973
_FRONTEND_IMAGE: ${_REGISTRY}/frontend:${BUILD_ID}
8074
_OPEN_MATCH_DIRECTOR_IMAGE: ${_REGISTRY}/open-match-director:${BUILD_ID}
8175
_OPEN_MATCH_MATCHFUNCTION_IMAGE: ${_REGISTRY}/open-match-matchfunction:${BUILD_ID}
82-
_OPEN_MATCH_FAKE_FRONTEND_IMAGE: ${_REGISTRY}/open-match-fake-frontend:${BUILD_ID}
8376
_REGISTRY: us-docker.pkg.dev/${PROJECT_ID}/global-game-images
8477
options:
8578
dynamic_substitutions: true

services/open-match/README.md

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,6 @@ given set of match player's latencies.
3030
It does this by providing the `region` HTTP header to an Anthos Service Mesh Allocation Service - where the `region`
3131
header will route the allocation request to one of the Agones GKE clusters in that region.
3232

33-
## Fake Frontend
34-
35-
The `openmatch-fake-frontend` deployment generates fake tickets for testing of the Open Match services
36-
in thie directory. When enabled, the fake frontend will generate a batch of tickets every period. For
37-
each ticket, the fake frontend waits on an Open Match assignment and then deletes the ticket.
38-
39-
Note that if the Director is tied to a real Agones Fleet, this will generate arbitrary game server
40-
allocations. You may want to use a game server binary that exits after a specific period of time,
41-
otherwise, when enabled, the fake frontend will continue to allocate game servers.
42-
43-
The fake frontend is always deployed, but does nothing unless configured:
44-
45-
```shell
46-
# Edit the `period` and `tickets_per_period` to what you want, e.g. "20s" and "20"
47-
# The fake frontend will generate `tickets_per_period` tickets every `period`, where
48-
# period is expressed as a Go Duration (e.g. "20s", "1m", etc.)
49-
kubectl edit configmap/open-match-fake-frontend
50-
51-
# Restart the deployment to pick up the config
52-
kubectl rollout restart deployment/open-match-fake-frontend
53-
54-
# Verify load has started
55-
kubectl logs deployment/open-match-fake-frontend
56-
```
57-
5833
## Credit
5934

6035
This integration is based on the [Open Match Matchmaker 101 tutorial](https://open-match.dev/site/docs/tutorials/matchmaker101/frontend/) [(source)](https://github.com/googleforgames/open-match/tree/release-1.7/tutorials).

services/open-match/director/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616

17-
FROM golang:1.19 as build
17+
FROM golang:1.21 as build
1818

1919
WORKDIR /go/src/director
2020
COPY . .
Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
module github.com/googleforgames/global-multiplayer-demo/services/open-match/director
22

3-
go 1.19
3+
go 1.21
4+
5+
toolchain go1.21.9
46

57
require (
6-
golang.org/x/oauth2 v0.4.0
7-
google.golang.org/grpc v1.53.0
8-
open-match.dev/open-match v1.7.0
8+
golang.org/x/oauth2 v0.20.0
9+
google.golang.org/grpc v1.64.0
10+
open-match.dev/open-match v1.8.1
911
)
1012

1113
require (
12-
github.com/golang/protobuf v1.5.2 // indirect
13-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0 // indirect
14-
golang.org/x/net v0.17.0 // indirect
15-
golang.org/x/sys v0.13.0 // indirect
16-
golang.org/x/text v0.13.0 // indirect
17-
google.golang.org/appengine v1.6.7 // indirect
18-
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
19-
google.golang.org/protobuf v1.28.1 // indirect
14+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
15+
golang.org/x/net v0.25.0 // indirect
16+
golang.org/x/sys v0.20.0 // indirect
17+
golang.org/x/text v0.15.0 // indirect
18+
google.golang.org/genproto/googleapis/api v0.0.0-20240521202816-d264139d666e // indirect
19+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240521202816-d264139d666e // indirect
20+
google.golang.org/protobuf v1.34.1 // indirect
2021
)
Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,22 @@
1-
github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ=
2-
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
3-
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
4-
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
5-
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
6-
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
7-
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
8-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0 h1:1JYBfzqrWPcCclBwxFCPAou9n+q86mfnu7NAeHfte7A=
9-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0/go.mod h1:YDZoGHuwE+ov0c8smSH49WLF3F2LaWnYYuDVd+EWrc0=
10-
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
11-
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
12-
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
13-
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
14-
golang.org/x/oauth2 v0.4.0 h1:NF0gk8LVPg1Ml7SSbGyySuoxdsXitj7TvgvuRxIMc/M=
15-
golang.org/x/oauth2 v0.4.0/go.mod h1:RznEsdpjGAINPTOF0UH/t+xJ75L18YO3Ho6Pyn+uRec=
16-
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
17-
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
18-
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
19-
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
20-
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
21-
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
22-
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
23-
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
24-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
25-
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
26-
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
27-
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w=
28-
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM=
29-
google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc=
30-
google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw=
31-
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
32-
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
33-
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
34-
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
35-
open-match.dev/open-match v1.7.0 h1:EzPPzsMy92i52XNrRWx3KMXIcNzdgHwMd01KsoT7HaI=
36-
open-match.dev/open-match v1.7.0/go.mod h1:JAkoEIVgc8p6GnfpxOC5Aqby2vkQDHrjlCbI2crP3WU=
1+
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
2+
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
3+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0=
4+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k=
5+
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
6+
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
7+
golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo=
8+
golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
9+
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
10+
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
11+
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
12+
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
13+
google.golang.org/genproto/googleapis/api v0.0.0-20240521202816-d264139d666e h1:SkdGTrROJl2jRGT/Fxv5QUf9jtdKCQh4KQJXbXVLAi0=
14+
google.golang.org/genproto/googleapis/api v0.0.0-20240521202816-d264139d666e/go.mod h1:LweJcLbyVij6rCex8YunD8DYR5VDonap/jYl3ZRxcIU=
15+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240521202816-d264139d666e h1:Elxv5MwEkCI9f5SkoL6afed6NTdxaGoAo39eANBwHL8=
16+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240521202816-d264139d666e/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
17+
google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY=
18+
google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg=
19+
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
20+
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
21+
open-match.dev/open-match v1.8.1 h1:Tp5fxeUVBugt091zFxMJim6TalE9sFDB2mNGw5zRWQQ=
22+
open-match.dev/open-match v1.8.1/go.mod h1:FjKE1hS+BGFMxVUQvPLqXWMUjjFysYrPESdEfEpDxvM=

services/open-match/director/main.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package main
1616

1717
import (
1818
"context"
19+
"errors"
1920
"fmt"
2021
"io"
2122
"log"
@@ -24,6 +25,7 @@ import (
2425

2526
allocation "github.com/googleforgames/global-multiplayer-demo/services/open-match/director/agones/swagger"
2627
"google.golang.org/grpc"
28+
"google.golang.org/grpc/credentials/insecure"
2729
"open-match.dev/open-match/pkg/pb"
2830
)
2931

@@ -52,7 +54,7 @@ func main() {
5254
ctx := context.Background()
5355

5456
// Connect to Open Match Backend.
55-
conn, err := grpc.Dial(omBackendEndpoint, grpc.WithInsecure())
57+
conn, err := grpc.NewClient(omBackendEndpoint, grpc.WithTransportCredentials(insecure.NewCredentials()))
5658
if err != nil {
5759
log.Fatalf("Failed to connect to Open Match Backend, got %s", err.Error())
5860
}
@@ -137,10 +139,9 @@ func fetch(be pb.BackendServiceClient, p *pb.MatchProfile) ([]*pb.Match, error)
137139
func assignMatch(ctx context.Context, be pb.BackendServiceClient, aas *allocation.APIClient, match *pb.Match) {
138140
aar, _, err := aas.AllocationServiceApi.Allocate(ctx, allocation.AllocationAllocationRequest{Namespace: gameNamespace})
139141
if err != nil {
140-
if swErr, ok := err.(allocation.GenericSwaggerError); ok {
142+
var swErr allocation.GenericSwaggerError
143+
if errors.As(err, &swErr) {
141144
log.Printf("Could not allocate game server from Agones for match %s: %s: %s", match.GetMatchId(), swErr.Error(), swErr.Body())
142-
} else {
143-
log.Printf("Could not allocate game server from Agones for match %s (generic error): %v", match.GetMatchId(), err)
144145
}
145146
return
146147
}
@@ -160,7 +161,7 @@ func assignMatch(ctx context.Context, be pb.BackendServiceClient, aas *allocatio
160161
}
161162

162163
func assignConnToTickets(be pb.BackendServiceClient, conn string, tickets []*pb.Ticket) error {
163-
ticketIDs := []string{}
164+
var ticketIDs []string
164165
for _, t := range tickets {
165166
ticketIDs = append(ticketIDs, t.Id)
166167
}

services/open-match/fake-frontend/Dockerfile

Lines changed: 0 additions & 32 deletions
This file was deleted.

services/open-match/fake-frontend/fake-frontend.yaml

Lines changed: 0 additions & 52 deletions
This file was deleted.

services/open-match/fake-frontend/go.mod

Lines changed: 0 additions & 18 deletions
This file was deleted.

services/open-match/fake-frontend/go.sum

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)