mirror of
https://github.com/k8s-at-home/charts.git
synced 2025-01-23 15:39:02 +00:00
[teamspeak] Add TeamSpeak metrics. (#1403)
* Merge TeamSpeak ports into single service. * Add TeamSpeak metrics.
This commit is contained in:
parent
05347d1716
commit
90a62afddc
@ -2,7 +2,7 @@ apiVersion: v2
|
||||
appVersion: 3.13.6
|
||||
description: TeamSpeak Server
|
||||
name: teamspeak
|
||||
version: 0.3.0
|
||||
version: 0.4.0
|
||||
kubeVersion: ">=1.16.0-0"
|
||||
keywords:
|
||||
- teamspeak
|
||||
@ -20,4 +20,6 @@ dependencies:
|
||||
annotations:
|
||||
artifacthub.io/changes: |
|
||||
- kind: changed
|
||||
description: Upgraded `common` chart dependency to version `4.3.0`.
|
||||
description: Merged ports into single service.
|
||||
- kind: added
|
||||
description: Added metrics sidecar.
|
||||
|
@ -5,5 +5,27 @@
|
||||
{{- define "custom.custom.configuration" -}}
|
||||
{{ template "custom.custom.configuration.header" . }}
|
||||
|
||||
N/A
|
||||
### Regarding the services
|
||||
|
||||
By default, it is not yet possible to combine TCP and UDP ports on a service with `type: LoadBalancer`. This can be solved in a number of ways:
|
||||
|
||||
1. Create a separate service containing the UDP ports. This could be done by disabling the UDP ports under `service.main.ports` and adding the following in your `values.yaml`:
|
||||
|
||||
```yaml
|
||||
service:
|
||||
udp:
|
||||
enabled: true
|
||||
type: LoadBalancer
|
||||
# <your other service configuration>
|
||||
ports:
|
||||
voice:
|
||||
enabled: true
|
||||
port: 9987
|
||||
protocol: UDP
|
||||
```
|
||||
|
||||
2. Since Kubernetes 1.20 there is a feature gate that can be enabled to allow TCP and UDP ports to coexist on Services with `type: Loadbalancer`.
|
||||
You will need to enable the `MixedProtocolLBService` feature gate in order to achieve this.
|
||||
|
||||
For more information about feature gates, please see [the docs](https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/).
|
||||
{{- end -}}
|
||||
|
@ -1 +1,79 @@
|
||||
{{/* Make sure all variables are set properly */}}
|
||||
{{- include "common.values.setup" . }}
|
||||
|
||||
{{/*
|
||||
If there's an existing secret, reuse it, otherwise generate a new one.
|
||||
*/}}
|
||||
{{- define "teamspeak.serveradmin-password" -}}
|
||||
{{- $secret := (lookup "v1" "Secret" .Release.Namespace (include "common.names.fullname" .) ) -}}
|
||||
{{- if $secret -}}
|
||||
{{- index $secret "data" "serveradmin_password" -}}
|
||||
{{- else -}}
|
||||
{{- randAlphaNum 32 | b64enc | quote -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Append the hardcoded settings */}}
|
||||
{{- define "teamspeak.harcodedValues" -}}
|
||||
{{- if not .Values.env.TS3SERVER_SERVERADMIN_PASSWORD }}
|
||||
env:
|
||||
TS3SERVER_SERVERADMIN_PASSWORD:
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
key: serveradmin_password
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
additionalContainers:
|
||||
exporter:
|
||||
name: exporter
|
||||
image: "{{ .Values.metrics.exporter.image.repository }}:{{ .Values.metrics.exporter.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.metrics.exporter.image.pullPolicy }}
|
||||
args:
|
||||
- -listen
|
||||
- :{{ .Values.metrics.exporter.env.port }}
|
||||
{{- if .Values.metrics.exporter.env.enableChannelMetrics }}
|
||||
- -enablechannelmetrics
|
||||
{{- end }}
|
||||
env:
|
||||
- name: SERVERQUERY_PASSWORD
|
||||
{{- $value := .Values.env.TS3SERVER_SERVERADMIN_PASSWORD }}
|
||||
{{- if $value }}
|
||||
{{- if kindIs "map" $value -}}
|
||||
{{- if hasKey $value "value" }}
|
||||
{{- $value = $value.value -}}
|
||||
{{- else if hasKey $value "valueFrom" }}
|
||||
{{- toYaml $value | nindent 8 }}
|
||||
{{- else }}
|
||||
{{- dict "valueFrom" $value | toYaml | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- if kindIs "string" $value }}
|
||||
{{- $value = tpl $value $ }}
|
||||
{{- end }}
|
||||
value: {{ quote $value }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
key: serveradmin_password
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: metrics
|
||||
containerPort: {{ .Values.metrics.exporter.env.port }}
|
||||
|
||||
service:
|
||||
metrics:
|
||||
enabled: true
|
||||
ports:
|
||||
metrics:
|
||||
enabled: true
|
||||
protocol: TCP
|
||||
port: {{ .Values.metrics.exporter.env.port }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- $_ := mergeOverwrite .Values (include "teamspeak.harcodedValues" . | fromYaml) -}}
|
||||
|
||||
{{/* Render the templates */}}
|
||||
{{ include "common.all" . }}
|
||||
|
36
charts/incubator/teamspeak/templates/prometheusrules.yaml
Normal file
36
charts/incubator/teamspeak/templates/prometheusrules.yaml
Normal file
@ -0,0 +1,36 @@
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.prometheusRule.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PrometheusRule
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- with .Values.metrics.prometheusRule.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
groups:
|
||||
- name: {{ include "common.names.fullname" . }}
|
||||
rules:
|
||||
- alert: Ts3ExporterAbsent
|
||||
annotations:
|
||||
description: ts3exporter has disappeared from Prometheus service discovery.
|
||||
summary: ts3exporter is down.
|
||||
expr: |
|
||||
absent(up{job=~".*{{ include "common.names.fullname" . }}.*"} == 1)
|
||||
for: 5m
|
||||
labels:
|
||||
severity: critical
|
||||
- alert: TeamSpeakDown
|
||||
annotations:
|
||||
description: TeamSpeak service is down.
|
||||
summary: TeamSpeak is down.
|
||||
expr: |
|
||||
ts3_serverinfo_online{job=~".*{{ include "common.names.fullname" . }}.*"} == 0
|
||||
for: 5m
|
||||
labels:
|
||||
severity: critical
|
||||
{{- with .Values.metrics.prometheusRule.rules }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
11
charts/incubator/teamspeak/templates/secret.yaml
Normal file
11
charts/incubator/teamspeak/templates/secret.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
{{- if not .Values.env.TS3SERVER_SERVERADMIN_PASSWORD }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
data:
|
||||
serveradmin_password: {{ template "teamspeak.serveradmin-password" . }}
|
||||
{{- end }}
|
24
charts/incubator/teamspeak/templates/servicemonitor.yaml
Normal file
24
charts/incubator/teamspeak/templates/servicemonitor.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
{{- if .Values.metrics.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
{{- with .Values.metrics.serviceMonitor.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "common.labels.selectorLabels" . | nindent 6 }}
|
||||
endpoints:
|
||||
- port: metrics
|
||||
{{- with .Values.metrics.serviceMonitor.interval }}
|
||||
interval: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.metrics.serviceMonitor.scrapeTimeout }}
|
||||
scrapeTimeout: {{ . }}
|
||||
{{- end }}
|
||||
path: /metrics
|
||||
{{- end }}
|
@ -16,7 +16,14 @@ image:
|
||||
# -- environment variables. See more environment variables in the [teamspeak image documentation](https://hub.docker.com/_/teamspeak).
|
||||
# @default -- See below
|
||||
env:
|
||||
TZ: UTC
|
||||
# TS3SERVER_LICENSE: accept
|
||||
# TS3SERVER_SERVERADMIN_PASSWORD:
|
||||
# valueFrom:
|
||||
# secretKeyRef:
|
||||
# name: teamspeak
|
||||
# key: serveradmin_password
|
||||
|
||||
|
||||
# -- Configures service settings for the chart.
|
||||
# @default -- See values.yaml
|
||||
@ -26,20 +33,17 @@ service:
|
||||
http:
|
||||
enabled: false
|
||||
primary: false
|
||||
voice:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 9987
|
||||
protocol: UDP
|
||||
tcp:
|
||||
enabled: true
|
||||
ports:
|
||||
serverquery:
|
||||
enabled: true
|
||||
port: 10011
|
||||
filetransfer:
|
||||
enabled: true
|
||||
port: 30033
|
||||
voice:
|
||||
enabled: true
|
||||
primary: true
|
||||
port: 9987
|
||||
protocol: UDP
|
||||
|
||||
probes:
|
||||
readiness:
|
||||
@ -65,6 +69,45 @@ persistence:
|
||||
enabled: false
|
||||
mountPath: /var/ts3server
|
||||
|
||||
metrics:
|
||||
# -- Enable and configure ts3exporter sidecar and Prometheus serviceMonitor.
|
||||
# @default -- See values.yaml
|
||||
enabled: false
|
||||
serviceMonitor:
|
||||
interval: 1m
|
||||
scrapeTimeout: 30s
|
||||
labels: {}
|
||||
# -- Enable and configure Prometheus Rules for the chart under this key.
|
||||
# @default -- See values.yaml
|
||||
prometheusRule:
|
||||
enabled: false
|
||||
labels: {}
|
||||
# -- Configure additionial rules for the chart under this key.
|
||||
# @default -- See prometheusrules.yaml
|
||||
rules: []
|
||||
# - alert: TeamSpeakDown
|
||||
# annotations:
|
||||
# description: Teamspeak service is down.
|
||||
# summary: Teamspeak is down.
|
||||
# expr: |
|
||||
# ts3_serverinfo_online == 0
|
||||
# for: 5m
|
||||
# labels:
|
||||
# severity: critical
|
||||
exporter:
|
||||
image:
|
||||
# -- image repository
|
||||
repository: quay.io/ricardbejarano/ts3exporter
|
||||
# -- image tag
|
||||
tag: 0.0.7
|
||||
# -- image pull policy
|
||||
pullPolicy: IfNotPresent
|
||||
env:
|
||||
# -- metrics port
|
||||
port: 9189
|
||||
# -- Set to true to enable gathering of channel metrics
|
||||
enableChannelMetrics: false
|
||||
|
||||
# -- The TeamSpeak server binary is only available for x86_64.
|
||||
nodeSelector:
|
||||
kubernetes.io/arch: amd64
|
||||
|
Loading…
Reference in New Issue
Block a user