mirror of
https://github.com/truenas/charts.git
synced 2026-04-05 11:48:55 +08:00
Update plex chart to use library chart to render services configuration
This commit is contained in:
@@ -1,52 +0,0 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "plex.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "plex.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "plex.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "plex.labels" -}}
|
||||
helm.sh/chart: {{ include "plex.chart" . }}
|
||||
{{ include "plex.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "plex.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "plex.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end -}}
|
||||
@@ -1,35 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
{{- if .Values.hostNetwork }}
|
||||
name: {{ include "plex.fullname" . }}-tcp-cluster-ip
|
||||
{{- else }}
|
||||
name: {{ include "plex.fullname" . }}-tcp
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "plex.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if .Values.hostNetwork }}
|
||||
type: ClusterIP
|
||||
{{- else }}
|
||||
type: NodePort
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: pms
|
||||
port: {{ .Values.plexServiceTCP.port }}
|
||||
protocol: TCP
|
||||
targetPort: pms
|
||||
{{- if eq .Values.hostNetwork false }}
|
||||
nodePort: {{.Values.plexServiceTCP.port}}
|
||||
{{- end }}
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: pms
|
||||
- name: https
|
||||
port: 443
|
||||
targetPort: pms
|
||||
- name: plex-dlna
|
||||
port: 1900
|
||||
targetPort: plex-dlna
|
||||
selector:
|
||||
{{- include "plex.selectorLabels" . | nindent 4 }}
|
||||
{{ $svc := .Values.plexServiceTCP }}
|
||||
{{ $ports := list }}
|
||||
{{ $ports = mustAppend $ports (dict "name" "pms" "port" $svc.port "nodePort" $svc.port "targetPort" "pms") }}
|
||||
{{ $ports = mustAppend $ports (dict "name" "http" "port" 80 "targetPort" "pms") }}
|
||||
{{ $ports = mustAppend $ports (dict "name" "https" "port" 443 "targetPort" "pms") }}
|
||||
{{ $ports = mustAppend $ports (dict "name" "plex-dlna" "port" 1900 "targetPort" "plex-dlna") }}
|
||||
{{ $params := . }}
|
||||
{{ $_ := set $params "service" (dict "ports" $ports ) }}
|
||||
{{ if .Values.hostNetwork }}
|
||||
{{ $_ := set $params.service "nameSuffix" "tcp-cluster-ip" }}
|
||||
{{ $_1 := set $params.service "type" "ClusterIP" }}
|
||||
{{ else }}
|
||||
{{ $_ := set $params.service "nameSuffix" "tcp" }}
|
||||
{{ $_1 := set $params.service "type" "NodePort" }}
|
||||
{{ end }}
|
||||
{{ include "common.classes.service" $params }}
|
||||
|
||||
@@ -1,31 +1,9 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "plex.fullname" . }}-udp
|
||||
labels:
|
||||
{{- include "plex.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
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:
|
||||
{{- include "plex.selectorLabels" . | nindent 4 }}
|
||||
{{ $ports := list }}
|
||||
{{ $ports = mustAppend $ports (dict "name" "plex-dlna-udp" "port" 1900 "protocol" "UDP" "targetPort" "plex-dlna-udp") }}
|
||||
{{ $ports = mustAppend $ports (dict "name" "plex-gdm1" "port" 32410 "protocol" "UDP" "targetPort" "plex-gdm1") }}
|
||||
{{ $ports = mustAppend $ports (dict "name" "plex-gdm2" "port" 32412 "protocol" "UDP" "targetPort" "plex-gdm2") }}
|
||||
{{ $ports = mustAppend $ports (dict "name" "plex-gdm3" "port" 32413 "protocol" "UDP" "targetPort" "plex-gdm3") }}
|
||||
{{ $ports = mustAppend $ports (dict "name" "plex-gdm4" "port" 32414 "protocol" "UDP" "targetPort" "plex-gdm4") }}
|
||||
{{ $params := . }}
|
||||
{{ $_ := set $params "service" (dict "type" "ClusterIP" "ports" $ports "nameSuffix" "udp" ) }}
|
||||
{{ include "common.classes.service" $params }}
|
||||
|
||||
Reference in New Issue
Block a user