Build playable Aeternalis foundation and GitOps deployment pipeline

This commit is contained in:
dingo
2026-09-05 12:52:51 -04:00
parent 93703b20bc
commit ff87b8a544
66 changed files with 6567 additions and 0 deletions
@@ -0,0 +1,28 @@
{{- if .Values.networkPolicy.enabled }}
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ .Release.Name }}-worlds
spec:
podSelector:
matchLabels: { app.kubernetes.io/name: aeternalis, app.kubernetes.io/instance: {{ .Release.Name | quote }} }
policyTypes: [Ingress, Egress]
ingress:
- from:
- namespaceSelector:
matchLabels: { kubernetes.io/metadata.name: {{ .Values.networkPolicy.ingressNamespace | quote }} }
ports: [{ protocol: TCP, port: 8080 }]
egress:
- to:
- namespaceSelector:
matchLabels: { kubernetes.io/metadata.name: {{ .Values.networkPolicy.dnsNamespace | quote }} }
ports: [{ protocol: UDP, port: 53 }, { protocol: TCP, port: 53 }]
{{- range .Values.networkPolicy.databaseCIDRs }}
- to: [{ ipBlock: { cidr: {{ . | quote }} } }]
ports: [{ protocol: TCP, port: 5432 }]
{{- end }}
{{- range .Values.networkPolicy.identityCIDRs }}
- to: [{ ipBlock: { cidr: {{ . | quote }} } }]
ports: [{ protocol: TCP, port: 443 }]
{{- end }}
{{- end }}
+83
View File
@@ -0,0 +1,83 @@
{{- $root := . -}}
{{- $directory := list -}}
{{- range .Values.worlds -}}
{{- $directory = append $directory (dict "id" .id "url" (printf "https://%s" .host)) -}}
{{- end -}}
{{- range .Values.worlds }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $root.Release.Name }}-{{ .id }}
labels: { app.kubernetes.io/name: aeternalis, app.kubernetes.io/instance: {{ $root.Release.Name | quote }}, aeternalis.world: {{ .id | quote }} }
spec:
replicas: 1
strategy: { type: Recreate }
revisionHistoryLimit: 3
selector:
matchLabels: { app.kubernetes.io/instance: {{ $root.Release.Name | quote }}, aeternalis.world: {{ .id | quote }} }
template:
metadata:
labels: { app.kubernetes.io/name: aeternalis, app.kubernetes.io/instance: {{ $root.Release.Name | quote }}, aeternalis.world: {{ .id | quote }} }
spec:
automountServiceAccountToken: false
terminationGracePeriodSeconds: 30
imagePullSecrets: {{ $root.Values.imagePullSecrets | toJson }}
securityContext:
runAsNonRoot: true
runAsUser: 65532
runAsGroup: 65532
seccompProfile: { type: RuntimeDefault }
containers:
- name: world
image: {{ if $root.Values.image.digest }}{{ printf "%s@%s" $root.Values.image.repository $root.Values.image.digest | quote }}{{ else }}{{ printf "%s:%s" $root.Values.image.repository $root.Values.image.tag | quote }}{{ end }}
imagePullPolicy: IfNotPresent
ports: [{ name: http, containerPort: 8080 }]
securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
capabilities: { drop: [ALL] }
env:
- { name: APP_ENV, value: production }
- { name: LISTEN_ADDR, value: "0.0.0.0:8080" }
- { name: WORLD_ID, value: {{ .id | quote }} }
- { name: WORLD_SEED, value: {{ .seed | quote }} }
- { name: PUBLIC_URL, value: {{ printf "https://%s" .host | quote }} }
- { name: WORLD_DIRECTORY, value: {{ $directory | toJson | quote }} }
envFrom:
- secretRef: { name: {{ $root.Values.existingSecret | quote }} }
resources: {{ $root.Values.resources | toJson }}
startupProbe: { httpGet: { path: /readyz, port: http }, periodSeconds: 5, failureThreshold: 24 }
readinessProbe: { httpGet: { path: /readyz, port: http }, periodSeconds: 3, failureThreshold: 2 }
livenessProbe: { httpGet: { path: /healthz, port: http }, periodSeconds: 10, failureThreshold: 3 }
---
apiVersion: v1
kind: Service
metadata:
name: {{ $root.Release.Name }}-{{ .id }}
spec:
selector: { app.kubernetes.io/instance: {{ $root.Release.Name | quote }}, aeternalis.world: {{ .id | quote }} }
ports: [{ name: http, port: 8080, targetPort: http }]
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $root.Release.Name }}-{{ .id }}
annotations:
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-body-size: "8k"
nginx.ingress.kubernetes.io/limit-rps: "10"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
ingressClassName: {{ $root.Values.ingress.className | quote }}
tls: [{ hosts: [{{ .host | quote }}], secretName: {{ $root.Values.ingress.tlsSecret | quote }} }]
rules:
- host: {{ .host | quote }}
http:
paths:
- path: /
pathType: Prefix
backend:
service: { name: {{ $root.Release.Name }}-{{ .id }}, port: { name: http } }
{{- end }}