diff --git a/manifests/media/qbittorrent.yaml b/manifests/media/qbittorrent.yaml index bb828f5..0b83187 100644 --- a/manifests/media/qbittorrent.yaml +++ b/manifests/media/qbittorrent.yaml @@ -21,23 +21,6 @@ spec: requests: storage: 1Gi --- -apiVersion: v1 -kind: ConfigMap -metadata: - name: gluetun-auth - namespace: downloads -data: - config.toml: | - [[roles]] - name = "public" - - [roles.auth] - method = "none" - - [[roles.routes]] - method = "GET" - path = "/v1/publicip/ip" ---- apiVersion: apps/v1 kind: Deployment metadata: @@ -86,10 +69,6 @@ spec: volumeMounts: - name: tun mountPath: /dev/net/tun - - name: gluetun-auth - mountPath: /gluetun/auth - ports: - - containerPort: 8000 - name: qbittorrent image: lscr.io/linuxserver/qbittorrent:5.2.0 ports: @@ -108,6 +87,31 @@ spec: mountPath: /config - name: torrents mountPath: /mnt/storage/torrents + - name: ip-reporter + image: python:3-alpine + ports: + - containerPort: 8888 + command: + - python3 + - -c + - | + import http.server, urllib.request + + class Handler(http.server.BaseHTTPRequestHandler): + def do_GET(self): + try: + ip = urllib.request.urlopen('https://ipinfo.io/ip').read().decode().strip() + except Exception as e: + ip = f'error: {e}' + body = ip.encode() + self.send_response(200) + self.send_header('Content-Type', 'text/plain') + self.send_header('Content-Length', len(body)) + self.end_headers() + self.wfile.write(body) + def log_message(self, *a): pass + + http.server.HTTPServer(('0.0.0.0', 8888), Handler).serve_forever() volumes: - name: tun hostPath: @@ -120,9 +124,6 @@ spec: hostPath: path: /mnt/storage/torrents type: Directory - - name: gluetun-auth - configMap: - name: gluetun-auth --- apiVersion: v1 kind: Service @@ -136,9 +137,9 @@ spec: - name: web port: 80 targetPort: 8080 - - name: gluetun-api - port: 8000 - targetPort: 8000 + - name: ip-reporter + port: 8888 + targetPort: 8888 --- apiVersion: networking.k8s.io/v1 kind: Ingress @@ -193,6 +194,6 @@ spec: kind: Rule services: - name: qbittorrent - port: 8000 + port: 8888 tls: secretName: gluetun-tls