TeamSpeak chart: naming scheme, hardening, configurable node ports
Batch-3 major PR for teamspeak-server (issue #32): - Rename service and StatefulSet to the repo naming scheme ({{ .Release.Name }}-{{ .Chart.Name }}-service / -sfs); the PVC keeps its historical name (documented naming exception, data preservation). - NodePorts configurable via server.voicePort / server.fileTransferPort (defaults 30987/30033, satisfactory pattern); ports are also passed to the server via TSSERVER_DEFAULT_PORT / TSSERVER_FILE_TRANSFER_PORT. - Hardened, values-configurable security contexts (securityContext.pod/container): non-root uid/gid 9987, readOnlyRootFilesystem, all capabilities dropped. - Probes values-configurable (defaults unchanged). - Additive env value rendered through tpl (value/secretKeyRef/ configMapKeyRef forms). - Chart 3.1.2 -> 4.0.0 (+up6.0.0.beta12.1).
This commit is contained in:
4 files changed
+118
-39
No files matched your search
@@ -5,5 +5,5 @@ icon: https://avatars.githubusercontent.com/u/136759148
|
|||||||
|
|
||||||
type: application
|
type: application
|
||||||
|
|
||||||
version: 3.1.2+up6.0.0.beta12.1
|
version: 4.0.0+up6.0.0.beta12.1
|
||||||
appVersion: "6.0.0-beta12.1"
|
appVersion: "6.0.0-beta12.1"
|
||||||
@@ -1,19 +1,21 @@
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ .Release.Name }}-service
|
name: {{ .Release.Name }}-{{ .Chart.Name }}-service
|
||||||
|
labels:
|
||||||
|
app: {{ .Release.Name }}-{{ .Chart.Name }}-service
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: {{ .Release.Name }}-server-sfs
|
app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
||||||
ports:
|
ports:
|
||||||
- port: 30987
|
- port: {{ .Values.server.voicePort }}
|
||||||
name: voice-port
|
name: voice-port
|
||||||
targetPort: voice-port
|
targetPort: voice-port
|
||||||
protocol: UDP
|
protocol: UDP
|
||||||
nodePort: 30987
|
nodePort: {{ .Values.server.voicePort }}
|
||||||
- port: 30033
|
- port: {{ .Values.server.fileTransferPort }}
|
||||||
name: file-transfer
|
name: file-transfer
|
||||||
targetPort: file-transfer
|
targetPort: file-transfer
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
nodePort: 30033
|
nodePort: {{ .Values.server.fileTransferPort }}
|
||||||
type: NodePort
|
type: NodePort
|
||||||
@@ -1,31 +1,33 @@
|
|||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: StatefulSet
|
kind: StatefulSet
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ .Release.Name }}-server-sfs
|
name: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
||||||
labels:
|
labels:
|
||||||
app: {{ .Release.Name }}
|
app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
||||||
spec:
|
spec:
|
||||||
replicas: {{ include "teamspeak-server.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.replicas) }}
|
replicas: {{ include "teamspeak-server.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.replicas) }}
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: {{ .Release.Name }}-server-sfs
|
app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ .Release.Name }}-server-sfs
|
name: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
||||||
labels:
|
labels:
|
||||||
app: {{ .Release.Name }}-server-sfs
|
app: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
||||||
spec:
|
spec:
|
||||||
automountServiceAccountToken: false
|
automountServiceAccountToken: false
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.securityContext.pod | nindent 8 }}
|
||||||
containers:
|
containers:
|
||||||
- name: {{ .Release.Name }}-ts-server-container
|
- name: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
||||||
image: "teamspeaksystems/teamspeak6-server:{{ .Chart.AppVersion }}"
|
image: "teamspeaksystems/teamspeak6-server:{{ .Chart.AppVersion }}"
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
ports:
|
ports:
|
||||||
- name: voice-port
|
- name: voice-port
|
||||||
containerPort: 30987
|
containerPort: {{ .Values.server.voicePort }}
|
||||||
protocol: UDP
|
protocol: UDP
|
||||||
- name: file-transfer
|
- name: file-transfer
|
||||||
containerPort: 30033
|
containerPort: {{ .Values.server.fileTransferPort }}
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
- name: web-query
|
- name: web-query
|
||||||
containerPort: 10080
|
containerPort: 10080
|
||||||
@@ -34,40 +36,47 @@ spec:
|
|||||||
- name: TSSERVER_LICENSE_ACCEPTED
|
- name: TSSERVER_LICENSE_ACCEPTED
|
||||||
value: "accept"
|
value: "accept"
|
||||||
- name: TSSERVER_DEFAULT_PORT
|
- name: TSSERVER_DEFAULT_PORT
|
||||||
value: "30987"
|
value: {{ .Values.server.voicePort | quote }}
|
||||||
# The voice service is UDP and cannot be probed; probe the TCP
|
- name: TSSERVER_FILE_TRANSFER_PORT
|
||||||
# file-transfer port instead.
|
value: {{ .Values.server.fileTransferPort | quote }}
|
||||||
|
{{- range $value := .Values.env }}
|
||||||
|
{{- if $value.value }}
|
||||||
|
- name: {{ $value.name }}
|
||||||
|
value: {{ tpl $value.value $ }}
|
||||||
|
{{- else if $value.valueFrom }}
|
||||||
|
{{- if $value.valueFrom.secretKeyRef }}
|
||||||
|
- name: {{ $value.name }}
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ tpl $value.valueFrom.secretKeyRef.name $ }}
|
||||||
|
key: {{ tpl $value.valueFrom.secretKeyRef.key $ }}
|
||||||
|
{{- else if $value.valueFrom.configMapKeyRef }}
|
||||||
|
- name: {{ $value.name }}
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: {{ tpl $value.valueFrom.configMapKeyRef.name $ }}
|
||||||
|
key: {{ tpl $value.valueFrom.configMapKeyRef.key $ }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
tcpSocket:
|
{{- toYaml .Values.livenessProbe | nindent 12 }}
|
||||||
port: file-transfer
|
|
||||||
periodSeconds: 10
|
|
||||||
timeoutSeconds: 5
|
|
||||||
failureThreshold: 3
|
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
tcpSocket:
|
{{- toYaml .Values.readinessProbe | nindent 12 }}
|
||||||
port: file-transfer
|
|
||||||
periodSeconds: 10
|
|
||||||
timeoutSeconds: 5
|
|
||||||
failureThreshold: 3
|
|
||||||
# The startup probe gates liveness/readiness. Startup budget = 5s * 30 = 150s.
|
|
||||||
startupProbe:
|
startupProbe:
|
||||||
tcpSocket:
|
{{- toYaml .Values.startupProbe | nindent 12 }}
|
||||||
port: file-transfer
|
|
||||||
periodSeconds: 5
|
|
||||||
timeoutSeconds: 5
|
|
||||||
failureThreshold: 30
|
|
||||||
resources:
|
resources:
|
||||||
{{- include "teamspeak-server.resources" .Values.resources | nindent 12 }}
|
{{- include "teamspeak-server.resources" .Values.resources | nindent 12 }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.securityContext.container | nindent 12 }}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: "teamspeak-volume"
|
- name: "teamspeak-volume"
|
||||||
mountPath: /var/tsserver/
|
mountPath: /var/tsserver/
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
securityContext:
|
|
||||||
fsGroup: 9987
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: "teamspeak-volume"
|
- name: "teamspeak-volume"
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
|
# Deliberate exception from the naming scheme: renaming the PVC
|
||||||
|
# would detach existing data (see README, naming exceptions).
|
||||||
claimName: {{ .Release.Name }}-teamspeak-volume-claim
|
claimName: {{ .Release.Name }}-teamspeak-volume-claim
|
||||||
serviceName: {{ .Release.Name }}-service
|
serviceName: {{ .Release.Name }}-{{ .Chart.Name }}-service
|
||||||
|
|
||||||
|
|
||||||
@@ -8,6 +8,15 @@ scaleDown: false
|
|||||||
# The chart-global scaleDown flag takes precedence.
|
# The chart-global scaleDown flag takes precedence.
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
|
||||||
|
server:
|
||||||
|
# UDP voice port and TCP file transfer port. Each value is used as the
|
||||||
|
# container port, the service port and the NodePort, and is passed to the
|
||||||
|
# server via TSSERVER_DEFAULT_PORT / TSSERVER_FILE_TRANSFER_PORT so the
|
||||||
|
# server always listens on the exposed port (file transfer requires the
|
||||||
|
# in-container port to match the externally reachable port).
|
||||||
|
voicePort: 30987
|
||||||
|
fileTransferPort: 30033
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
# Limits are optional: memory and ephemeral-storage limits default to
|
# Limits are optional: memory and ephemeral-storage limits default to
|
||||||
# limitFactor x the request, an explicitly set limit always wins, and a
|
# limitFactor x the request, an explicitly set limit always wins, and a
|
||||||
@@ -18,6 +27,65 @@ resources:
|
|||||||
memory: 100Mi
|
memory: 100Mi
|
||||||
ephemeral-storage: 100Mi
|
ephemeral-storage: 100Mi
|
||||||
|
|
||||||
|
# Extra environment variables for the server container, appended to the ones
|
||||||
|
# the chart always sets (TSSERVER_LICENSE_ACCEPTED, TSSERVER_DEFAULT_PORT,
|
||||||
|
# TSSERVER_FILE_TRANSFER_PORT). Values are rendered through tpl and support
|
||||||
|
# the value, secretKeyRef and configMapKeyRef forms:
|
||||||
|
# - name: SOME_ENV
|
||||||
|
# value: "{{ .Release.Name }}"
|
||||||
|
# - name: FROM_SECRET
|
||||||
|
# valueFrom:
|
||||||
|
# secretKeyRef:
|
||||||
|
# name: "some-secret"
|
||||||
|
# key: "someKey"
|
||||||
|
# - name: FROM_CONFIGMAP
|
||||||
|
# valueFrom:
|
||||||
|
# configMapKeyRef:
|
||||||
|
# name: "some-configmap"
|
||||||
|
# key: "someKey"
|
||||||
|
env: []
|
||||||
|
|
||||||
|
livenessProbe:
|
||||||
|
# The voice service is UDP and cannot be probed; probe the TCP
|
||||||
|
# file-transfer port instead.
|
||||||
|
tcpSocket:
|
||||||
|
port: file-transfer
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 3
|
||||||
|
readinessProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: file-transfer
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 3
|
||||||
|
# The startup probe gates liveness/readiness, so those need no
|
||||||
|
# initialDelaySeconds. Startup budget = periodSeconds * failureThreshold = 150s.
|
||||||
|
startupProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: file-transfer
|
||||||
|
periodSeconds: 5
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 30
|
||||||
|
|
||||||
|
securityContext:
|
||||||
|
pod:
|
||||||
|
runAsNonRoot: true
|
||||||
|
# The teamspeak6-server image runs as the non-root user "teamspeak"
|
||||||
|
# (uid/gid 9987); fsGroup 9987 keeps the data volume writable.
|
||||||
|
runAsUser: 9987
|
||||||
|
runAsGroup: 9987
|
||||||
|
fsGroup: 9987
|
||||||
|
fsGroupChangePolicy: Always
|
||||||
|
container:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
runAsNonRoot: true
|
||||||
|
capabilities:
|
||||||
|
drop:
|
||||||
|
- ALL
|
||||||
|
add: []
|
||||||
|
|
||||||
storage:
|
storage:
|
||||||
size: 25Gi
|
size: 25Gi
|
||||||
storageClass: longhorn
|
storageClass: longhorn
|
||||||
Reference in new issue
Block a user