---
# ClusterIP service — consumed by Nginx reverse-proxy inside the cluster.
apiVersion: v1
kind: Service
metadata:
  name: tankwar-server
  namespace: tankwar
  labels:
    app: tankwar-server
spec:
  type: ClusterIP
  selector:
    app: tankwar-server
  ports:
    - name: ws
      port: 3000
      targetPort: 3000
      protocol: TCP
  # Sticky sessions keep a given client pinned to the same pod while
  # the (future) multi-replica version is considered.
  sessionAffinity: ClientIP
  sessionAffinityConfig:
    clientIP:
      timeoutSeconds: 10800
---
# NodePort service — exposes the WebSocket server directly on every node
# at port 30081, so the public domain can be pointed here once DNS resolves.
apiVersion: v1
kind: Service
metadata:
  name: tankwar-server-nodeport
  namespace: tankwar
  labels:
    app: tankwar-server
spec:
  type: NodePort
  selector:
    app: tankwar-server
  ports:
    - name: ws
      port: 3000
      targetPort: 3000
      nodePort: 30081
      protocol: TCP
  sessionAffinity: ClientIP
  sessionAffinityConfig:
    clientIP:
      timeoutSeconds: 10800
