agones
agones copied to clipboard
Custom gameserver configuration not working on containerized local SDK
What happened:
I have set up a dockerised SDK with a custom gameserver.yaml
manifest, as per the documentation here:
https://agones.dev/site/docs/guides/client-sdks/local/#running-local-mode-in-a-container
I'm using this command:
docker run --network=host --rm -v <path/to/my>/gameserver.yaml:/tmp/gameserver.yaml us-docker.pkg.dev/agones-images/release/agones-sdk:1.37.0 --local --feature-gates CountsAndLists=true -f /tmp/gameserver.yaml
Note that it's practically the command as suggested by the guide, with the addition of CountsAndLists
, which I'm trying to test.
My yaml includes the following lines:
lists: # lists are lists of values stored against this GameServer that can be added and deleted from. Keys must be declared at GameServer creation time.
players:
capacity: 50
values:
- player
test_list:
capacity: 1
values:
- test
# Pod template configuration
template:
# pod metadata. Name & Namespace is overwritten
metadata:
labels:
testkey: testvalue
The container runs, the volume works, and the template seems to be linked properly. In addition to that, changes to the yaml are reflected on the containerised app:
{"event":{"Name":"/tmp/gameserver.yaml","Op":2},"message":"File has been changed!","severity":"info","source":"*sdkserver.LocalSDKServer","time":"2024-02-02T16:30:17.960537803Z"}
{"filePath":"/tmp/gameserver.yaml","message":"Reading GameServer configuration","severity":"info","source":"*sdkserver.LocalSDKServer","time":"2024-02-02T16:30:17.960608813Z"}
{"message":"Gameserver update received","severity":"info","source":"*sdkserver.LocalSDKServer","time":"2024-02-02T16:30:17.960547375Z"}
{"message":"Sending watched GameServer!","severity":"info","source":"*sdkserver.LocalSDKServer","time":"2024-02-02T16:30:17.961887468Z"}
{"message":"Gameserver update received","severity":"info","source":"*sdkserver.LocalSDKServer","time":"2024-02-02T16:30:17.961935371Z"}
{"message":"Getting GameServer details","severity":"info","source":"*sdkserver.LocalSDKServer","time":"2024-02-02T16:30:25.366659685Z"}
However, when inspecting the gameserver, a different specification is returned:
curl -GET "http://localhost:9358/gameserver" -H "accept: application/json"
{"object_meta":{"name":"gds-example","namespace":"","uid":"","resource_version":"","generation":"0","creation_timestamp":"-62135596800","deletion_timestamp":"0","annotations":{},"labels":{}},"spec":{"health":{"disabled":false,"period_seconds":5,"failure_threshold":3,"initial_delay_seconds":5}},"status":{"state":"","address":"","addresses":[],"ports":[],"players":null,"counters":{"conformanceTestCounter":{"count":"1","capacity":"10"}},"lists":{"conformanceTestList":{"capacity":"100","values":["test0","test1","test2"]}}}}
What you expected to happen: The SDK container runs and any game server is created using my gameserver template. My custom lists and metadata are created and present in the server.
How to reproduce it (as minimally and precisely as possible):
- Create a valid
gameserver.yaml
with predefined lists and metadata. - Start the local SDK pointing to the relevant yaml
docker run --network=host --rm -v <path/to/my>/gameserver.yaml:/tmp/gameserver.yaml us-docker.pkg.dev/agones-images/release/agones-sdk:1.37.0 --local --feature-gates CountsAndLists=true -f /tmp/gameserver.yaml
- Obtain the gameserver details, find missing lists and metadata.
curl -GET "http://localhost:9358/gameserver" -H "accept: application/json"
Anything else we need to know?:
Environment:
- Agones version: 1.37
- Kubernetes version (use
kubectl version
): Most likely irrelevant for this issue, but v1.27.3 - Cloud provider or hardware configuration: Ubuntu Linux 22.04
- Install method (yaml/helm): Local SDK
- Troubleshooting guide log(s): -
- Others: -
Thanks for submitting this bug! I think there are three things we can fix here:
- [ ] Create some better docs here to let the end user know that only part of the
GameServer
configuration is exposed -- in this particular instance, what you will want to do is specify yourcounters
andlists
in thegameserver.status
field - which is where you will see it (so that will help you move forward for now). - [ ] Only add default
players
androoms
when a file isn't loaded (probably a part of thedefaultGs()
function) - [ ] May also need to set
GameServer.Status.Counts
andGameServer.Status.Lists
to empty maps on creation, just to ensure no nil pointer exceptions.
I think that will cover it!
Brilliant, thank you. I will try moving the relevant fields into gameserver.status
.
Can confirm that the suggested fix does it:
status:
lists: # lists are lists of values stored against this GameServer that can be added and deleted from. Keys must be declared at GameServer creation time.
players:
capacity: 50
values:
- player
test_list:
capacity: 1
values:
- test
Correctly retrieving my test list capacity and values now :tada: .
Awesome! Good pickup!
It took @igooch and I a minute to work out what was going on when we looked at the code!