diff --git a/qbittorrent/.helmignore b/qbittorrent/.helmignore new file mode 100644 index 00000000..46fd8996 --- /dev/null +++ b/qbittorrent/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +# OWNERS file for Kubernetes +OWNERS diff --git a/qbittorrent/Chart.yaml b/qbittorrent/Chart.yaml new file mode 100644 index 00000000..bfd98557 --- /dev/null +++ b/qbittorrent/Chart.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +appVersion: 4.1.8 +description: qBittorrent is a cross-platform free and open-source BitTorrent client +name: qbittorrent +version: 0.0.1 +keywords: + - qbittorrent + - torrrent +home: https://github.com/billimek/billimek-charts/tree/master/qbittorrent +icon: https://cloud.githubusercontent.com/assets/14862437/23586868/89ef2922-01c4-11e7-869c-52aafcece17f.png +sources: + - https://hub.docker.com/r/linuxserver/qbittorrent/ +maintainers: + - name: billimek + email: jeff@billimek.com diff --git a/qbittorrent/OWNERS b/qbittorrent/OWNERS new file mode 100644 index 00000000..51f88652 --- /dev/null +++ b/qbittorrent/OWNERS @@ -0,0 +1,4 @@ +approvers: +- billimek +reviewers: +- billimek \ No newline at end of file diff --git a/qbittorrent/README.md b/qbittorrent/README.md new file mode 100644 index 00000000..fb378959 --- /dev/null +++ b/qbittorrent/README.md @@ -0,0 +1,3 @@ +# qBitTorrent client + +TBD \ No newline at end of file diff --git a/qbittorrent/templates/NOTES.txt b/qbittorrent/templates/NOTES.txt new file mode 100644 index 00000000..3c7a99d0 --- /dev/null +++ b/qbittorrent/templates/NOTES.txt @@ -0,0 +1,19 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} +{{- end }} +{{- else if contains "NodePort" .Values.guiService.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "qbittorrent.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.guiService.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 {{ include "qbittorrent.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "qbittorrent.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.guiService.port }} +{{- else if contains "ClusterIP" .Values.guiService.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "qbittorrent.name" . }},app.kubernetes.io/instance={{ .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:80 +{{- end }} diff --git a/qbittorrent/templates/_helpers.tpl b/qbittorrent/templates/_helpers.tpl new file mode 100644 index 00000000..777d81b4 --- /dev/null +++ b/qbittorrent/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "qbittorrent.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 "qbittorrent.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 "qbittorrent.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/qbittorrent/templates/bt-svc.yaml b/qbittorrent/templates/bt-svc.yaml new file mode 100644 index 00000000..e4477149 --- /dev/null +++ b/qbittorrent/templates/bt-svc.yaml @@ -0,0 +1,52 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "qbittorrent.fullname" . }}-bt + labels: + app.kubernetes.io/name: {{ include "qbittorrent.name" . }} + helm.sh/chart: {{ include "qbittorrent.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- if .Values.btService.labels }} +{{ toYaml .Values.btService.labels | indent 4 }} +{{- end }} +{{- with .Values.btService.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: +{{- if (or (eq .Values.btService.type "ClusterIP") (empty .Values.btService.type)) }} + type: ClusterIP + {{- if .Values.btService.clusterIP }} + clusterIP: {{ .Values.btService.clusterIP }} + {{end}} +{{- else if eq .Values.btService.type "LoadBalancer" }} + type: {{ .Values.btService.type }} + {{- if .Values.btService.loadBalancerIP }} + loadBalancerIP: {{ .Values.btService.loadBalancerIP }} + {{- end }} + {{- if .Values.btService.loadBalancerSourceRanges }} + loadBalancerSourceRanges: +{{ toYaml .Values.btService.loadBalancerSourceRanges | indent 4 }} + {{- end -}} +{{- else }} + type: {{ .Values.btService.type }} +{{- end }} +{{- if .Values.btService.externalIPs }} + externalIPs: +{{ toYaml .Values.btService.externalIPs | indent 4 }} +{{- end }} + {{- if .Values.btService.externalTrafficPolicy }} + externalTrafficPolicy: {{ .Values.btService.externalTrafficPolicy }} + {{- end }} + ports: + - name: bt + port: {{ .Values.btService.port }} + protocol: TCP + targetPort: bt +{{ if (and (eq .Values.btService.type "NodePort") (not (empty .Values.btService.nodePort))) }} + nodePort: {{.Values.btService.nodePort}} +{{ end }} + selector: + app.kubernetes.io/name: {{ include "qbittorrent.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} \ No newline at end of file diff --git a/qbittorrent/templates/config-pvc.yaml b/qbittorrent/templates/config-pvc.yaml new file mode 100644 index 00000000..2eb44d71 --- /dev/null +++ b/qbittorrent/templates/config-pvc.yaml @@ -0,0 +1,24 @@ +{{- if and .Values.persistence.config.enabled (not .Values.persistence.config.existingClaim) }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "qbittorrent.fullname" . }}-config + labels: + app.kubernetes.io/name: {{ include "qbittorrent.name" . }} + helm.sh/chart: {{ include "qbittorrent.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + accessModes: + - {{ .Values.persistence.config.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.config.size | quote }} +{{- if .Values.persistence.config.storageClass }} +{{- if (eq "-" .Values.persistence.config.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.config.storageClass }}" +{{- end }} +{{- end }} +{{- end -}} \ No newline at end of file diff --git a/qbittorrent/templates/data-pvc.yaml b/qbittorrent/templates/data-pvc.yaml new file mode 100644 index 00000000..9a1eac0b --- /dev/null +++ b/qbittorrent/templates/data-pvc.yaml @@ -0,0 +1,25 @@ + +{{- if and .Values.persistence.data.enabled (not .Values.persistence.data.existingClaim) }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "qbittorrent.fullname" . }}-data + labels: + app.kubernetes.io/name: {{ include "qbittorrent.name" . }} + helm.sh/chart: {{ include "qbittorrent.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + accessModes: + - {{ .Values.persistence.data.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.data.size | quote }} +{{- if .Values.persistence.data.storageClass }} +{{- if (eq "-" .Values.persistence.data.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.data.storageClass }}" +{{- end }} +{{- end }} +{{- end -}} \ No newline at end of file diff --git a/qbittorrent/templates/deployment.yaml b/qbittorrent/templates/deployment.yaml new file mode 100644 index 00000000..d47830b6 --- /dev/null +++ b/qbittorrent/templates/deployment.yaml @@ -0,0 +1,97 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "qbittorrent.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "qbittorrent.name" . }} + helm.sh/chart: {{ include "qbittorrent.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + replicas: 1 + strategy: + type: {{ .Values.strategyType }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "qbittorrent.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "qbittorrent.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + {{- if .Values.podAnnotations }} + annotations: + {{- range $key, $value := .Values.podAnnotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: bt + containerPort: 6881 + protocol: TCP + - name: http + containerPort: 8080 + protocol: TCP + livenessProbe: + tcpSocket: + port: bt + readinessProbe: + tcpSocket: + port: bt + periodSeconds: 10 + successThreshold: 1 + failureThreshold: 3 + env: + - name: TZ + value: "{{ .Values.timezone }}" + - name: PUID + value: "{{ .Values.uid }}" + - name: PGID + value: "{{ .Values.gid }}" + - name: UMASK_SET + value: "{{ .Values.umask }}" + # - name: WEBUI_PORT + # value: "{{ .Values.guiService.port }}" + volumeMounts: + - mountPath: /config + name: config + - mountPath: /data + name: data + {{- if .Values.persistence.data.subPath }} + subPath: {{ .Values.persistence.data.subPath }} + {{ end }} + resources: +{{ toYaml .Values.resources | indent 12 }} + volumes: + - name: config + {{- if .Values.persistence.config.enabled }} + persistentVolumeClaim: + claimName: {{ if .Values.persistence.config.existingClaim }}{{ .Values.persistence.config.existingClaim }}{{- else }}{{ template "qbittorrent.fullname" . }}-config{{- end }} + {{- else }} + emptyDir: {} + {{ end }} + - name: data + {{- if .Values.persistence.data.enabled }} + persistentVolumeClaim: + claimName: {{ if .Values.persistence.data.existingClaim }}{{ .Values.persistence.data.existingClaim }}{{- else }}{{ template "qbittorrent.fullname" . }}-data{{- end }} + {{- else }} + emptyDir: {} + {{ end }} + {{- with .Values.nodeSelector }} + nodeSelector: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} + {{- end }} \ No newline at end of file diff --git a/qbittorrent/templates/gui-svc.yaml b/qbittorrent/templates/gui-svc.yaml new file mode 100644 index 00000000..e26177a1 --- /dev/null +++ b/qbittorrent/templates/gui-svc.yaml @@ -0,0 +1,52 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "qbittorrent.fullname" . }}-gui + labels: + app.kubernetes.io/name: {{ include "qbittorrent.name" . }} + helm.sh/chart: {{ include "qbittorrent.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- if .Values.guiService.labels }} +{{ toYaml .Values.guiService.labels | indent 4 }} +{{- end }} +{{- with .Values.guiService.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: +{{- if (or (eq .Values.guiService.type "ClusterIP") (empty .Values.guiService.type)) }} + type: ClusterIP + {{- if .Values.guiService.clusterIP }} + clusterIP: {{ .Values.guiService.clusterIP }} + {{end}} +{{- else if eq .Values.guiService.type "LoadBalancer" }} + type: {{ .Values.guiService.type }} + {{- if .Values.guiService.loadBalancerIP }} + loadBalancerIP: {{ .Values.guiService.loadBalancerIP }} + {{- end }} + {{- if .Values.guiService.loadBalancerSourceRanges }} + loadBalancerSourceRanges: +{{ toYaml .Values.guiService.loadBalancerSourceRanges | indent 4 }} + {{- end -}} +{{- else }} + type: {{ .Values.guiService.type }} +{{- end }} +{{- if .Values.guiService.externalIPs }} + externalIPs: +{{ toYaml .Values.guiService.externalIPs | indent 4 }} +{{- end }} + {{- if .Values.guiService.externalTrafficPolicy }} + externalTrafficPolicy: {{ .Values.guiService.externalTrafficPolicy }} + {{- end }} + ports: + - name: http + port: {{ .Values.guiService.port }} + protocol: TCP + targetPort: http +{{ if (and (eq .Values.guiService.type "NodePort") (not (empty .Values.guiService.nodePort))) }} + nodePort: {{.Values.guiService.nodePort}} +{{ end }} + selector: + app.kubernetes.io/name: {{ include "qbittorrent.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} \ No newline at end of file diff --git a/qbittorrent/templates/ingress.yaml b/qbittorrent/templates/ingress.yaml new file mode 100644 index 00000000..a921f0ca --- /dev/null +++ b/qbittorrent/templates/ingress.yaml @@ -0,0 +1,38 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "qbittorrent.fullname" . -}} +{{- $ingressPath := .Values.ingress.path -}} +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + app.kubernetes.io/name: {{ include "qbittorrent.name" . }} + helm.sh/chart: {{ include "qbittorrent.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- with .Values.ingress.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ . }} + http: + paths: + - path: {{ $ingressPath }} + backend: + serviceName: {{ $fullName }}-gui + servicePort: http + {{- end }} +{{- end }} \ No newline at end of file diff --git a/qbittorrent/values.yaml b/qbittorrent/values.yaml new file mode 100644 index 00000000..e545f2e5 --- /dev/null +++ b/qbittorrent/values.yaml @@ -0,0 +1,124 @@ +# Default values for qbittorrent. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +# upgrade strategy type (e.g. Recreate or RollingUpdate) +strategyType: Recreate + +nameOverride: "" +fullnameOverride: "" + +# timezone: UTC +umask: 022 +uid: 1001 +gid: 1001 + +image: + repository: linuxserver/qbittorrent + tag: 4.1.8.99201910202234-6729-cb31684ubuntu18.04.1-ls47 + pullPolicy: IfNotPresent +# resources: +# requests: +# cpu: "50m" +# memory: "50Mi" +# limits: +# memory: "1Gi" + +guiService: + type: ClusterIP + port: 8080 + ## 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: {} + 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 + +btService: + type: NodePort + port: 6881 + ## 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: {} + 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: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + path: / + hosts: + - chart-example.local + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +persistence: + config: + enabled: true + ## configuration data Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + accessMode: ReadWriteOnce + size: 1Gi + data: + enabled: true + ## torrents data volume configuration + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + # subPath: some-subpath + accessMode: ReadWriteOnce + size: 10Gi + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +podAnnotations: {}