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

Error executing simple gameserver tutorial (node.js) #1562

Closed
fooock opened this issue May 15, 2020 · 2 comments
Closed

Error executing simple gameserver tutorial (node.js) #1562

fooock opened this issue May 15, 2020 · 2 comments
Labels
good first issue These are great first issues. If you are looking for a place to start, start here! help wanted We would love help on these issues. Please come help us! kind/bug These are bugs. kind/documentation Documentation for Agones
Milestone

Comments

@fooock
Copy link
Contributor

fooock commented May 15, 2020

What happened:

Trying to test the simple gameserver tutorial:

$ kubectl create -f https://raw.githubusercontent.com/googleforgames/agones/release-1.5.0/examples/nodejs-simple/gameserver.yaml
gameserver.agones.dev/nodejs-simple-7tzq5 created

Now I try to retrieve GAMESERVER_NAME:

$ GAMESERVER_NAME=$(kubectl get gs -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
Error from server (NotFound): gameservers.agones.dev ".items}}{{.metadata.name}}{{\"\\n\"}}{{end}}" not found

What you expected to happen:

Command GAMESERVER_NAME=$(kubectl get gs -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}') finishes successfully.

How to reproduce it (as minimally and precisely as possible):

Follow steps from this tutorial

Anything else we need to know?:

Running in WSL.

Environment:

  • Agones version: Master branch (commit d46cba80156e86002b4097856702378c97bbfef6)
  • Kubernetes version (use kubectl version):
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.0", GitCommit:"9e991415386e4cf155a24b1da15becaa390438d8", GitTreeState:"clean", Bui
ldDate:"2020-03-25T14:58:59Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.10", GitCommit:"1bea6c00a7055edef03f1d4bb58b773fa8917f11", GitTreeState:"clean", Bu
ildDate:"2020-02-11T20:05:26Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"}
  • Cloud provider or hardware configuration: Minikube
  • Install method (yaml/helm): yaml
  • Troubleshooting guide log(s):
  • Others:

The example works as expected if no using the failing step.
Maybe tutorials in Rust and C++ also fails (don't tested)

@fooock fooock added the kind/bug These are bugs. label May 15, 2020
@markmandel markmandel added kind/documentation Documentation for Agones good first issue These are great first issues. If you are looking for a place to start, start here! help wanted We would love help on these issues. Please come help us! labels May 15, 2020
@yeslayla
Copy link
Contributor

As of release, 1.10.0, I was able to run this without issue. My testing environment was minikube on WSL.

jmanley@windows:/mnt/c/Users/jmanley/Projects$ kubectl get gs
No resources found in default namespace.
jmanley@windows:/mnt/c/Users/jmanley/Projects$ kubectl create -f https://raw.githubusercontent.com/googleforgames/agones/release-1.10.0/examples/nodejs-simple/gameserver.yaml
gameserver.agones.dev/nodejs-simple-krxgm created
jmanley@windows:/mnt/c/Users/jmanley/Projects$ kubectl get gs
NAME                  STATE       ADDRESS        PORT   NODE             AGE
nodejs-simple-krxgm   Scheduled   192.168.65.3   7117   docker-desktop   3s
jmanley@windows:/mnt/c/Users/jmanley/Projects$ GAMESERVER_NAME=$(kubectl get gs -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
jmanley@windows:/mnt/c/Users/jmanley/Projects$ echo $GAMESERVER_NAME
nodejs-simple-krxgm
jmanley@windows:/mnt/c/Users/jmanley/Projects$ kubectl logs ${GAMESERVER_NAME} nodejs-simple -f

> @ start /home/server/examples/nodejs-simple
> node src/index.js

Connecting to the SDK server...
...connected to SDK server
Running for 10 seconds
Setting a label
GameServer Update:
        name: nodejs-simple-krxgm
        state: Scheduled
        labels: agones.dev/sdk-test-label,test-value
        annotations: agones.dev/sdk-version,1.10.0
^C
jmanley@windows:/mnt/c/Users/jmanley/Projects$ kubectl logs ${GAMESERVER_NAME} nodejs-simple -f

> @ start /home/server/examples/nodejs-simple
> node src/index.js

Connecting to the SDK server...
...connected to SDK server
Running for 10 seconds
Setting a label
GameServer Update:
        name: nodejs-simple-krxgm
        state: Scheduled
        labels: agones.dev/sdk-test-label,test-value
        annotations: agones.dev/sdk-version,1.10.0
Running for 20 seconds
Health ping sent
Setting an annotation
GameServer Update:
        name: nodejs-simple-krxgm
        state: Scheduled
        labels: agones.dev/sdk-test-label,test-value
        annotations: agones.dev/sdk-test-annotation,test value & agones.dev/sdk-version,1.10.0

After 120 seconds, the server does shutdown which could cause the return to be null.

jmanley@windows:/mnt/c/Users/jmanley/Projects$ GAMESERVER_NAME=$(kubectl get gs -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
jmanley@windows:/mnt/c/Users/jmanley/Projects$ echo $GAMESERVER_NAME

I also tested this with release 1.5.0 of the template.

jmanley@windows:/mnt/c/Users/jmanley/Projects$ kubectl create -f https://raw.githubusercontent.com/googleforgames/agones/release-1.5.0/examples/nodejs-simple/gameserver.yaml
gameserver.agones.dev/nodejs-simple-c9dnb created

jmanley@windows:/mnt/c/Users/jmanley/Projects$ GAMESERVER_NAME=$(kubectl get gs -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')

jmanley@windows:/mnt/c/Users/jmanley/Projects$ echo $GAMESERVER_NAME
nodejs-simple-c9dnb

This was all done in a bash terminal.


If anyone past, present, or future is having issues, it's possible your terminal might be trying to parse the template before the server can do so.

I was able to run that command properly with bash.

jmanley@windows:/mnt/c/Users/jmanley/Projects$ bash --version
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)

An alternative command for the same result with jsonpath would be:

GAMESERVER_NAME=$(kubectl get gs -o jsonpath='{.items[0].metadata.name}')`

@markmandel
Copy link
Member

Thanks for testing this! I will close this issue then!

@markmandel markmandel added this to the 1.12.0 milestone Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue These are great first issues. If you are looking for a place to start, start here! help wanted We would love help on these issues. Please come help us! kind/bug These are bugs. kind/documentation Documentation for Agones
Projects
None yet
Development

No branches or pull requests

3 participants