feat: deploy Wings instance for ARK SA #94

Closed
gitea-admin wants to merge 6 commits from orion/auto/feat-deploy-wings-instance-for-ark-sa-1779149758378 into main
5 changed files with 89 additions and 108 deletions
@@ -21,101 +21,95 @@ spec:
spec: spec:
nodeSelector: nodeSelector:
kubernetes.io/arch: amd64 kubernetes.io/arch: amd64
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: game
operator: In
values: [ark-sa]
topologyKey: "kubernetes.io/hostname"
volumes:
- name: wings-config
secret:
secretName: wings-ark-sa-config
- name: game-data
persistentVolumeClaim:
claimName: wings-ark-sa-data
- name: docker-socket
emptyDir: {}
- name: autostart-token
secret:
secretName: pelican-autostart-key
containers: containers:
- name: dind - name: dind
image: docker:dind image: docker:24-dind
args:
- "--storage-driver=vfs"
- "--iptables=false"
securityContext: securityContext:
privileged: true privileged: true
volumeMounts:
- name: docker-socket
mountPath: /var/run/docker.sock
env: env:
- name: DOCKER_TLS_CERTDIR - name: DOCKER_TLS_CERTDIR
value: "" value: ""
resources: resources:
requests: requests:
cpu: "500m" cpu: "500m"
memory: "512Mi" memory: "1Gi"
limits: limits:
cpu: "1" cpu: "1"
memory: "1Gi" memory: "2Gi"
- name: wings - name: wings
image: ghcr.io/pelican-dev/wings:latest image: ghcr.io/pelican-dev/wings:latest
command:
- /bin/sh
- -c
- |
export DOCKER_HOST=tcp://localhost:2375
exec wings
envFrom:
- secretRef:
name: wings-ark-sa-config
env: env:
- name: DOCKER_HOST - name: DOCKER_HOST
value: tcp://localhost:2375 value: tcp://localhost:2375
- name: WATCHDOG_ENABLED - name: WINGS_Umask
value: "true" value: "0002"
volumeMounts: - name: GRPC_PORT
- name: wings-config value: "50051"
mountPath: /etc/pterodactyl - name: WINGS_API_LISTEN
readOnly: true value: "0.0.0.0:8081"
- name: game-data - name: WINGS_SFTP_LISTEN
mountPath: /mnt/server value: "0.0.0.0:2023"
- name: docker-socket - name: WINGS_SERVER_UUID
mountPath: /var/run/docker.sock valueFrom:
secretKeyRef:
name: wings-ark-sa-config
key: server_uuid
- name: WINGS_API_KEY
valueFrom:
secretKeyRef:
name: wings-ark-sa-config
key: api_key
envFrom:
- secretRef:
name: wings-ark-sa-config
ports:
- containerPort: 8081
- containerPort: 2023
resources: resources:
requests: requests:
cpu: "2" cpu: "2"
memory: "4Gi" memory: "8Gi"
limits: limits:
cpu: "4" cpu: "4"
memory: "8Gi" memory: "16Gi"
volumeMounts:
- name: data
mountPath: /home/container
- name: game-autostart - name: game-autostart
image: curlimages/curl:latest image: curlimages/curl:latest
command: command: ["/bin/sh", "-c"]
- /bin/sh args:
- -c
- | - |
while true; do while true; do
sleep 60 WINGS_READY=false
curl -sf -X POST "https://pelican.khalisio.com/api/client/servers/3fd0b08d-7393-4d0f-b11c-bad5e1d1f771/power" \ while [ "$WINGS_READY" = "false" ]; do
-H "Authorization: Bearer $(cat /etc/secrets/autostart/api_key)" \ if curl -sf http://localhost:8081/health > /dev/null 2>&1; then
WINGS_READY=true
echo "Wings is ready, sending start signal..."
sleep 30
curl -sf -X POST \
-H "Authorization: Bearer $PELICAN_API_KEY" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{"signal":"start"}' > /dev/null 2>&1 || true -d '{"signal":"start"}' \
https://pelican.khalisio.com/api/client/servers/3fd0b08d-7393-4d0f-b11c-bad5e1d1f771/power || echo "Start signal failed, retrying..."
break
fi
echo "Waiting for Wings to be ready..."
sleep 5
done done
volumeMounts: sleep 60
- name: autostart-token done
mountPath: /etc/secrets/autostart envFrom:
readOnly: true - secretRef:
name: pelican-autostart-key
resources: resources:
requests: requests:
cpu: "50m"
memory: "64Mi"
limits:
cpu: "100m" cpu: "100m"
memory: "128Mi" memory: "256Mi"
restartPolicy: Always limits:
cpu: "500m"
memory: "512Mi"
volumes:
- name: data
persistentVolumeClaim:
claimName: wings-ark-sa-data
@@ -6,21 +6,18 @@ metadata:
spec: spec:
refreshInterval: 1h refreshInterval: 1h
secretStoreRef: secretStoreRef:
name: vault name: vault-secret-store
kind: ClusterSecretStore kind: ClusterSecretStore
target: target:
name: wings-ark-sa-config name: wings-ark-sa-config
creationPolicy: Owner template:
engineVersion: v2
data: data:
- secretKey: WINGS_UUID - secretKey: config
remoteRef: remoteRef:
key: wings/ark-sa key: secret/data/Talos Cluster/wings/ark-sa
property: uuid property: config
- secretKey: WINGS_TOKEN - secretKey: api_key
remoteRef: remoteRef:
key: wings/ark-sa key: secret/data/Talos Cluster/wings/ark-sa
property: token property: api_key
- secretKey: LOCALE
remoteRef:
key: wings/ark-sa
property: locale
@@ -1,27 +1,17 @@
apiVersion: traefik.containo.us/v1alpha1 apiVersion: traefik.io/v1alpha1
kind: IngressRoute kind: IngressRoute
metadata: metadata:
name: wings-ark-sa-api name: wings-ark-sa
namespace: game-servers namespace: game-servers
spec: spec:
entryPoints: entryPoints:
- websecure - websecure
tls: tls:
secretName: wings-ark-sa-tls secretName: wings-ark-sa-tls
certResolver: letsencrypt
routes: routes:
- match: Host(`wings-ark-sa.khalisio.com`) - match: Host(`wings-ark-sa.khalisio.com`)
kind: Rule kind: Rule
services: services:
- name: wings-ark-sa-api - name: wings-ark-sa-api
port: 8081 port: 8081
scheme: https
serversTransport: wings-ark-sa-st
---
apiVersion: traefik.io/v1alpha1
kind: ServersTransport
metadata:
name: wings-ark-sa-st
namespace: game-servers
spec:
serverTransport:
insecureSkipVerify: true
@@ -5,6 +5,8 @@ metadata:
namespace: game-servers namespace: game-servers
spec: spec:
type: ClusterIP type: ClusterIP
selector:
app: wings-ark-sa
ports: ports:
- name: api - name: api
port: 8081 port: 8081
@@ -14,5 +16,3 @@ spec:
port: 2023 port: 2023
targetPort: 2023 targetPort: 2023
protocol: TCP protocol: TCP
selector:
app: wings-ark-sa
@@ -4,22 +4,22 @@ metadata:
name: wings-ark-sa-game name: wings-ark-sa-game
namespace: game-servers namespace: game-servers
annotations: annotations:
metallb.universe.tf/address-pool: default-lb-pool metallb.io/address-pool: "default"
spec: spec:
type: LoadBalancer type: LoadBalancer
loadBalancerIP: 10.4.4.200 loadBalancerIP: 10.4.4.200
ports:
- name: ark-game
port: 7777
protocol: UDP
targetPort: 7777
- name: ark-query
port: 27015
protocol: UDP
targetPort: 27015
- name: ark-tcp
port: 27016
protocol: TCP
targetPort: 27016
selector: selector:
app: wings-ark-sa app: wings-ark-sa
ports:
- name: udp
port: 7777
targetPort: 7777
protocol: UDP
- name: tcp
port: 7777
targetPort: 7777
protocol: TCP
- name: query
port: 27015
targetPort: 27015
protocol: UDP