Skip to content
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

Custom gameserver configuration not working on containerized local SDK #3630

Closed
DazEdword opened this issue Feb 2, 2024 · 4 comments · Fixed by #3660
Closed

Custom gameserver configuration not working on containerized local SDK #3630

DazEdword opened this issue Feb 2, 2024 · 4 comments · Fixed by #3660
Labels
kind/bug These are bugs.

Comments

@DazEdword
Copy link

DazEdword commented Feb 2, 2024

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: -
@DazEdword DazEdword added the kind/bug These are bugs. label Feb 2, 2024
@markmandel
Copy link
Member

markmandel commented Feb 6, 2024

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 your counters and lists in the gameserver.status field - which is where you will see it (so that will help you move forward for now).
  • Only add default players and rooms when a file isn't loaded (probably a part of the defaultGs() function)
  • May also need to set GameServer.Status.Counts and GameServer.Status.Lists to empty maps on creation, just to ensure no nil pointer exceptions.

I think that will cover it!

@DazEdword
Copy link
Author

DazEdword commented Feb 6, 2024

Brilliant, thank you. I will try moving the relevant fields into gameserver.status .

@DazEdword
Copy link
Author

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 🎉 .

@markmandel
Copy link
Member

Awesome! Good pickup!

It took @igooch and I a minute to work out what was going on when we looked at the code!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug These are bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants