Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cross-seed): deploy #2548

Merged
merged 1 commit into from
Jan 23, 2025
Merged

feat(cross-seed): deploy #2548

merged 1 commit into from
Jan 23, 2025

Conversation

rodent1
Copy link
Owner

@rodent1 rodent1 commented Jan 23, 2025

No description provided.

@ro-bott ro-bott bot added the area/kubernetes Changes made in the kubernetes directory label Jan 23, 2025
@ro-bott
Copy link
Contributor

ro-bott bot commented Jan 23, 2025

--- kubernetes/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/cross-seed

+++ kubernetes/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/cross-seed

@@ -0,0 +1,30 @@

+---
+apiVersion: kustomize.toolkit.fluxcd.io/v1
+kind: Kustomization
+metadata:
+  labels:
+    kustomize.toolkit.fluxcd.io/name: cluster-apps
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: cross-seed
+  namespace: flux-system
+spec:
+  commonMetadata:
+    labels:
+      app.kubernetes.io/name: cross-seed
+  dependsOn:
+  - name: onepassword-store
+  - name: volsync
+  interval: 30m
+  path: ./kubernetes/apps/media/cross-seed/app
+  postBuild:
+    substitute:
+      APP: cross-seed
+      VOLSYNC_CAPACITY: 5Gi
+  prune: true
+  sourceRef:
+    kind: GitRepository
+    name: flux-system
+  targetNamespace: media
+  timeout: 5m
+  wait: false
+
--- kubernetes/apps/media/cross-seed/app Kustomization: flux-system/cross-seed ExternalSecret: media/cross-seed

+++ kubernetes/apps/media/cross-seed/app Kustomization: flux-system/cross-seed ExternalSecret: media/cross-seed

@@ -0,0 +1,57 @@

+---
+apiVersion: external-secrets.io/v1beta1
+kind: ExternalSecret
+metadata:
+  labels:
+    app.kubernetes.io/name: cross-seed
+    kustomize.toolkit.fluxcd.io/name: cross-seed
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: cross-seed
+  namespace: media
+spec:
+  dataFrom:
+  - extract:
+      key: cross-seed
+  - extract:
+      key: radarr
+  - extract:
+      key: sonarr
+  - extract:
+      key: prowlarr
+  refreshInterval: 5m
+  secretStoreRef:
+    kind: ClusterSecretStore
+    name: onepassword
+  target:
+    name: cross-seed-secret
+    template:
+      data:
+        config.js: |
+          module.exports = {
+            action: "inject",
+            apiKey: "{{.CROSS_SEED_API_KEY}}",
+            delay: 30,
+            duplicateCategories: false,
+            flatLinking: false,
+            includeEpisodes: true,
+            includeNonVideos: true,
+            includeSingleEpisodes: true,
+            linkCategory: "cross-seed",
+            linkDirs: [
+              "/media/Downloads/complete/cross-seed"
+            ],
+            linkType: "hardlink",
+            matchMode: "safe",
+            outputDir: "/config",
+            port: Number(process.env.CROSS_SEED_PORT),
+            qbittorrentUrl: "http://qbittorrent.media.svc.cluster.local",
+            radarr: [
+              "http://radarr.media.svc.cluster.local/?apikey={{ .RADARR_API_KEY }}"
+            ],
+            skipRecheck: true,
+            sonarr: [
+              "http://sonarr.media.svc.cluster.local/?apikey={{ .SONARR_API_KEY }}"
+            ],
+            useClientTorrents: true
+          };
+
--- kubernetes/apps/media/cross-seed/app Kustomization: flux-system/cross-seed HelmRelease: media/cross-seed

+++ kubernetes/apps/media/cross-seed/app Kustomization: flux-system/cross-seed HelmRelease: media/cross-seed

@@ -0,0 +1,113 @@

