mirror of
https://github.com/truenas/charts.git
synced 2026-11-14 06:48:09 +00:00
Update plex chart to use library chart to render services configuration
This commit is contained in:
1 parent
387dd82843
commit
4b3bad4efc
3 files changed
+25
-118
No files matched your search
@@ -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
|
{{ $svc := .Values.plexServiceTCP }}
|
||||||
kind: Service
|
{{ $ports := list }}
|
||||||
metadata:
|
{{ $ports = mustAppend $ports (dict "name" "pms" "port" $svc.port "nodePort" $svc.port "targetPort" "pms") }}
|
||||||
{{- if .Values.hostNetwork }}
|
{{ $ports = mustAppend $ports (dict "name" "http" "port" 80 "targetPort" "pms") }}
|
||||||
name: {{ include "plex.fullname" . }}-tcp-cluster-ip
|
{{ $ports = mustAppend $ports (dict "name" "https" "port" 443 "targetPort" "pms") }}
|
||||||
{{- else }}
|
{{ $ports = mustAppend $ports (dict "name" "plex-dlna" "port" 1900 "targetPort" "plex-dlna") }}
|
||||||
name: {{ include "plex.fullname" . }}-tcp
|
{{ $params := . }}
|
||||||
{{- end }}
|
{{ $_ := set $params "service" (dict "ports" $ports ) }}
|
||||||
labels:
|
{{ if .Values.hostNetwork }}
|
||||||
{{- include "plex.labels" . | nindent 4 }}
|
{{ $_ := set $params.service "nameSuffix" "tcp-cluster-ip" }}
|
||||||
spec:
|
{{ $_1 := set $params.service "type" "ClusterIP" }}
|
||||||
{{- if .Values.hostNetwork }}
|
{{ else }}
|
||||||
type: ClusterIP
|
{{ $_ := set $params.service "nameSuffix" "tcp" }}
|
||||||
{{- else }}
|
{{ $_1 := set $params.service "type" "NodePort" }}
|
||||||
type: NodePort
|
{{ end }}
|
||||||
{{- end }}
|
{{ include "common.classes.service" $params }}
|
||||||
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 }}
|
|
||||||
@@ -1,31 +1,9 @@
|
|||||||
apiVersion: v1
|
{{ $ports := list }}
|
||||||
kind: Service
|
{{ $ports = mustAppend $ports (dict "name" "plex-dlna-udp" "port" 1900 "protocol" "UDP" "targetPort" "plex-dlna-udp") }}
|
||||||
metadata:
|
{{ $ports = mustAppend $ports (dict "name" "plex-gdm1" "port" 32410 "protocol" "UDP" "targetPort" "plex-gdm1") }}
|
||||||
name: {{ include "plex.fullname" . }}-udp
|
{{ $ports = mustAppend $ports (dict "name" "plex-gdm2" "port" 32412 "protocol" "UDP" "targetPort" "plex-gdm2") }}
|
||||||
labels:
|
{{ $ports = mustAppend $ports (dict "name" "plex-gdm3" "port" 32413 "protocol" "UDP" "targetPort" "plex-gdm3") }}
|
||||||
{{- include "plex.labels" . | nindent 4 }}
|
{{ $ports = mustAppend $ports (dict "name" "plex-gdm4" "port" 32414 "protocol" "UDP" "targetPort" "plex-gdm4") }}
|
||||||
spec:
|
{{ $params := . }}
|
||||||
type: ClusterIP
|
{{ $_ := set $params "service" (dict "type" "ClusterIP" "ports" $ports "nameSuffix" "udp" ) }}
|
||||||
ports:
|
{{ include "common.classes.service" $params }}
|
||||||
- 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 }}
|
|
||||||
Reference in new issue
Block a user