-
Notifications
You must be signed in to change notification settings - Fork 898
AGONES_SDK_GRPC_PORT and AGONES_SDK_HTTP_PORT should also be populated for init containers #4241
Copy link
Copy link
Closed
Labels
awaiting-maintainerBlock issues from being stale/obsolete/closedBlock issues from being stale/obsolete/closedgood first issueThese are great first issues. If you are looking for a place to start, start here!These are great first issues. If you are looking for a place to start, start here!help wantedWe would love help on these issues. Please come help us!We would love help on these issues. Please come help us!kind/bugThese are bugs.These are bugs.
Description
What happened:
The environment variables AGONES_SDK_GRPC_PORT and AGONES_SDK_HTTP_PORT are not being injected into init containers of GameServer pods. These variables are correctly populated for the main game server container but are missing from any init containers defined in the GameServer specification.
What you expected to happen:
Both AGONES_SDK_GRPC_PORT and AGONES_SDK_HTTP_PORT environment variables should be automatically injected into all containers within the GameServer pod, including init containers. This would allow init containers to interact with the Agones SDK during the initialization phase, enabling use cases such as:
- Pre-game configuration validation via SDK
- Health check setup before main container starts
- Game state initialization that requires SDK communication
How to reproduce it (as minimally and precisely as possible):
- Create a GameServer with an init container:
apiVersion: agones.dev/v1
kind: GameServer
metadata:
name: test-gameserver
spec:
ports:
- name: default
containerPort: 7654
template:
spec:
initContainers:
- name: init-container
image: alpine:latest
command: ["/bin/sh", "-c"]
args:
- |
echo "AGONES_SDK_GRPC_PORT: $AGONES_SDK_GRPC_PORT"
echo "AGONES_SDK_HTTP_PORT: $AGONES_SDK_HTTP_PORT"
env | grep AGONES
containers:
- name: simple-game-server
image: us-docker.pkg.dev/agones-images/examples/simple-game-server:latest- Apply the GameServer:
kubectl apply -f gameserver.yaml - Check init container logs:
kubectl logs <pod-name> -c init-container - Observe that AGONES_SDK_GRPC_PORT and AGONES_SDK_HTTP_PORT are empty or not present
- Compare with main container:
kubectl exec <pod-name> -c simple-game-server -- env | grep AGONES - Notice that the main container has these variables properly set
Anything else we need to know?:
- This issue prevents init containers from using the Agones SDK client libraries
- Workaround currently requires hardcoding the default ports (9357 for gRPC, 9358 for HTTP) in init containers
- The SDK sidecar is running and accessible during init container execution, but without the port environment variables, SDK clients cannot automatically connect
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
awaiting-maintainerBlock issues from being stale/obsolete/closedBlock issues from being stale/obsolete/closedgood first issueThese are great first issues. If you are looking for a place to start, start here!These are great first issues. If you are looking for a place to start, start here!help wantedWe would love help on these issues. Please come help us!We would love help on these issues. Please come help us!kind/bugThese are bugs.These are bugs.