+---
+apiVersion: helm.toolkit.fluxcd.io/v2
+kind: HelmRelease
+metadata:
+  labels:
+    app.kubernetes.io/name: cross-seed
+    kustomize.toolkit.fluxcd.io/name: cross-seed
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: cross-seed
+  namespace: media
+spec:
+  chart:
+    spec:
+      chart: app-template
+      sourceRef:
+        kind: HelmRepository
+        name: bjw-s
+        namespace: flux-system
+      version: 3.6.1
+  dependsOn:
+  - name: qbittorrent
+    namespace: default
+  install:
+    remediation:
+      retries: 3
+  interval: 30m
+  upgrade:
+    cleanupOnFail: true
+    remediation:
+      retries: 3
+      strategy: rollback
+  values:
+    controllers:
+      cross-seed:
+        annotations:
+          reloader.stakater.com/auto: 'true'
+        containers:
+          app:
+            args:
+            - daemon
+            env:
+              CROSS_SEED_PORT: 80
+              TZ: Europe/Oslo
+            image:
+              repository: ghcr.io/cross-seed/cross-seed
+              tag: 6.9.1@sha256:575f491204d4ae7e003a98c5e15959c01b0c647e8bbeb75c3de9b9a9a92f3d1b
+            probes:
+              liveness:
+                custom: true
+                enabled: true
+                spec:
+                  failureThreshold: 3
+                  httpGet:
+                    path: /api/ping
+                    port: 80
+                  initialDelaySeconds: 0
+                  periodSeconds: 10
+                  timeoutSeconds: 1
+              readiness:
+                custom: true
+                enabled: true
+                spec:
+                  failureThreshold: 3
+                  httpGet:
+                    path: /api/ping
+                    port: 80
+                  initialDelaySeconds: 0
+                  periodSeconds: 10
+                  timeoutSeconds: 1
+            resources:
+              limits:
+                memory: 512Mi
+              requests:
+                cpu: 10m
+            securityContext:
+              allowPrivilegeEscalation: false
+              capabilities:
+                drop:
+                - ALL
+              readOnlyRootFilesystem: true
+    defaultPodOptions:
+      securityContext:
+        fsGroup: 1000
+        fsGroupChangePolicy: OnRootMismatch
+        runAsGroup: 1000
+        runAsNonRoot: true
+        runAsUser: 1000
+        seccompProfile:
+          type: RuntimeDefault
+    persistence:
+      config:
+        existingClaim: config-cross-seed
+      media:
+        globalMounts:
+        - path: /media/Downloads
+          subPath: Downloads
+        path: /mnt/tank/Media
+        server: tank.internal
+        type: nfs
+      secret-file:
+        globalMounts:
+        - path: /config/config.js
+          readOnly: true
+          subPath: config.js
+        name: cross-seed-secret
+        type: secret
+    service:
+      app:
+        controller: cross-seed
+        ports:
+          http:
+            port: 80
+
--- kubernetes/apps/media/cross-seed/app Kustomization: flux-system/cross-seed ConfigMap: media/cross-seed-loki-rules

+++ kubernetes/apps/media/cross-seed/app Kustomization: flux-system/cross-seed ConfigMap: media/cross-seed-loki-rules

@@ -0,0 +1,38 @@

+---
+apiVersion: v1
+data:
+  cross-seed.yaml: |
+    ---
+    groups:
+      - name: cross-seed
+        rules:
+          - alert: CrossSeedDatabaseMalformed
+            expr: |
+              sum by (app) (count_over_time({app="cross-seed"} |~ "(?i)database disk image is malformed"[1h])) > 0
+            for: 2m
+            labels:
+              severity: critical
+              category: logs
+            annotations:
+              app: "{{ $labels.container }}"
+              summary: "{{ $labels.container }} is experiencing database issues"
+          - alert: CrossSeedFailedToInject
+            expr: |
+              sum by (app) (count_over_time({app="cross-seed"} |~ "(?i)failed to inject"[1h])) > 0
+            for: 2m
+            labels:
+              severity: critical
+              category: logs
+            annotations:
+              app: "{{ $labels.container }}"
+              summary: "{{ $labels.container }} failed to inject a torrent"
+kind: ConfigMap
+metadata:
+  labels:
+    app.kubernetes.io/name: cross-seed
+    kustomize.toolkit.fluxcd.io/name: cross-seed
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+    loki_rule: 'true'
+  name: cross-seed-loki-rules
+  namespace: media
+

