updated readme and restructure project

This commit is contained in:
2025-02-28 20:04:52 +02:00
parent 8e8d1a65e2
commit efdaba6169
60 changed files with 109 additions and 120 deletions

View File

@ -0,0 +1,6 @@
apiVersion: v2
name: qbittorrent
description: A Helm chart for deploying qBittorrent with WireGuard
type: application
version: 0.1.0
appVersion: "latest"

View File

@ -0,0 +1,19 @@
{{/*
Expand the helper functions for the qBittorrent Helm chart
*/}}
{{- define "qbittorrent.fullname" -}}
{{- printf "%s-%s" .Release.Name .Chart.Name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "qbittorrent.serviceName" -}}
{{- printf "%s-service" (include "qbittorrent.fullname" .) -}}
{{- end -}}
{{- define "qbittorrent.deploymentName" -}}
{{- printf "%s-deployment" (include "qbittorrent.fullname" .) -}}
{{- end -}}
{{- define "qbittorrent.configMapName" -}}
{{- printf "%s-config" (include "qbittorrent.fullname" .) -}}
{{- end -}}

View File

@ -0,0 +1,20 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.persistence.configMap.name }}
namespace: {{ .Values.namespace }}
data:
wg0.conf: |
[Interface]
Address = {{ .Values.wireguard.address }}
PrivateKey = {{ .Values.wireguard.privateKey }}
MTU = {{ .Values.wireguard.mtu }}
DNS = {{ .Values.wireguard.dns }}
ListenPort = {{ .Values.wireguard.listenPort }}
[Peer]
PublicKey = {{ .Values.wireguard.peerPublicKey }}
PresharedKey = {{ .Values.wireguard.presharedKey }}
AllowedIPs = {{ .Values.wireguard.allowedIPs }}
Endpoint = {{ .Values.wireguard.endpoint }}
PersistentKeepalive = {{ .Values.wireguard.persistentKeepalive }}

View File

@ -0,0 +1,125 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}
namespace: {{ .Values.namespace }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ .Release.Name }}
spec:
initContainers:
- name: wireguard-init
image: {{ .Values.wireguardImage.repository }}:{{ .Values.wireguardImage.tag }}
imagePullPolicy: {{ .Values.wireguardImage.pullPolicy }}
securityContext:
privileged: true
capabilities:
add:
- NET_ADMIN
- SYS_MODULE
command:
- /bin/sh
- -c
- |
set -x
echo "Starting WireGuard initialization..."
mkdir -p /etc/wireguard
cp /config/wg_confs/wg0.conf /etc/wireguard/wg0.conf
chmod 600 /etc/wireguard/wg0.conf
if ! lsmod | grep -q wireguard; then
modprobe wireguard || echo "Failed to load wireguard module"
fi
wg-quick up wg0 || echo "Failed to bring up WireGuard interface"
ip link show wg0
wg show
volumeMounts:
- name: wireguard-config
mountPath: /config/wg_confs
- name: modules
mountPath: /lib/modules
containers:
- name: wireguard
image: {{ .Values.wireguardImage.repository }}:{{ .Values.wireguardImage.tag }}
imagePullPolicy: {{ .Values.wireguardImage.pullPolicy }}
securityContext:
privileged: true
capabilities:
add:
- NET_ADMIN
- SYS_MODULE
env:
- name: PUID
value: "{{ .Values.config.puid }}"
- name: PGID
value: "{{ .Values.config.pgid }}"
- name: UMASK_SET
value: "{{ .Values.config.umask }}"
- name: TZ
value: "{{ .Values.config.timezone }}"
volumeMounts:
- name: wireguard-config
mountPath: /config/wg_confs
- name: modules
mountPath: /lib/modules
command:
- /bin/sh
- -c
- |
while true; do
if ! ip link show wg0 > /dev/null 2>&1; then
wg-quick up wg0
fi
sleep 30
done
ports:
- containerPort: {{ .Values.service.wireguardPort }}
protocol: UDP
- name: qbittorrent
image: {{ .Values.qbittorrentImage.repository }}:{{ .Values.qbittorrentImage.tag }}
imagePullPolicy: {{ .Values.qbittorrentImage.pullPolicy }}
env:
- name: PUID
value: "{{ .Values.config.puid }}"
- name: PGID
value: "{{ .Values.config.pgid }}"
- name: TZ
value: "{{ .Values.config.timezone }}"
- name: WEBUI_PORT
value: "{{ .Values.config.webuiPort }}"
volumeMounts:
- name: qbittorrent-config
mountPath: /config
- name: downloads
mountPath: /downloads
ports:
- containerPort: {{ .Values.deployment.containerPort }}
protocol: TCP
readinessProbe:
httpGet:
path: /
port: {{ .Values.deployment.containerPort }}
initialDelaySeconds: 10
periodSeconds: 10
failureThreshold: 3
volumes:
- name: qbittorrent-config
persistentVolumeClaim:
claimName: {{ .Values.persistence.config.name }}
- name: wireguard-config
configMap:
name: {{ .Values.persistence.configMap.name }}
- name: downloads
persistentVolumeClaim:
claimName: {{ .Values.persistence.downloads.existingClaim }}
- name: modules
hostPath:
path: /lib/modules

View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.persistence.config.name }}
namespace: {{ .Values.namespace }}
spec:
accessModes:
- {{ .Values.persistence.config.accessMode }}
resources:
requests:
storage: {{ .Values.persistence.config.size }}
storageClassName: {{ .Values.persistence.config.storageClass }}

View File

@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.service.name }}
namespace: {{ .Values.namespace }}
spec:
selector:
app: {{ .Release.Name }}
ports:
- protocol: TCP
name: qbittorrent
port: {{ .Values.service.port }}
targetPort: {{ .Values.deployment.containerPort }}
- protocol: UDP
name: wireguard
port: {{ .Values.service.wireguardPort }}
targetPort: {{ .Values.service.wireguardPort }}
type: {{ .Values.service.type }}

View File

@ -0,0 +1,60 @@
replicaCount: 1
namespace: media
deployment:
labels:
app: qbittorrent
containerPort: 8080
image:
repository: linuxserver/qbittorrent
tag: latest
pullPolicy: Always
qbittorrentImage:
repository: linuxserver/qbittorrent
tag: latest
pullPolicy: Always
wireguardImage:
repository: linuxserver/wireguard
tag: latest
pullPolicy: Always
service:
name: qbittorrent-service
type: LoadBalancer
port: 8080
wireguardPort: 51820
persistence:
config:
enabled: true
name: qbittorrent-config-pvc
accessMode: ReadWriteOnce
size: 1Gi
storageClass: longhorn
downloads:
enabled: true
existingClaim: media-nfs-pvc
configMap:
enabled: true
name: wireguard-config
config:
puid: 1000
pgid: 1000
timezone: Europe/Helsinki
umask: 022
webuiPort: 8080
wireguard:
address: 10.182.199.210/32
privateKey: WNDT2JsSZWw4q5EgsUKkBEX1hpWlpJGUTV/ibfJZOVo=
mtu: 1329
dns: 10.128.0.1
listenPort: 51820
peerPublicKey: PyLCXAQT8KkM4T+dUsOQfn+Ub3pGxfGlxkIApuig+hk=
presharedKey: jSEf0xVUv/LwLmybp+LSM21Q2VOPbWPGcI/Dc4LLGkM=
endpoint: europe3.vpn.airdns.org:1637
allowedIPs: 0.0.0.0/0
persistentKeepalive: 15