Skip to content
This repository was archived by the owner on Oct 10, 2020. It is now read-only.

Commit b71d3e7

Browse files
authored
[plex] add UDP to plex (#266)
* add UDP to plex * fix up udp type * comment out metallb annotations * remove pesky ports
1 parent 2780dae commit b71d3e7

File tree

7 files changed

+161
-60
lines changed

7 files changed

+161
-60
lines changed

charts/plex/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v1
22
appVersion: 1.19.1.2645-ccb6eb67e
33
description: Plex Media Server
44
name: plex
5-
version: 1.4.0
5+
version: 1.5.0
66
keywords:
77
- plex
88
home: https://plex.tv/

charts/plex/templates/NOTES.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
{{- range $host := .Values.ingress.hosts }}
44
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}
55
{{- end }}
6-
{{- else if contains "NodePort" .Values.service.type }}
6+
{{- else if contains "NodePort" .Values.serviceTCP.type }}
77
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "plex.fullname" . }})
88
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
99
echo http://$NODE_IP:$NODE_PORT
10-
{{- else if contains "LoadBalancer" .Values.service.type }}
10+
{{- else if contains "LoadBalancer" .Values.serviceTCP.type }}
1111
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
1212
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "plex.fullname" . }}'
1313
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "plex.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
14-
echo http://$SERVICE_IP:{{ .Values.service.port }}
15-
{{- else if contains "ClusterIP" .Values.service.type }}
14+
echo http://$SERVICE_IP:{{ .Values.serviceTCP.port }}
15+
{{- else if contains "ClusterIP" .Values.serviceTCP.type }}
1616
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "plex.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
1717
echo "Visit http://127.0.0.1:8080 to use your application"
1818
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80

charts/plex/templates/deployment.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,26 @@ spec:
6969
imagePullPolicy: {{ .Values.image.pullPolicy }}
7070
ports:
7171
- name: pms
72+
protocol: TCP
7273
containerPort: 32400
74+
- name: plex-dlna
75+
protocol: TCP
76+
containerPort: 32469
77+
- name: plex-dlna-udp
78+
protocol: UDP
79+
containerPort: 1900
80+
- name: plex-gdm1
81+
protocol: UDP
82+
containerPort: 32410
83+
- name: plex-gdm2
84+
protocol: UDP
85+
containerPort: 32412
86+
- name: plex-gdm3
87+
protocol: UDP
88+
containerPort: 32413
89+
- name: plex-gdm4
90+
protocol: UDP
91+
containerPort: 32414
7392
env:
7493
- name: TZ
7594
value: "{{ .Values.timezone }}"
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "plex.fullname" . }}-tcp
5+
labels:
6+
{{- include "plex.labels" . | nindent 4 }}
7+
{{- if .Values.serviceTCP.labels }}
8+
{{ toYaml .Values.serviceTCP.labels | indent 4 }}
9+
{{- end }}
10+
{{- with .Values.serviceTCP.annotations }}
11+
annotations:
12+
{{ toYaml . | indent 4 }}
13+
{{- end }}
14+
spec:
15+
{{- if (or (eq .Values.serviceTCP.type "ClusterIP") (empty .Values.serviceTCP.type)) }}
16+
type: ClusterIP
17+
{{- if .Values.serviceTCP.clusterIP }}
18+
clusterIP: {{ .Values.serviceTCP.clusterIP }}
19+
{{end}}
20+
{{- else if eq .Values.serviceTCP.type "LoadBalancer" }}
21+
type: {{ .Values.serviceTCP.type }}
22+
{{- if .Values.serviceTCP.loadBalancerIP }}
23+
loadBalancerIP: {{ .Values.serviceTCP.loadBalancerIP }}
24+
{{- end }}
25+
{{- if .Values.serviceTCP.loadBalancerSourceRanges }}
26+
loadBalancerSourceRanges:
27+
{{ toYaml .Values.serviceTCP.loadBalancerSourceRanges | indent 4 }}
28+
{{- end -}}
29+
{{- else }}
30+
type: {{ .Values.serviceTCP.type }}
31+
{{- end }}
32+
{{- if .Values.serviceTCP.externalIPs }}
33+
externalIPs:
34+
{{ toYaml .Values.serviceTCP.externalIPs | indent 4 }}
35+
{{- end }}
36+
{{- if .Values.serviceTCP.externalTrafficPolicy }}
37+
externalTrafficPolicy: {{ .Values.serviceTCP.externalTrafficPolicy }}
38+
{{- end }}
39+
ports:
40+
- name: pms
41+
port: {{ .Values.serviceTCP.port }}
42+
protocol: TCP
43+
targetPort: pms
44+
{{ if (and (eq .Values.serviceTCP.type "NodePort") (not (empty .Values.serviceTCP.nodePort))) }}
45+
nodePort: {{.Values.serviceTCP.nodePort}}
46+
{{ end }}
47+
- name: http
48+
port: 80
49+
targetPort: pms
50+
- name: https
51+
port: 443
52+
targetPort: pms
53+
- name: plex-dlna
54+
port: 1900
55+
targetPort: plex-dlna
56+
selector:
57+
{{- include "plex.selectorLabels" . | nindent 4 }}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "plex.fullname" . }}-udp
5+
labels:
6+
{{- include "plex.labels" . | nindent 4 }}
7+
{{- if .Values.serviceUDP.labels }}
8+
{{ toYaml .Values.serviceUDP.labels | indent 4 }}
9+
{{- end }}
10+
{{- with .Values.serviceUDP.annotations }}
11+
annotations:
12+
{{ toYaml . | indent 4 }}
13+
{{- end }}
14+
spec:
15+
{{- if (or (eq .Values.serviceUDP.type "ClusterIP") (empty .Values.serviceUDP.type)) }}
16+
type: ClusterIP
17+
{{- if .Values.serviceUDP.clusterIP }}
18+
clusterIP: {{ .Values.serviceUDP.clusterIP }}
19+
{{end}}
20+
{{- else if eq .Values.serviceUDP.type "LoadBalancer" }}
21+
type: {{ .Values.serviceUDP.type }}
22+
{{- if .Values.serviceUDP.loadBalancerIP }}
23+
loadBalancerIP: {{ .Values.serviceUDP.loadBalancerIP }}
24+
{{- end }}
25+
{{- if .Values.serviceUDP.loadBalancerSourceRanges }}
26+
loadBalancerSourceRanges:
27+
{{ toYaml .Values.serviceUDP.loadBalancerSourceRanges | indent 4 }}
28+
{{- end -}}
29+
{{- else }}
30+
type: {{ .Values.serviceUDP.type }}
31+
{{- end }}
32+
{{- if .Values.serviceUDP.externalIPs }}
33+
externalIPs:
34+
{{ toYaml .Values.serviceUDP.externalIPs | indent 4 }}
35+
{{- end }}
36+
{{- if .Values.serviceUDP.externalTrafficPolicy }}
37+
externalTrafficPolicy: {{ .Values.serviceUDP.externalTrafficPolicy }}
38+
{{- end }}
39+
ports:
40+
- name: plex-dlna-udp
41+
port: 1900
42+
protocol: UDP
43+
targetPort: plex-dlna-udp
44+
- name: plex-gdm1
45+
port: 32410
46+
protocol: UDP
47+
targetPort: plex-gdm1
48+
- name: plex-gdm2
49+
port: 32412
50+
protocol: UDP
51+
targetPort: plex-gdm2
52+
- name: plex-gdm3
53+
port: 32413
54+
protocol: UDP
55+
targetPort: plex-gdm3
56+
- name: plex-gdm4
57+
port: 32414
58+
protocol: UDP
59+
targetPort: plex-gdm4
60+
selector:
61+
{{- include "plex.selectorLabels" . | nindent 4 }}

charts/plex/templates/service.yaml

Lines changed: 0 additions & 54 deletions
This file was deleted.

charts/plex/values.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ securityContext: {}
6767
# runAsNonRoot: true
6868
# runAsUser: 1000
6969

70-
service:
70+
serviceTCP:
7171
type: ClusterIP
7272
port: 32400
7373
## Specify the nodePort value for the LoadBalancer and NodePort service types.
@@ -79,6 +79,24 @@ service:
7979
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
8080
##
8181
annotations: {}
82+
# metallb.universe.tf/allow-shared-ip: plex-svc
83+
labels: {}
84+
## Use loadBalancerIP to request a specific static IP,
85+
## otherwise leave blank
86+
##
87+
loadBalancerIP:
88+
# loadBalancerSourceRanges: []
89+
## Set the externalTrafficPolicy in the Service to either Cluster or Local
90+
# externalTrafficPolicy: Cluster
91+
92+
serviceUDP:
93+
type: ClusterIP
94+
## Provide any additional annotations which may be required. This can be used to
95+
## set the LoadBalancer service type to internal only.
96+
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
97+
##
98+
annotations: {}
99+
# metallb.universe.tf/allow-shared-ip: plex-svc
82100
labels: {}
83101
## Use loadBalancerIP to request a specific static IP,
84102
## otherwise leave blank

0 commit comments

Comments
 (0)