From 0da018df2f0f0c1859f446321eb9eb056c7185bf Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Thu, 7 May 2020 21:47:48 +0100 Subject: [PATCH] Deluge fixes for #3 --- charts/deluge/Chart.yaml | 2 +- charts/deluge/templates/bttcp-service.yaml | 13 ++--- charts/deluge/templates/btudp-service.yaml | 6 ++- charts/deluge/templates/daemon-service.yaml | 53 +++++++++++++++++++++ charts/deluge/values.yaml | 32 ++++++++++++- 5 files changed, 92 insertions(+), 14 deletions(-) create mode 100644 charts/deluge/templates/daemon-service.yaml diff --git a/charts/deluge/Chart.yaml b/charts/deluge/Chart.yaml index 5a9b276..5d22964 100644 --- a/charts/deluge/Chart.yaml +++ b/charts/deluge/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: Deluge is a Python BitTorrent client based on libtorrent name: deluge -version: 1.1.2 +version: 1.2.0 keywords: - deluge - libtorrent diff --git a/charts/deluge/templates/bttcp-service.yaml b/charts/deluge/templates/bttcp-service.yaml index 236349e..11860cc 100644 --- a/charts/deluge/templates/bttcp-service.yaml +++ b/charts/deluge/templates/bttcp-service.yaml @@ -1,3 +1,5 @@ +--- +{{ if .Values.btservice.enabled }} apiVersion: v1 kind: Service metadata: @@ -40,21 +42,14 @@ spec: externalTrafficPolicy: {{ .Values.btservice.externalTrafficPolicy }} {{- end }} ports: - - name: daemon - port: 58846 - protocol: TCP - targetPort: daemon -{{ if (eq .Values.btservice.type "NodePort") }} - nodePort: 58846 -{{ end }} - name: bt-tcp port: 58946 protocol: TCP targetPort: bt-tcp {{ if (eq .Values.btservice.type "NodePort") }} - nodePort: 58946 + nodePort: {{ default 30846 .Values.btservice.nodePort }} {{ end }} selector: app.kubernetes.io/name: {{ include "deluge.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} - \ No newline at end of file +{{ end }} diff --git a/charts/deluge/templates/btudp-service.yaml b/charts/deluge/templates/btudp-service.yaml index 9dc7f43..d3df898 100644 --- a/charts/deluge/templates/btudp-service.yaml +++ b/charts/deluge/templates/btudp-service.yaml @@ -1,3 +1,5 @@ +--- +{{ if .Values.btservice.enabled }} apiVersion: v1 kind: Service metadata: @@ -45,9 +47,9 @@ spec: protocol: UDP targetPort: bt-udp {{ if (eq .Values.btservice.type "NodePort") }} - nodePort: 58946 + nodePort: {{ default 30846 .Values.btservice.nodePort }} {{ end }} selector: app.kubernetes.io/name: {{ include "deluge.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} - \ No newline at end of file +{{ end }} diff --git a/charts/deluge/templates/daemon-service.yaml b/charts/deluge/templates/daemon-service.yaml new file mode 100644 index 0000000..bc9a409 --- /dev/null +++ b/charts/deluge/templates/daemon-service.yaml @@ -0,0 +1,53 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "deluge.fullname" . }}-daemon + labels: + app.kubernetes.io/name: {{ include "deluge.name" . }} + helm.sh/chart: {{ include "deluge.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- if .Values.daemonservice.labels }} +{{ toYaml .Values.daemonservice.labels | indent 4 }} +{{- end }} +{{- with .Values.daemonservice.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: +{{- if (or (eq .Values.daemonservice.type "ClusterIP") (empty .Values.daemonservice.type)) }} + type: ClusterIP + {{- if .Values.daemonservice.clusterIP }} + clusterIP: {{ .Values.daemonservice.clusterIP }} + {{end}} +{{- else if eq .Values.daemonservice.type "LoadBalancer" }} + type: {{ .Values.daemonservice.type }} + {{- if .Values.daemonservice.loadBalancerIP }} + loadBalancerIP: {{ .Values.daemonservice.loadBalancerIP }} + {{- end }} + {{- if .Values.daemonservice.loadBalancerSourceRanges }} + loadBalancerSourceRanges: +{{ toYaml .Values.daemonservice.loadBalancerSourceRanges | indent 4 }} + {{- end -}} +{{- else }} + type: {{ .Values.daemonservice.type }} +{{- end }} +{{- if .Values.daemonservice.externalIPs }} + externalIPs: +{{ toYaml .Values.daemonservice.externalIPs | indent 4 }} +{{- end }} + {{- if .Values.daemonservice.externalTrafficPolicy }} + externalTrafficPolicy: {{ .Values.daemonservice.externalTrafficPolicy }} + {{- end }} + ports: + - name: daemon + port: 58846 + protocol: TCP + targetPort: daemon +{{ if (eq .Values.daemonservice.type "NodePort") }} + nodePort: {{ default 30846 .Values.daemonservice.nodePort }} +{{ end }} + selector: + app.kubernetes.io/name: {{ include "deluge.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + \ No newline at end of file diff --git a/charts/deluge/values.yaml b/charts/deluge/values.yaml index 812c124..0070d70 100644 --- a/charts/deluge/values.yaml +++ b/charts/deluge/values.yaml @@ -32,6 +32,7 @@ pgid: 1001 ## # dockerMods: linuxserver/deluge:ssh +## Service for the WebUI port webuiservice: type: ClusterIP port: 8112 @@ -53,8 +54,10 @@ webuiservice: ## Set the externalTrafficPolicy in the Service to either Cluster or Local # externalTrafficPolicy: Cluster -btservice: - type: NodePort +## Service for the Daemon port +daemonservice: + type: ClusterIP + port: ## Specify the nodePort value for the LoadBalancer and NodePort service types. ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport ## @@ -73,6 +76,31 @@ btservice: ## Set the externalTrafficPolicy in the Service to either Cluster or Local # externalTrafficPolicy: Cluster +## Service for the BT taffic port - ideally these should be a LB due to a high port +## and also sharing TCP and UDP services on the same port. +btservice: + enabled: false + type: LoadBalancer + ## 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: {} + # annotations: + # metallb.universe.tf/allow-shared-ip: deluge + 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 annotations: {}