Skip to content

Commit

Permalink
ci(kubes): updating the deployment of the rareicon gameserver.
Browse files Browse the repository at this point in the history
  • Loading branch information
h0lybyte committed Nov 25, 2024
1 parent 2b54e48 commit e793d5a
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 10 deletions.
7 changes: 7 additions & 0 deletions apps/kbve.com/src/content/journal/11-25.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@ import { Adsense, Tasks } from '@kbve/astropad';

Going to continue learning more about the containers and maybe get the first batch finished.
If we can get the exisiting MM components to load under the VContainer, then it will make extending and gameplay so much easier.

- 12:32PM

**Helm**

Time to work out the helm chart!
We want this helm chart deployment to be easy but also useful, I believe the websockets will be a breeze but the UDP might be an issue.
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}-gameserver
namespace: {{ .Release.Namespace }}
labels:
app: {{ .Chart.Name }}
spec:
replicas: {{ .Values.gameserver.replicaCount }}
selector:
matchLabels:
app: {{ .Chart.Name }}
tier: gameserver
template:
metadata:
labels:
app: {{ .Chart.Name }}
tier: gameserver
spec:
containers:
- name: gameserver
image: "{{ .Values.gameserver.image.repository }}:{{ .Values.gameserver.image.tag }}"
ports:
{{- range .Values.gameserver.service.ports }}
- name: {{ .name }}
containerPort: {{ .targetPort }}
protocol: {{ .protocol }}
{{- end }}
resources:
{{- toYaml .Values.gameserver.resources | nindent 12 }}

---

# Service (TCP and UDP)
apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}-service
namespace: {{ .Release.Namespace }}
labels:
app: {{ .Chart.Name }}
spec:
selector:
app: {{ .Chart.Name }}
ports:
{{- range .Values.gameserver.service.ports }}
- name: {{ .name }}
protocol: {{ .protocol }}
port: {{ .port }}
targetPort: {{ .targetPort }}
{{- end }}
type: ClusterIP

---

# WebSocket Ingress
{{- if .Values.gameserver.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Chart.Name }}-ingress
namespace: {{ .Release.Namespace }}
annotations:
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
spec:
rules:
- host: {{ .Values.gameserver.ingress.host }}
http:
paths:
{{- range .Values.gameserver.ingress.paths }}
- path: {{ .path }}
pathType: Prefix
backend:
service:
name: {{ .Chart.Name }}-service
port:
number: {{ if eq .backend "html" }}{{ (index .Values.gameserver.service.ports 0).port }}{{ else if eq .backend "websocket" }}{{ (index .Values.gameserver.service.ports 1).port }}{{ end }}
{{- end }}
{{- end }}

---

# UDP LoadBalancer Service
{{- if .Values.gameserver.service.udp.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}-udp-service
namespace: {{ .Release.Namespace }}
labels:
app: {{ .Chart.Name }}
spec:
selector:
app: {{ .Chart.Name }}
ports:
{{- range $index, $port := .Values.gameserver.service.ports }}
{{- if eq $port.protocol "UDP" }}
- name: {{ $port.name }}
protocol: {{ $port.protocol }}
port: {{ $port.port }}
targetPort: {{ $port.targetPort }}
{{- end }}
{{- end }}
type: LoadBalancer
{{- end }}
39 changes: 29 additions & 10 deletions migrations/kube/charts/rareicon/shipyard/values.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
service:
name: gameserver
ports:
tcp: 3000
udp: 8081
image:
repository: kbve/rareicongs
tag: latest
replicaCount: 1
resources: {}
gameserver:
replicaCount: 1
image:
repository: kbve/rareicongs
tag: latest
service:
name: gameserver
ports:
- name: tcp
protocol: TCP
port: 3000
targetPort: 3000
- name: udp
protocol: UDP
port: 8081
targetPort: 8081
webscoket:
enabled: true
udp:
enabled: true
ingress:
enabled: true
host: discord.rareicon.com
paths:
- path: /
backend: html
- path: /ws/
backend: websocket
resources: {}

0 comments on commit e793d5a

Please sign in to comment.