feat: tdarr-inform

This commit is contained in:
auricom
2025-04-23 14:06:51 +02:00
parent 3118009a47
commit 27667fa888
5 changed files with 242 additions and 0 deletions

View File

@@ -0,0 +1,105 @@
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: &app postgres-pg-dump
labels: &labels
app.kubernetes.io/name: pg-dump
app.kubernetes.io/instance: *app
postgresql: crunchy
postgres-operator.crunchydata.com/cluster: crunchy
kustomize.toolkit.fluxcd.io/force: "Enabled"
spec:
schedule: "0 6 * * *"
concurrencyPolicy: "Forbid"
jobTemplate:
spec:
template:
metadata:
labels: *labels
spec:
automountServiceAccountToken: false
enableServiceLinks: false
restartPolicy: "OnFailure"
securityContext:
runAsUser: &uid 26 # Postgres UID for Crunchy
runAsGroup: *uid
fsGroup: *uid
volumes:
- name: &pvc "nas-backups"
persistentVolumeClaim:
claimName: "pg-${PG_APP_NAME}-${PG_DB_NAME}-dump-local"
containers:
- name: "postgres-backup"
image: "docker.io/prodrigestivill/postgres-backup-local:16@sha256:73f18e914cb6ffb29840b3fc5be0763f48eb1ca05f093c769ccd13982a634544"
imagePullPolicy: "IfNotPresent"
command: ["/backup.sh"]
volumeMounts:
- name: *pvc
subPath: "${PG_APP_NAME}"
mountPath: /backups
readOnly: false
env:
# don't use pg_dumpall because this template assumes 1 cluster and 1 DB by default
- name: "POSTGRES_CLUSTER"
value: !!str "${PG_DUMPALL:='FALSE'}"
- name: "POSTGRES_DB"
value: "${PG_DB_NAME:=postgres}"
# DROP backed_up_databases IF EXISTS
- name: "POSTGRES_EXTRA_OPTS"
value: "--clean --if-exists"
# use pgBouncer service by default to handle connection loadbalancing and failover
# use primary service using Flux envsubst in case replicas are not ready, pgBouncer won't work with dumpall
- name: "POSTGRES_HOST"
value: "pg-${PG_APP_NAME}-${PG_DUMP_FROM:=pgbouncer}.${PG_APP_NS}.svc.cluster.local"
#value: "pg-${PG_APP_NAME}-replicas.${PG_APP_NS}.svc.cluster.local"
#valueFrom:
# secretKeyRef:
# name: &pguser "pg-${PG_APP_NAME}-pguser-${PG_DB_USER}"
# key: "host"
# use pguser app credentials
- name: "POSTGRES_USER"
valueFrom:
secretKeyRef:
name: &pguser "pg-${PG_APP_NAME}-pguser-${PG_DB_USER}"
key: "user"
- name: "POSTGRES_PASSWORD"
valueFrom:
secretKeyRef:
name: *pguser
key: "password"
resources:
limits:
cpu: 1000m
memory: ${PG_DUMP_LOCAL_MEM:=1Gi}
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: &name "pg-${PG_APP_NAME}-${PG_DB_NAME}-dump-local"
labels:
kustomize.toolkit.fluxcd.io/force: "Enabled"
spec:
storageClassName: *name
capacity:
storage: 1Mi
accessModes: [ReadWriteMany]
persistentVolumeReclaimPolicy: Retain
nfs:
server: "${IP_TRUENAS}"
path: "${PATH_NAS_BACKUPS_K8S}/pg-dump"
mountOptions: ["nfsvers=4", "tcp", "hard", "noatime", "nodiratime", "nocto"]
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: &name "pg-${PG_APP_NAME}-${PG_DB_NAME}-dump-local"
namespace: "${PG_APP_NS}"
labels:
kustomize.toolkit.fluxcd.io/force: "Enabled"
spec:
accessModes: [ReadWriteMany]
storageClassName: *name
resources:
requests:
storage: 1Mi

View File

@@ -0,0 +1,35 @@
[logging]
level = INFO
format = None
[database]
type = sqlite
driver = None
user = None
pass = None
host = None
port = None
name = None
[main]
cache_dir = None
[tdarr_inform]
address = 0.0.0.0
port = 5004
require_auth = None
friendlyname = tdarr_inform
versions_check_interval = 88888888
humanized_time_granularity = second
[tdarr]
address = tdarr-server.default.svc.local.
port = 8265
ssl = None
accept_root_drive_path = 1
[web_ui]
theme = None
access_level = None
auto_page_refresh = 5
pages_to_refresh = None

View File

@@ -0,0 +1,59 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s/helm-charts/main/charts/other/app-template/schemas/helmrelease-helm-v2.schema.json
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: &app tdarr-inform
spec:
interval: 1h
chartRef:
kind: OCIRepository
name: app-template
namespace: flux-system
install:
remediation:
retries: 3
upgrade:
cleanupOnFail: true
remediation:
strategy: rollback
retries: 3
values:
defaultPodOptions:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
fsGroupChangePolicy: OnRootMismatch
controllers:
tdarr-inform:
annotations:
reloader.stakater.com/auto: "true"
containers:
node:
image:
repository: ghcr.io/deathbybandaid/tdarr_inform
tag: latest@sha256:ea90e93d89fe6bfa852a322567770dbf5a9c002b7fc3cfc2466c774c8fe84f8c
resources:
requests:
cpu: 25m
service:
app:
controller: *app
ports:
http:
port: 5004
persistence:
config:
enabled: true
existingClaim: *app
globalMounts:
- path: /config
configfile:
type: configMap
name: tdarr-inform-configmap
defaultMode: 0444 # trunk-ignore(yamllint/octal-values)
globalMounts:
- path: ./config/config.ini
subPath: config.ini
readOnly: true

View File

@@ -0,0 +1,12 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/kustomization.json
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./helmrelease.yaml
configMapGenerator:
- name: tdarr-inform-configmap
files:
- ./config/config.ini
generatorOptions:
disableNameSuffixHash: true

View File

@@ -61,3 +61,34 @@ spec:
targetNamespace: *namespace
timeout: 5m
wait: false
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &app tdarr-inform
namespace: &namespace default
spec:
commonMetadata:
labels:
app.kubernetes.io/name: *app
dependsOn:
- name: volsync
namespace: volsync
components:
- ../../../../components/volsync
interval: 1h
path: ./kubernetes/apps/default/tdarr/inform
postBuild:
substitute:
APP: *app
VOLSYNC_CAPACITY: 2Gi
prune: true
retryInterval: 2m
sourceRef:
kind: GitRepository
name: home-ops-kubernetes
namespace: flux-system
targetNamespace: *namespace
timeout: 5m
wait: false