Skip to content
This repository has been archived by the owner on Apr 23, 2023. It is now read-only.

Feature/velocity #14

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,42 @@ Selector labels server
{{- define "multipaper-helm.server.selectorLabels" -}}
app.kubernetes.io/name: {{ include "multipaper-helm.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Common labels server
*/}}
{{- define "multipaper-helm.velocity.labels" -}}
helm.sh/chart: {{ include "multipaper-helm.chart" . }}
{{ include "multipaper-helm.velocity.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
{{- end }}

{{/*
Selector labels server
*/}}
{{- define "multipaper-helm.velocity.selectorLabels" -}}
app.kubernetes.io/name: {{ include "multipaper-helm.name" . }}-velocity
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Whether or not online mode should be used.
*/}}
{{- define "multipaper-helm.onlineMode" -}}
{{- if .Values.velocity.enabled }}
{{- printf "false" }}
{{- else }}
{{- printf "true" }}
{{- end }}
{{- end }}

{{/*
Whether or not to support Bungeecord forwarding.
TODO: Add the option to disable this based on the forwarding setting. Currently this is only modern.
*/}}
{{- define "multipaper-helm.bungeecord" -}}
{{- printf "%s" (include "multipaper-helm.onlineMode" .) -}}
{{- end }}
4 changes: 2 additions & 2 deletions templates/master-proxy-service.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.master.proxy.enabled -}}
{{- if .Values.master.proxy.enabled }}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -14,4 +14,4 @@ spec:
name: proxy
selector:
{{- include "multipaper-helm.master.selectorLabels" . | nindent 4 }}
{{- end -}}
{{- end }}
2 changes: 2 additions & 0 deletions templates/master-service.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.velocity.enabled }}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -14,3 +15,4 @@ spec:
name: server
selector:
{{- include "multipaper-helm.master.selectorLabels" . | nindent 4 }}
{{- end }}
4 changes: 4 additions & 0 deletions templates/master-statefulset.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.velocity.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
Expand Down Expand Up @@ -33,9 +34,11 @@ spec:
- name: server
containerPort: {{ .Values.master.service.port }}
protocol: TCP
{{- if .Values.master.proxy.enabled }}
- name: proxy
containerPort: {{ .Values.master.proxy.service.port }}
protocol: TCP
{{- end }}
volumeMounts: {{ .Values.master.persistent.volumeMounts | toYaml | nindent 16 }}
{{- if .Values.master.probes.readinessProbe.startupProbe }}
startupProbe:
Expand Down Expand Up @@ -67,3 +70,4 @@ spec:
{{- if .Values.master.persistent }}
volumeClaimTemplates: {{ .Values.master.persistent.claimTemplates | toYaml | nindent 4}}
{{- end }}
{{- end }}
10 changes: 9 additions & 1 deletion templates/multipaper-config-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ data:
# Docs: https://github.com/PureGero/MultiPaper/blob/main/MULTIPAPER_YAML.md

