Skip to content

Commit

Permalink
Return last result even if all multicluster allocations fail
Browse files Browse the repository at this point in the history
Fixes googleforgames#2011

This resolves an edge case where if all connections in a multicluster
allocation failed, the allocation would return (nil, nil) and cause
protobuf to fail to serialize the response. Instead, the last result
(even if it was unsuccessful!) is returned. An example of this is if
all clusters being fully allocated.
  • Loading branch information
highlyunavailable committed Feb 27, 2021
1 parent bf6e6c3 commit b038200
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/gameserverallocations/allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ func (c *Allocator) applyMultiClusterAllocation(ctx context.Context, gsa *alloca
return result, nil
}
}
return nil, err
return result, err
}

// allocateFromRemoteCluster allocates gameservers from a remote cluster by making
Expand Down
8 changes: 5 additions & 3 deletions site/content/en/docs/Advanced/multi-cluster-allocation.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ spec:
EOF
```

To define the local cluster priority, similarly, an allocation rule should be defined, while leaving allocationEndpoints unset. If the local cluster priority is not defined, the allocation from the local cluster happens only if allocation from other clusters with the existing allocation rules is unsuccessful.
To define the local cluster priority an allocation rule should be defined _without_ an `allocationEndpoints` field. If the local cluster priority is not defined, the allocation from the local cluster happens only if allocation from other clusters with the existing allocation rules is unsuccessful. A local cluster priority must be defined if using multi-cluster in only a single cluster (e.g. in development).

`serverCa` is the server TLS CA public certificate, set only if the remote server certificate is not signed by a public CA (e.g. self-signed). If this field is not specified, the certificate can also be specified in the `ca.crt` field of the client secret (i.e. the secret referred to in the `secretName` field).
The `namespace` field in `connectionInfo` is the namespace that the game servers will be allocated in, and must be a namespace in the target cluster that has been previously defined as allowed to host game servers. The `Namespace` specified in the allocation request (below) is used to refer to the namespace that the GameServerAllocationPolicy itself is located in.

`serverCa` is the server TLS CA public certificate, set only if the remote server certificate is not signed by a public CA (e.g. self-signed). If this field is not specified, the certificate can also be specified in a field named `ca.crt` of the client secret (the secret referred to in the `secretName` field).

## Establish trust

Expand Down Expand Up @@ -122,7 +124,7 @@ If using REST use
```bash
#!/bin/bash

curl --key ${KEY_FILE} --cert ${CERT_FILE} --cacert ${TLS_CA_FILE} -H "Content-Type: application/json" --data '{"namespace":"'${NAMESPACE}'", "multi_cluster_settings":{"enabled":"true"}}' https://${EXTERNAL_IP}/gameserverallocation -XPOST
curl --key ${KEY_FILE} --cert ${CERT_FILE} --cacert ${TLS_CA_FILE} -H "Content-Type: application/json" --data '{"namespace":"'${NAMESPACE}'", "multiClusterSetting":{"enabled":"true"}}' https://${EXTERNAL_IP}/gameserverallocation -XPOST
```

## Troubleshooting
Expand Down

0 comments on commit b038200

Please sign in to comment.