apiVersion: apps/v1 kind: Deployment metadata: name: allocator namespace: cosmic-clash labels: app.kubernetes.io/name: allocator app.kubernetes.io/component: allocator spec: replicas: 2 strategy: type: RollingUpdate rollingUpdate: maxUnavailable: 0 maxSurge: 1 selector: matchLabels: app.kubernetes.io/name: allocator template: metadata: labels: app.kubernetes.io/name: allocator app.kubernetes.io/component: allocator spec: terminationGracePeriodSeconds: 10 serviceAccountName: allocator # This role calls Agones CRDs through the Kubernetes API. The client # rereads the short-lived projected token on every request. automountServiceAccountToken: true topologySpreadConstraints: - maxSkew: 1 topologyKey: topology.kubernetes.io/zone whenUnsatisfiable: ScheduleAnyway labelSelector: matchLabels: app.kubernetes.io/name: allocator affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 podAffinityTerm: topologyKey: kubernetes.io/hostname labelSelector: matchLabels: app.kubernetes.io/name: allocator securityContext: runAsNonRoot: true runAsUser: 10001 runAsGroup: 10001 seccompProfile: type: RuntimeDefault containers: - name: allocator image: ghcr.io/cosmic-clash/allocator@sha256:0000000000000000000000000000000000000000000000000000000000000000 args: - --dsn=$(COSMIC_CLASH_POSTGRES_DSN) - --agones-url=https://kubernetes.default.svc - --agones-namespace=cosmic-clash - --provider-timeout=10s - --readiness-max-stale=30s - --workload-token-ttl=2h - --metrics-addr=:9091 # Without these the allocator binds allocations but never publishes # an assignment roster, and no allocated match can become joinable. # The same key material is mounted into game servers by fleet.yaml. - --join-authorisations-key-file=/run/secrets/cosmic-clash/join-signing-keys.json - --join-authorisations-key-id=$(COSMIC_CLASH_JOIN_SIGNING_KEY_ID) ports: - name: metrics containerPort: 9091 volumeMounts: - name: join-signing-keys mountPath: /run/secrets/cosmic-clash readOnly: true readinessProbe: httpGet: path: /readyz port: metrics initialDelaySeconds: 2 periodSeconds: 5 timeoutSeconds: 2 failureThreshold: 3 livenessProbe: httpGet: path: /healthz port: metrics initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 2 failureThreshold: 3 securityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: true capabilities: drop: [ALL] resources: requests: cpu: 100m memory: 128Mi limits: cpu: 1 memory: 512Mi env: - name: COSMIC_CLASH_POSTGRES_DSN valueFrom: secretKeyRef: name: cosmic-clash-database key: dsn - name: COSMIC_CLASH_WORKLOAD_SECRET valueFrom: secretKeyRef: name: cosmic-clash-workload key: secret # Rotation: publish the new key in the Secret everywhere first, # then move this ID to it, then drop the retired key once no live # match can still reference it. - name: COSMIC_CLASH_JOIN_SIGNING_KEY_ID valueFrom: secretKeyRef: name: cosmic-clash-game-server key: join-signing-key-id volumes: - name: join-signing-keys secret: secretName: cosmic-clash-game-server defaultMode: 0400 items: - key: join-signing-keys.json path: join-signing-keys.json