diff --git a/deployments/game-servers/wings-moria/deployment.yaml b/deployments/game-servers/wings-moria/deployment.yaml new file mode 100644 index 0000000..ff8f854 --- /dev/null +++ b/deployments/game-servers/wings-moria/deployment.yaml @@ -0,0 +1,118 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: wings-moria + namespace: game-servers + labels: + app.kubernetes.io/name: wings + app.kubernetes.io/component: game-server + app.kubernetes.io/part-of: pelican + game: moria +spec: + strategy: + type: Recreate + selector: + matchLabels: + app: wings-moria + template: + metadata: + labels: + app: wings-moria + game: moria + spec: + nodeSelector: + kubernetes.io/arch: amd64 + containers: + - name: wings + image: ghcr.io/pelican-dev/wings:latest + env: + - name: DOCKER_HOST + value: tcp://localhost:2375 + - name: WINGS_UID + value: "1000" + - name: WINGS_GID + value: "1000" + - name: WINGS_PORT + value: "8081" + - name: WINGS_API_SFTP_PORT + value: "2023" + - name: WINGS_SERVER_UUID + value: "8890d0d7-d409-4d87-99dd-f16e2adf3502" + envFrom: + - secretRef: + name: wings-moria-config + volumeMounts: + - name: docker-socket + mountPath: /var/run/docker.sock + - name: wings-data + mountPath: /var/lib/wings + - name: server-data + mountPath: /mnt/server + readinessProbe: + httpGet: + path: /ready + port: 8081 + initialDelaySeconds: 10 + periodSeconds: 10 + livenessProbe: + httpGet: + path: /health + port: 8081 + initialDelaySeconds: 15 + periodSeconds: 30 + - name: dind + image: docker:24-dind + securityContext: + privileged: true + env: + - name: DOCKER_TLS_CERTDIR + value: "" + volumeMounts: + - name: docker-socket + mountPath: /var/run + - name: dind-storage + mountPath: /var/lib/docker + readinessProbe: + exec: + command: + - sh + - -c + - '[ -S /var/run/docker.sock ]' + initialDelaySeconds: 5 + periodSeconds: 5 + - name: game-autostart + image: curlimages/curl:latest + env: + - name: PELICAN_API_KEY + valueFrom: + secretKeyRef: + name: pelican-autostart-key + key: api_key + - name: SERVER_UUID + value: "8890d0d7-d409-4d87-99dd-f16e2adf3502" + command: + - /bin/sh + - -c + - | + echo "Waiting for Wings API to be ready..." + while ! curl -sf http://localhost:8081/ready; do + sleep 2 + done + echo "Wings ready. Starting game server..." + while true; do + sleep 60 + echo "Checking game server status..." + done + volumeMounts: + - name: server-data + mountPath: /mnt/server + volumes: + - name: docker-socket + emptyDir: {} + - name: dind-storage + emptyDir: {} + - name: wings-data + emptyDir: {} + - name: server-data + persistentVolumeClaim: + claimName: wings-moria-data diff --git a/deployments/game-servers/wings-moria/externalsecret.yaml b/deployments/game-servers/wings-moria/externalsecret.yaml new file mode 100644 index 0000000..bbffd9c --- /dev/null +++ b/deployments/game-servers/wings-moria/externalsecret.yaml @@ -0,0 +1,22 @@ +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: wings-moria-config + namespace: game-servers +spec: + refreshInterval: 1h + secretStoreRef: + name: vault-secret-store + kind: ClusterSecretStore + target: + name: wings-moria-config + creationPolicy: Owner + data: + - secretKey: config + remoteRef: + key: Talos Cluster/wings/moria + property: config + - secretKey: api_key + remoteRef: + key: Talos Cluster/wings/moria + property: api_key diff --git a/deployments/game-servers/wings-moria/ingress.yaml b/deployments/game-servers/wings-moria/ingress.yaml new file mode 100644 index 0000000..cb1b511 --- /dev/null +++ b/deployments/game-servers/wings-moria/ingress.yaml @@ -0,0 +1,17 @@ +apiVersion: traefik.containo.us/v1alpha1 +kind: IngressRoute +metadata: + name: wings-moria-api + namespace: game-servers +spec: + entryPoints: + - websecure + tls: + secretName: wings-moria-tls + certResolver: letsencrypt + routes: + - match: Host(`wings-moria.khalisio.com`) + kind: Rule + services: + - name: wings-moria-api + port: 8081 diff --git a/deployments/game-servers/wings-moria/pvc.yaml b/deployments/game-servers/wings-moria/pvc.yaml new file mode 100644 index 0000000..6bf2361 --- /dev/null +++ b/deployments/game-servers/wings-moria/pvc.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: wings-moria-data + namespace: game-servers +spec: + accessModes: + - ReadWriteOnce + storageClassName: longhorn + resources: + requests: + storage: 30Gi diff --git a/deployments/game-servers/wings-moria/service-api.yaml b/deployments/game-servers/wings-moria/service-api.yaml new file mode 100644 index 0000000..1bb293b --- /dev/null +++ b/deployments/game-servers/wings-moria/service-api.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: wings-moria-api + namespace: game-servers +spec: + selector: + app: wings-moria + ports: + - name: api + port: 8081 + targetPort: 8081 + protocol: TCP + - name: sftp + port: 2023 + targetPort: 2023 + protocol: TCP diff --git a/deployments/game-servers/wings-moria/service-game.yaml b/deployments/game-servers/wings-moria/service-game.yaml new file mode 100644 index 0000000..ad5e09b --- /dev/null +++ b/deployments/game-servers/wings-moria/service-game.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + name: wings-moria-game + namespace: game-servers + annotations: + metallb.universe.tf/address-pool: default +spec: + type: LoadBalancer + loadBalancerIP: 10.4.4.206 + selector: + app: wings-moria + ports: + - name: game-udp + port: 27000 + targetPort: 27000 + protocol: UDP + - name: game-tcp + port: 27000 + targetPort: 27000 + protocol: TCP