@ro-bott
Copy link
Contributor

ro-bott bot commented Jan 23, 2025

--- HelmRelease: media/cross-seed Service: media/cross-seed

+++ HelmRelease: media/cross-seed Service: media/cross-seed

@@ -0,0 +1,22 @@

+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: cross-seed
+  labels:
+    app.kubernetes.io/instance: cross-seed
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: cross-seed
+    app.kubernetes.io/service: cross-seed
+spec:
+  type: ClusterIP
+  ports:
+  - port: 80
+    targetPort: 80
+    protocol: TCP
+    name: http
+  selector:
+    app.kubernetes.io/component: cross-seed
+    app.kubernetes.io/instance: cross-seed
+    app.kubernetes.io/name: cross-seed
+
--- HelmRelease: media/cross-seed Deployment: media/cross-seed

+++ HelmRelease: media/cross-seed Deployment: media/cross-seed

@@ -0,0 +1,103 @@

+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: cross-seed
+  labels:
+    app.kubernetes.io/component: cross-seed
+    app.kubernetes.io/instance: cross-seed
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: cross-seed
+  annotations:
+    reloader.stakater.com/auto: 'true'
+spec:
+  revisionHistoryLimit: 3
+  replicas: 1
+  strategy:
+    type: Recreate
+  selector:
+    matchLabels:
+      app.kubernetes.io/component: cross-seed
+      app.kubernetes.io/name: cross-seed
+      app.kubernetes.io/instance: cross-seed
+  template:
+    metadata:
+      labels:
+        app.kubernetes.io/component: cross-seed
+        app.kubernetes.io/instance: cross-seed
+        app.kubernetes.io/name: cross-seed
+    spec:
+      enableServiceLinks: false
+      serviceAccountName: default
+      automountServiceAccountToken: true
+      securityContext:
+        fsGroup: 1000
+        fsGroupChangePolicy: OnRootMismatch
+        runAsGroup: 1000
+        runAsNonRoot: true
+        runAsUser: 1000
+        seccompProfile:
+          type: RuntimeDefault
+      hostIPC: false
+      hostNetwork: false
+      hostPID: false
+      dnsPolicy: ClusterFirst
+      containers:
+      - args:
+        - daemon
+        env:
+        - name: CROSS_SEED_PORT
+          value: '80'
+        - name: TZ
+          value: Europe/Oslo
+        image: ghcr.io/cross-seed/cross-seed:6.9.1@sha256:575f491204d4ae7e003a98c5e15959c01b0c647e8bbeb75c3de9b9a9a92f3d1b
+        livenessProbe:
+          failureThreshold: 3
+          httpGet:
+            path: /api/ping
+            port: 80
+          initialDelaySeconds: 0
+          periodSeconds: 10
+          timeoutSeconds: 1
+        name: app
+        readinessProbe:
+          failureThreshold: 3
+          httpGet:
+            path: /api/ping
+            port: 80
+          initialDelaySeconds: 0
+          periodSeconds: 10
+          timeoutSeconds: 1
+        resources:
+          limits:
+            memory: 512Mi
+          requests:
+            cpu: 10m
+        securityContext:
+          allowPrivilegeEscalation: false
+          capabilities:
+            drop:
+            - ALL
+          readOnlyRootFilesystem: true
+        volumeMounts:
+        - mountPath: /config
+          name: config
+        - mountPath: /media/Downloads
+          name: media
+          subPath: Downloads
+        - mountPath: /config/config.js
+          name: secret-file
+          readOnly: true
+          subPath: config.js
+      volumes:
+      - name: config
+        persistentVolumeClaim:
+          claimName: config-cross-seed
+      - name: media
+        nfs:
+          path: /mnt/tank/Media
+          server: tank.internal
+      - name: secret-file
+        secret:
+          secretName: cross-seed-secret
+

@rodent1 rodent1 merged commit 4b879d2 into main Jan 23, 2025
11 checks passed
@rodent1 rodent1 deleted the cross-seed branch January 23, 2025 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubernetes Changes made in the kubernetes directory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant