diff --git a/charts/kube-plex/templates/NOTES.txt b/charts/kube-plex/templates/NOTES.txt index ccfecb7e..dd0a07cf 100644 --- a/charts/kube-plex/templates/NOTES.txt +++ b/charts/kube-plex/templates/NOTES.txt @@ -3,17 +3,17 @@ {{- range .Values.ingress.hosts }} http://{{ . }} {{- end }} -{{- else if contains "NodePort" .Values.service.type }} +{{- else if contains "NodePort" .Values.serviceTCP.type }} export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} +{{- else if contains "LoadBalancer" .Values.serviceTCP.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. You can watch the status of by running 'kubectl get svc -w {{ template "fullname" . }}' export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') - echo http://$SERVICE_IP:{{ .Values.service.externalPort }} -{{- else if contains "ClusterIP" .Values.service.type }} + echo http://$SERVICE_IP:{{ .Values.serviceTCP.externalPort }} +{{- else if contains "ClusterIP" .Values.serviceTCP.type }} export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") echo "Visit http://127.0.0.1:8080 to use your application" - kubectl port-forward $POD_NAME 8080:{{ .Values.service.externalPort }} + kubectl port-forward $POD_NAME 8080:{{ .Values.serviceTCP.externalPort }} {{- end }} diff --git a/charts/kube-plex/templates/deployment.yaml b/charts/kube-plex/templates/deployment.yaml index eafe64b8..9fea0792 100644 --- a/charts/kube-plex/templates/deployment.yaml +++ b/charts/kube-plex/templates/deployment.yaml @@ -82,11 +82,32 @@ spec: timeoutSeconds: 10 ports: - name: pms + protocol: TCP containerPort: 32400 - name: http + protocol: TCP containerPort: 32400 - name: https + protocol: TCP containerPort: 32443 + - name: plex-dlna + protocol: TCP + containerPort: 32469 + - name: plex-dlna-udp + protocol: UDP + containerPort: 1900 + - name: plex-gdm1 + protocol: UDP + containerPort: 32410 + - name: plex-gdm2 + protocol: UDP + containerPort: 32412 + - name: plex-gdm3 + protocol: UDP + containerPort: 32413 + - name: plex-gdm4 + protocol: UDP + containerPort: 32414 env: - name: TZ value: "{{ .Values.timezone }}" diff --git a/charts/kube-plex/templates/service-tcp.yaml b/charts/kube-plex/templates/service-tcp.yaml new file mode 100644 index 00000000..d6c78717 --- /dev/null +++ b/charts/kube-plex/templates/service-tcp.yaml @@ -0,0 +1,61 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }}-tcp + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- if .Values.serviceTCP.labels }} +{{ toYaml .Values.serviceTCP.labels | indent 4 }} +{{- end }} +{{- with .Values.serviceTCP.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: +{{- if (or (eq .Values.serviceTCP.type "ClusterIP") (empty .Values.serviceTCP.type)) }} + type: ClusterIP + {{- if .Values.serviceTCP.clusterIP }} + clusterIP: {{ .Values.serviceTCP.clusterIP }} + {{end}} +{{- else if eq .Values.serviceTCP.type "LoadBalancer" }} + type: {{ .Values.serviceTCP.type }} + {{- if .Values.serviceTCP.loadBalancerIP }} + loadBalancerIP: {{ .Values.serviceTCP.loadBalancerIP }} + {{- end }} + {{- if .Values.serviceTCP.loadBalancerSourceRanges }} + loadBalancerSourceRanges: +{{ toYaml .Values.serviceTCP.loadBalancerSourceRanges | indent 4 }} + {{- end -}} +{{- else }} + type: {{ .Values.serviceTCP.type }} +{{- end }} +{{- if .Values.serviceTCP.externalIPs }} + externalIPs: +{{ toYaml .Values.serviceTCP.externalIPs | indent 4 }} +{{- end }} + {{- if .Values.serviceTCP.externalTrafficPolicy }} + externalTrafficPolicy: {{ .Values.serviceTCP.externalTrafficPolicy }} + {{- end }} + ports: + - name: pms + port: {{ .Values.serviceTCP.port }} + protocol: TCP + targetPort: pms +{{ if (and (eq .Values.serviceTCP.type "NodePort") (not (empty .Values.serviceTCP.nodePort))) }} + nodePort: {{.Values.serviceTCP.nodePort}} +{{ end }} + - name: http + port: 80 + targetPort: pms + - name: https + port: 443 + targetPort: https + - name: plex-dlna + port: 1900 + targetPort: plex-dlna + selector: + app: {{ template "name" . }} + release: {{ .Release.Name }} diff --git a/charts/kube-plex/templates/service-udp.yaml b/charts/kube-plex/templates/service-udp.yaml new file mode 100644 index 00000000..f37a2107 --- /dev/null +++ b/charts/kube-plex/templates/service-udp.yaml @@ -0,0 +1,65 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }}-udp + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- if .Values.serviceUDP.labels }} +{{ toYaml .Values.serviceUDP.labels | indent 4 }} +{{- end }} +{{- with .Values.serviceUDP.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: +{{- if (or (eq .Values.serviceUDP.type "ClusterIP") (empty .Values.serviceUDP.type)) }} + type: ClusterIP + {{- if .Values.serviceUDP.clusterIP }} + clusterIP: {{ .Values.serviceUDP.clusterIP }} + {{end}} +{{- else if eq .Values.serviceUDP.type "LoadBalancer" }} + type: {{ .Values.serviceUDP.type }} + {{- if .Values.serviceUDP.loadBalancerIP }} + loadBalancerIP: {{ .Values.serviceUDP.loadBalancerIP }} + {{- end }} + {{- if .Values.serviceUDP.loadBalancerSourceRanges }} + loadBalancerSourceRanges: +{{ toYaml .Values.serviceUDP.loadBalancerSourceRanges | indent 4 }} + {{- end -}} +{{- else }} + type: {{ .Values.serviceUDP.type }} +{{- end }} +{{- if .Values.serviceUDP.externalIPs }} + externalIPs: +{{ toYaml .Values.serviceUDP.externalIPs | indent 4 }} +{{- end }} + {{- if .Values.serviceUDP.externalTrafficPolicy }} + externalTrafficPolicy: {{ .Values.serviceUDP.externalTrafficPolicy }} + {{- end }} + ports: + - name: plex-dlna-udp + port: 1900 + protocol: UDP + targetPort: plex-dlna-udp + - name: plex-gdm1 + port: 32410 + protocol: UDP + targetPort: plex-gdm1 + - name: plex-gdm2 + port: 32412 + protocol: UDP + targetPort: plex-gdm2 + - name: plex-gdm3 + port: 32413 + protocol: UDP + targetPort: plex-gdm3 + - name: plex-gdm4 + port: 32414 + protocol: UDP + targetPort: plex-gdm4 + selector: + app: {{ template "name" . }} + release: {{ .Release.Name }} diff --git a/charts/kube-plex/templates/service.yaml b/charts/kube-plex/templates/service.yaml deleted file mode 100644 index f850d581..00000000 --- a/charts/kube-plex/templates/service.yaml +++ /dev/null @@ -1,59 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ template "fullname" . }} - labels: - app: {{ template "name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -{{- if .Values.service.labels }} -{{ toYaml .Values.service.labels | indent 4 }} -{{- end }} -{{- with .Values.service.annotations }} - annotations: -{{ toYaml . | indent 4 }} -{{- end }} -spec: -{{- if (or (eq .Values.service.type "ClusterIP") (empty .Values.service.type)) }} - type: ClusterIP - {{- if .Values.service.clusterIP }} - clusterIP: {{ .Values.service.clusterIP }} - {{end}} -{{- else if eq .Values.service.type "LoadBalancer" }} - type: {{ .Values.service.type }} - {{- if .Values.service.loadBalancerIP }} - loadBalancerIP: {{ .Values.service.loadBalancerIP }} - {{- end }} - {{- if .Values.service.loadBalancerSourceRanges }} - loadBalancerSourceRanges: -{{ toYaml .Values.service.loadBalancerSourceRanges | indent 4 }} - {{- end -}} -{{- else }} - type: {{ .Values.service.type }} -{{- end }} -{{- if .Values.service.externalIPs }} - externalIPs: -{{ toYaml .Values.service.externalIPs | indent 4 }} -{{- end }} - {{- if .Values.service.externalTrafficPolicy }} - externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }} - {{- end }} - ports: - - name: pms - port: {{ .Values.service.port }} - protocol: TCP - targetPort: pms -{{ if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }} - nodePort: {{.Values.service.nodePort}} -{{ end }} - - name: http - port: 80 - targetPort: pms - - name: https - port: 443 - targetPort: 32443 - selector: - app: {{ template "name" . }} - release: {{ .Release.Name }} - diff --git a/charts/kube-plex/values.yaml b/charts/kube-plex/values.yaml index 5374de66..926aefd9 100644 --- a/charts/kube-plex/values.yaml +++ b/charts/kube-plex/values.yaml @@ -19,7 +19,7 @@ claimToken: "" # Set the timezone of the plex server timezone: Europe/London -service: +serviceTCP: type: ClusterIP port: 32400 ## Specify the nodePort value for the LoadBalancer and NodePort service types. @@ -30,7 +30,8 @@ service: ## set the LoadBalancer service type to internal only. ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer ## - annotations: {} + annotations: + metallb.universe.tf/allow-shared-ip: plex-svc labels: {} ## Use loadBalancerIP to request a specific static IP, ## otherwise leave blank @@ -40,6 +41,27 @@ service: ## Set the externalTrafficPolicy in the Service to either Cluster or Local # externalTrafficPolicy: Cluster +serviceUDP: + + ## Specify the nodePort value for the LoadBalancer and NodePort service types. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport + ## + # nodePort: + ## Provide any additional annotations which may be required. This can be used to + ## set the LoadBalancer service type to internal only. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer + ## + annotations: + metallb.universe.tf/allow-shared-ip: plex-svc + labels: {} + ## Use loadBalancerIP to request a specific static IP, + ## otherwise leave blank + ## + loadBalancerIP: + # loadBalancerSourceRanges: [] + ## Set the externalTrafficPolicy in the Service to either Cluster or Local + # externalTrafficPolicy: Cluster + ingress: enabled: false # Used to create an Ingress record. @@ -96,7 +118,7 @@ persistence: accessMode: ReadWriteMany extraData: [] # Optionally specifify additional Data mounts. These will be mounted as - # /data-${name}. This should be in the same format as the above 'data', + # /data-${name}. This should be in the same format as the above 'data', # with the additional field 'name' # - claimName: "special-tv" # name: 'foo' @@ -133,7 +155,7 @@ podAnnotations: {} deploymentAnnotations: {} -proxy: +proxy: # This allows to set a proxy environment variable, which PMS uses to fetch the token and assets like movie cover enable: false # http: "http://proxy:8080"