Octops / gameserver-ingress-controller

Automatic Ingress configuration for Game Servers managed by Agones
https://octops.io
Apache License 2.0
68 stars 9 forks source link

websocket-routes annotation template not evaluated when generating Ingress #53

Closed aleroyer closed 1 year ago

aleroyer commented 1 year ago

While experimenting with websocket-routes annotation, I noticed that anything that doesn't match the example in documentation (so something different than /{{ .Name }}) do not work. It fallback to /<game server name> in the Ingress object.

I dig a bit in the code and noticed that this template doesn't seem to be used at all.

https://github.com/Octops/gameserver-ingress-controller/blob/431cdf2eb3c82c5bda5a479d1c5d2b746b885b1e/pkg/reconcilers/ingress_options.go#L192

Is it the expected behavior? Did I miss something?

danieloliveira079 commented 1 year ago

Hello @aleroyer tks for you message. It is the expected behaviour. The template is only used only to pass down to the service or ingress the desired annotation that is replaced by the {{ .Name }} value.

For example, lets say your service or ingress require an annotation that should be the name of the game server. In that case you should have a custom annotation that would look like this:

octops-projectcontour.io/websocket-routes: "/{{ .Name }}"

The final annotation present on the game server would be:

projectcontour.io/websocket-routes: "/octops-tl6hf-fnmgd" <<<<< Replaced by the game server name

The link to the code you mentioned is not responsible to use the information from the template. The template is used by this function https://github.com/Octops/gameserver-ingress-controller/blob/main/pkg/reconcilers/ingress_options.go#L17.

What kind of behaviour or what are you trying to do?

danieloliveira079 commented 1 year ago

Closing this now. Please reopen if you need any further help.