Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- Added a helm chart with some basic doc; #94

Merged
merged 11 commits into from
Jan 25, 2024
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
palworld
palworld
.idea
values*.yaml
!chart/values.yaml
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ All files you will need to deploy this container to kubernetes are located in th

Follow the steps in the [README.md here](k8s/readme.md) to deploy it.

#### Using helm chart

Follow up the docs on the [README.md for the helm chart](./chart/README.md) to deploy.

### Environment variables

You can use the following values to change the settings of the server on boot.
Expand Down
20 changes: 20 additions & 0 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v2
name: palworld
version: 0.0.0
description: This chart can provide an rAthena emulator installation on a Kubernetes cluster.
type: application
keywords:
- palworld
- server
- kubernetes
- helm
home: https://github.com/thijsvanloef/palworld-server-docker
sources:
- https://github.com/thijsvanloef/palworld-server-docker
maintainers:
- name: Filipe Souza
email: [email protected]
url: https://github.com/Filipe-Souza
icon: https://cdn.akamai.steamstatic.com/steam/apps/1623730/header.jpg
appVersion: "latest"
deprecated: false
32 changes: 32 additions & 0 deletions chart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Palworld Helm Chart

Allows you to deploy the usage of [Palworld Server docker](https://github.com/Filipe-Souza/palworld-server-docker) as
a helm chart and with helm deployments.

This is an advanced method of installation and can be quite difficult to non-technical trying to set it up.

## Dependencies

You will need the [Helm client](https://helm.sh/docs/intro/install/) and a Kubernetes cluster.

## Install the chart

There is no helm package available yet, so you need to clone this repo and setup it manually, or with some GitOps tool
like ArgoCD/FluxCD.

After cloning the repository, you can create a new file, e.g.: values.override.yaml to store your custom values.

After copying, modify your values.override.yaml as needed. You can look up the
[values summary](VALUES_SUMMARY.md) to see the parameter documentation.

After that, you can apply the chart:

```bash
helm install --create-namespace --namespace palworld palworld chart/ --values values.override.yaml
```

You can remove all the resources created (except the PVC) with the following command:

```bash
helm uninstall -n palworld palworld
```
68 changes: 68 additions & 0 deletions chart/VALUES_SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# palworld

![Version: 0.0.0](https://img.shields.io/badge/Version-0.0.0-informational?style=flat-square)
![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square)

This chart can provide an rAthena emulator installation on a Kubernetes cluster.

**Homepage:** <https://github.com/thijsvanloef/palworld-server-docker>

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| Filipe Souza | <[email protected]> | <https://github.com/Filipe-Souza> |

## Source Code

* <https://github.com/thijsvanloef/palworld-server-docker>

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| namespace | string | `"palworld"` | Namespace where the resources will be created |
| server | dict | | The server configuration |
| server.annotations | object | `{}` | Additional annotations to the resources |
| server.config | dict | | Change the game server configuration. If you change those, make sure to change the service.ports and server.ports accordingly. Those are directly connected with the container image, providing multiple environment variables to the scripts. |
| server.config.annotations | object | `{}` | Additional annotations to the resources |
| server.config.community.enable | bool | `true` | Enables/disables the visibility of this server on Steam community servers list. |
| server.config.community.password | string | `""` | If not provided, a random password will be generated and stored on the secret. |
| server.config.labels | object | `{}` | Additional labels to the resources |
| server.config.max_players | int | `16` | The max number of players supported. |
| server.config.multithreading | bool | `true` | Enables the multithreading, allowing the usage of up to 4 cores (needs citation) |
| server.config.query_port | string | `27015` | The query port of the game. |
| server.config.rcon | dict | | Remote connection configuration. Allows the remote connection and management for the server. Those are directly connected with the container image, providing multiple environment variables to the scripts. |
| server.config.rcon.enable | bool | `true` | Enables/disables the rcon port. |
| server.config.rcon.password | string | `""` | If not provided, a random password will be generated and stored on the secret. |
| server.config.rcon.port | string | `25575` | The port for rcon. If you change this, make sure to change the service.ports and server.ports accordingly. |
| server.image | dict | | Define the parameters for the server image container |
| server.image.imagePullPolicy | string | `"IfNotPresent"` | Define the pull policy for the server image. |
| server.image.name | string | `"thijsvanloef/palworld-server-docker"` | Name of the image, without the tag. |
| server.image.tag | string | `"latest"` | The tag of the image. |
| server.labels | object | `{}` | Additional labels to the resources |
| server.ports | dict | | Change the ports to be mapped to the pod. If you change those, make sure to change the service.ports and server.config accordingly. |
| server.ports[0] | dict | `{"containerPort":8211,"name":"game","protocol":"UDP"}` | The "game" port definition. If you change this, make sure to change the service.ports.game and server.config accordingly. |
| server.ports[1] | dict | `{"containerPort":27015,"name":"query","protocol":"UDP"}` | The "query" port definition . If you change this, make sure to change the service.ports.query_port and server.config accordingly. |
| server.ports[2] | dict | `{"containerPort":25575,"name":"rcon","protocol":"UDP"}` | The "rcon" port definition . If you change this, make sure to change the service.ports.rcon and server.config accordingly. |
| server.resources | dict | `{"limits":{"cpu":4,"memory":"12Gi"},"requests":{"cpu":4,"memory":"8Gi"}}` | Resources limits for the container. |
| server.service | dict | | Change the service configuration. If you change those, make sure to change the server.config and server.ports accordingly. |
| server.service.annotations | object | `{}` | Additional annotations to the resources |
| server.service.enabled | bool | `true` | Enables the creation of the service component. |
| server.service.labels | object | `{}` | Additional labels to the resources |
| server.service.ports | dict | | Change the ports to be mapped to the service. If you change those, make sure to change the server.config and server.ports accordingly. |
| server.service.ports[0] | dict | `{"name":"game","port":8211,"protocol":"UDP","targetPort":8211}` | The "game" port definition. If you change this, make sure to change the server.ports.game and server.config.port accordingly. |
| server.service.ports[1] | dict | `{"name":"query","port":27015,"protocol":"UDP","targetPort":27015}` | The "query" port definition . If you change this, make sure to change the server.ports.query and server.config.query_port accordingly. |
| server.service.ports[2] | dict | `{"name":"rcon","port":25575,"protocol":"UDP","targetPort":25575}` | The "rcon" port definition . If you change this, make sure to change the server.ports.rcon and server.config.rcon.port accordingly. |
| server.service.ports[3] | dict | `{"name":"healthz","port":80,"protocol":"TCP","targetPort":80}` | The "healthz" port definition . Used only to create a health check for load balancers on cloud services. |
| server.service.type | string | `"LoadBalancer"` | The type of service to be created. |
| server.storage | dict | `{"external":false,"externalName":"","preventDelete":false,"size":"10Gi","storageClassName":""}` | Define some parameters for the storage volume |
| server.storage.external | bool | `false` | Define if it will use an existing PVC containing the installation data. |
| server.storage.externalName | bool | `""` | The external PVC name to use. |
| server.storage.preventDelete | bool | `false` | Keeps helm from deleting the PVC. By default, helm does not delete pvcs. |
| server.storage.size | string | `"10Gi"` | The size of the pvc storage. |
| server.storage.storageClassName | string | `""` | The storage class name. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
40 changes: 40 additions & 0 deletions chart/templates/configmaps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{- $cPwd := randAlphaNum 12 | nospace -}}
{{- $sName := "" -}}
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ .Values.namespace }}
name: "{{ .Release.Name }}-env-config"
annotations:
{{- with .Values.server.config.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/name: "{{ .Release.Name }}-config"
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: "{{ .Release.Name }}-config"
app.kubernetes.io/version: {{ .Chart.AppVersion }}
{{- with .Values.server.config.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
data:
PUID: "{{ .Values.server.config.puid }}"
PGID: "{{ .Values.server.config.pgid }}"
PORT: "{{ .Values.server.config.port }}"
PLAYERS: "{{ .Values.server.config.max_players }}"
MULTITHREADING: "{{ .Values.server.config.multithreading }}"
{{ if .Values.server.config.rcon.enable }}
RCON_ENABLED: "true"
RCON_PORT: "{{ .Values.server.config.rcon.port }}"
{{ end }}
{{ if .Values.server.config.community.enable }}
COMMUNITY: "true"
SERVER_PASSWORD: {{- if .Values.server.config.community.password }} "{{ .Values.server.config.community.password }}" {{ else }} {{ $cPwd }} {{ end }}
{{ end }}
{{ if .Values.server.config.server_name }}
SERVER_NAME: {{ regexReplaceAll "\\W+" .Values.server.config.server_name "_" }}
{{ else }}
SERVER_NAME: {{ printf "%s_%s" "palworld" (randAlphaNum 6 | nospace) }}
{{ end }}
66 changes: 66 additions & 0 deletions chart/templates/deployments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: {{ .Values.namespace }}
name: "{{ .Release.Name }}-server"
spec:
selector:
matchLabels:
app.kubernetes.io/component: "{{ .Release.Name }}-server"
template:
metadata:
annotations:
{{- with .Values.server.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/name: "{{ .Release.Name }}-server"
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: "{{ .Release.Name }}-server"
app.kubernetes.io/version: {{ .Chart.AppVersion }}
{{- with .Values.server.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
containers:
- name: healthz
image: "chussenot/tiny-server:latest"
imagePullPolicy: {{ .Values.server.image.imagePullPolicy }}
ports:
- name: healthz
containerPort: 80
protocol: TCP
- name: server
image: "{{ .Values.server.image.name }}:{{ .Values.server.image.tag }}"
imagePullPolicy: {{ .Values.server.image.imagePullPolicy }}
resources:
{{- with .Values.server.resources }}
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
{{- with .Values.server.ports }}
{{- toYaml . | nindent 12 }}
{{- end }}
env:
- name: ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: "{{ .Release.Name }}-rcon-password"
key: "rconPassword"
envFrom:
- configMapRef:
name: "{{ .Release.Name }}-env-config"
volumeMounts:
- mountPath: /palworld
name: datadir
volumes:
- name: datadir
persistentVolumeClaim:
{{- if not .Values.server.storage.external }}
claimName: "{{ .Release.Name }}-datadir-pvc"
{{ else }}
claimName: "{{ .Values.server.storage.externalName }}"
{{ end }}
31 changes: 31 additions & 0 deletions chart/templates/pvcs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- if not .Values.server.storage.external }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: {{ .Values.namespace }}
name: "{{ .Release.Name }}-datadir-pvc"
annotations:
{{- with .Values.server.config.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/name: "{{ .Release.Name }}-datadir-pvc"
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: "{{ .Release.Name }}-datadir-pvc"
app.kubernetes.io/version: {{ .Chart.AppVersion }}
{{- if .Values.server.storage.preventDelete }}
helm.sh/resource-policy: keep
{{ end }}
{{- with .Values.server.config.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.server.storage.size }}
storageClassName: {{ .Values.server.storage.storageClassName }}
{{ end }}
25 changes: 25 additions & 0 deletions chart/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- define "server.rcon.password" -}}
{{- randAlphaNum 24 | nospace -}}
{{- end -}}
apiVersion: v1
kind: Secret
metadata:
namespace: {{ .Values.namespace }}
name: "{{ .Release.Name }}-rcon-password"
annotations:
{{- with .Values.server.config.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/name: "{{ .Release.Name }}-rcon-password"
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: "{{ .Release.Name }}-rcon-password"
app.kubernetes.io/version: {{ .Chart.AppVersion }}
{{- with .Values.server.config.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
type: Opaque
stringData:
rconPassword: {{- if .Values.server.config.rcon.password }} "{{ .Values.server.config.rcon.password }}" {{ else }} "{{ include "server.rcon.password" .}}" {{ end }}
28 changes: 28 additions & 0 deletions chart/templates/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
apiVersion: v1
kind: Service
metadata:
namespace: {{ .Values.namespace }}
name: "{{ .Release.Name }}-svc"
labels:
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/name: "{{ .Release.Name }}-svc"
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: "{{ .Release.Name }}-svc"
app.kubernetes.io/version: {{ .Chart.AppVersion }}
{{- with .Values.server.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- with .Values.server.config.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
app.kubernetes.io/component: "{{ .Release.Name }}-server"
ports:
{{- with .Values.server.service.ports }}
{{- toYaml . | nindent 4 }}
{{- end }}
type: {{ .Values.server.service.type }}
Loading
Loading