useLocalPlayerCountForServerIsFullKick: false
{{- if .Values.velocity.enabled }}
multipaperMasterAddress: {{ template "multipaper-helm.fullname" . }}-velocity-master:{{ .Values.velocity.master.service.targetPort }}
{{- else }}
multipaperMasterAddress: {{ template "multipaper-helm.fullname" . }}-master:{{ .Values.master.service.targetPort }}
advertiseToBuiltInProxy: {{ .Values.master.proxy.enabled }}
{{- end }}
advertiseToBuiltInProxy: {{ .Values.velocity.enabled }}
filesToSyncOnStartup:
filesToSyncInRealTime:
filesToOnlyUploadOnServerStop:
Expand All @@ -25,4 +29,8 @@ data:
syncJsonFiles: false
filesToNotSync:
- plugins/bStats
{{- if .Values.velocity.enabled }}
bungeecordName: {{ template "multipaper-helm.fullname" . }}
{{- else }}
bungeecordName: $HOSTNAME
{{- end }}
2 changes: 1 addition & 1 deletion templates/multipaper-minecraft-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ data:
max-tick-time=60000
use-native-transport=true
max-players=20
online-mode=true
online-mode={{ template "multipaper-helm.onlineMode" . }}
enable-status=true
allow-flight=false
broadcast-rcon-to-ops=true
Expand Down
6 changes: 3 additions & 3 deletions templates/multipaper-paper-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ data:
tab-spam-limit: 500
bungee-online-mode: true
velocity-support:
enabled: false
online-mode: false
secret: ''
enabled: {{ .Values.velocity.enabled }}
online-mode: true
secret: {{ .Values.velocity.secret | quote }}
max-joins-per-tick: 3
player-auto-save-rate: -1
max-player-auto-save-per-tick: -1
Expand Down
15 changes: 15 additions & 0 deletions templates/multipaper-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "multipaper-helm.fullname" . }}
labels:
{{- include "multipaper-helm.server.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- port: {{ .Values.server.service.port }}
targetPort: {{ .Values.server.service.targetPort }}
protocol: TCP
name: server
selector:
{{- include "multipaper-helm.server.selectorLabels" . | nindent 4 }}
2 changes: 1 addition & 1 deletion templates/multipaper-spigot-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ data:
log-named-deaths: true
save-user-cache-on-stop-only: false
sample-count: 12
bungeecord: {{ .Values.master.proxy.enabled }}
bungeecord: {{ template "multipaper-helm.bungeecord" . }}
commands:
log: true
tab-complete: 0
Expand Down
116 changes: 116 additions & 0 deletions templates/velocity-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{{- if .Values.velocity.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "multipaper-helm.fullname" . }}-velocity
labels:
{{- include "multipaper-helm.velocity.labels" . | nindent 4 }}
data:
velocity.toml: |
# Config version. Do not change this
config-version = "1.0"
# What port should the proxy be bound to? By default, we'll bind to all addresses on port 25577.
bind = "0.0.0.0:25577"
# What should be the MOTD? This gets displayed when the player adds your server to
# their server list. Legacy color codes and JSON are accepted.
motd = "&#09add3MultiPaper"
# What should we display for the maximum number of players? (Velocity does not support a cap
# on the number of players online.)
show-max-players = 1000
# Should we authenticate players with Mojang? By default, this is on.
online-mode = true
# If client's ISP/AS sent from this proxy is different from the one from Mojang's
# authentication server, the player is kicked. This disallows some VPN and proxy
# connections but is a weak form of protection.
prevent-client-proxy-connections = false
# Should we forward IP addresses and other data to backend servers?
# Available options:
# - "none": No forwarding will be done. All players will appear to be connecting
# from the proxy and will have offline-mode UUIDs.
# - "legacy": Forward player IPs and UUIDs in a BungeeCord-compatible format. Use this
# if you run servers using Minecraft 1.12 or lower.
# - "bungeeguard": Forward player IPs and UUIDs in a format supported by the BungeeGuard
# plugin. Use this if you run servers using Minecraft 1.12 or lower, and are
# unable to implement network level firewalling (on a shared host).
# - "modern": Forward player IPs and UUIDs as part of the login process using
# Velocity's native forwarding. Only applicable for Minecraft 1.13 or higher.
player-info-forwarding-mode = "modern"
# If you are using modern or BungeeGuard IP forwarding, configure a unique secret here.
forwarding-secret = {{ .Values.velocity.secret | quote }}
# Announce whether or not your server supports Forge. If you run a modded server, we
# suggest turning this on.
#
# If your network runs one modpack consistently, consider using ping-passthrough = "mods"
# instead for a nicer display in the server list.
announce-forge = false
# If enabled (default is false) and the proxy is in online mode, Velocity will kick
# any existing player who is online if a duplicate connection attempt is made.
kick-existing-players = false
# Should Velocity pass server list ping requests to a backend server?
# Available options:
# - "disabled": No pass-through will be done. The velocity.toml and server-icon.png
# will determine the initial server list ping response.
# - "mods": Passes only the mod list from your backend server into the response.
# The first server in your try list (or forced host) with a mod list will be
# used. If no backend servers can be contacted, Velocity won't display any
# mod information.
# - "description": Uses the description and mod list from the backend server. The first
# server in the try (or forced host) list that responds is used for the
# description and mod list.
# - "all": Uses the backend server's response as the proxy response. The Velocity
# configuration is used if no servers could be contacted.
ping-passthrough = "DISABLED"

[servers]
# Configure your servers here. Each key represents the server's name, and the value
# represents the IP address of the server to connect to.
{{ template "multipaper-helm.fullname" . }} = "{{ template "multipaper-helm.fullname" . }}:{{ .Values.server.service.targetPort }}"
# In what order we should try servers when a player logs in or is kicked from a server.
try = [{{- include "multipaper-helm.fullname" . | quote }}]

[forced-hosts]
# Configure your forced hosts here.
"{{ template "multipaper-helm.fullname" . }}.internal" = [{{- include "multipaper-helm.fullname" . | quote }}]

[advanced]
# How large a Minecraft packet has to be before we compress it. Setting this to zero will
# compress all packets, and setting it to -1 will disable compression entirely.
compression-threshold = 256
# How much compression should be done (from 0-9). The default is -1, which uses the
# default level of 6.
compression-level = -1
# How fast (in milliseconds) are clients allowed to connect after the last connection? By
# default, this is three seconds. Disable this by setting this to 0.
login-ratelimit = 3000
# Specify a custom timeout for connection timeouts here. The default is five seconds.
connection-timeout = 5000
# Specify a read timeout for connections here. The default is 30 seconds.
read-timeout = 30000
# Enables compatibility with HAProxy's PROXY protocol. If you don't know what this is for, then
# don't enable it.
haproxy-protocol = false
# Enables TCP fast open support on the proxy. Requires the proxy to run on Linux.
tcp-fast-open = false
# Enables BungeeCord plugin messaging channel support on Velocity.
bungee-plugin-message-channel = true
# Shows ping requests to the proxy from clients.
show-ping-requests = false
# By default, Velocity will attempt to gracefully handle situations where the user unexpectedly
# loses connection to the server without an explicit disconnect message by attempting to fall the
# user back, except in the case of read timeouts. BungeeCord will disconnect the user instead. You
# can disable this setting to use the BungeeCord behavior.
failover-on-unexpected-server-disconnect = true
# Declares the proxy commands to 1.13+ clients.
announce-proxy-commands = true
# Enables the logging of commands
log-command-executions = false

[query]
# Whether to enable responding to GameSpy 4 query responses or not.
enabled = false
# If query is enabled, on what port should the query protocol listen on?
port = 25577
# This is the map name that is reported to the query services.
map = "Velocity"
show-plugins = false
{{- end }}
18 changes: 18 additions & 0 deletions templates/velocity-master-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.velocity.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "multipaper-helm.fullname" . }}-velocity-master
labels:
{{- include "multipaper-helm.velocity.labels" . | nindent 4 }}
spec:
type: ClusterIP
clusterIP: None
ports:
- port: {{ .Values.velocity.master.service.port }}
targetPort: {{ .Values.velocity.master.service.targetPort }}
protocol: TCP
name: master
selector:
{{- include "multipaper-helm.velocity.selectorLabels" . | nindent 4 }}
{{- end }}
12 changes: 12 additions & 0 deletions templates/velocity-multipaper-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.velocity.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "multipaper-helm.fullname" . }}-velocity-multipaper
labels:
{{- include "multipaper-helm.velocity.labels" . | nindent 4 }}
data:
config.toml: |
port = {{ .Values.velocity.master.service.targetPort }}
balance-nodes = true
{{- end }}
17 changes: 17 additions & 0 deletions templates/velocity-proxy-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.velocity.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "multipaper-helm.fullname" . }}-velocity-proxy
labels:
{{- include "multipaper-helm.velocity.labels" . | nindent 4 }}
spec:
type: {{ .Values.velocity.proxy.service.type }}
ports:
- port: {{ .Values.velocity.proxy.service.port }}
targetPort: {{ .Values.velocity.proxy.service.targetPort }}
protocol: TCP
name: proxy
selector:
{{- include "multipaper-helm.velocity.selectorLabels" . | nindent 4 }}
{{- end }}
Loading