-
Notifications
You must be signed in to change notification settings - Fork 820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GameServerAllocationPolicy with empty AllocationEndpoints errors on allocate #2011
Comments
Okay, this appears to be a PEBKAC on my part caused by somewhat unclear documentation around this feature and a need to have extra error checks. Here was the broken GSAP: apiVersion: multicluster.agones.dev/v1
kind: GameServerAllocationPolicy
metadata:
name: docker-desktop
namespace: default
spec:
connectionInfo:
clusterName: docker-desktop
namespace: agones-system
secretName: local-allocator
serverCa: [redacted]
priority: 1
weight: 100 Fixed by changing the connectionInfo namespace to "default". I figured it out when I noticed the code did this: if gsa.Namespace != connectionInfo.Namespace {
gsaCopy = gsa.DeepCopy()
gsaCopy.Namespace = connectionInfo.Namespace
} The connectionInfo.Namespace there must be a namespace you have configured to accept game server pods. That said: I still get the |
The clue is actually right here: agones-allocator-6d9b48f48b-cp6r6 agones-allocator {"error":null,"message":"allocation response is being sent","response":null,"severity":"info","source":"main","time":"2021-02-27T04:12:46.4578428Z"} It's most likely trying to marshal the response (which is nil! because it's actually an error!) to a response which obviously isn't gonna fly. |
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.
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.
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.
Fixes #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.
What happened:
Multi cluster allocation does not work with a local cluster policy defined.
Calling the allocator service with a GameServerAllocationPolicy that has a empty (nil, not present in yaml) set of
allocationEndpoints
causes the allocator service to fail with{"error":"Marshal called with nil","code":2,"message":"Marshal called with nil"}
.I also cannot set AllocationEndpoints to an empty array, as the CRD validation forces that to be a single item, and even if I edit the CRD to allow it, the same error occurs.
Additionally, the documentation for the REST example is incorrect: It says use
'{"namespace":"'${NAMESPACE}'", "multi_cluster_settings":{"enabled":"true"}}'
as the data, but the real JSON is'{"namespace":"'${NAMESPACE}'", "multiClusterSetting":{"enabled":"true"}}'
which does give the error as above, as does the Protobuf client inexamples/allocator-client
.What you expected to happen:
An empty (empty array) or missing (nil)
allocationEndpoints
should allocate to the local cluster.How to reproduce it (as minimally and precisely as possible):
Follow the documentation for multi-cluster allocation and make sure the
allocationEndpoints
value is missing in the GameServerAllocationPolicy. Also, when calling the endpoint, make sure to use the protobuf client or use the correctmultiClusterSetting
data above - both will repro the error.Anything else we need to know?:
I've taken a crack at fixing this but I can't figure out where it's attempting to marshal the nil (not really sure how to debug the path through the code - can I just
go run
this somehow?) and thus can't. Happy to fix this if someone points me in the right direction.Logs from the allocator service:
The "Could not find a Ready GameServer" error is spurious:
Environment:
kubectl version
): v1.19.3The text was updated successfully, but these errors were encountered: