From f36c97f8deb4b16713a596ad3f594e0316c744fc Mon Sep 17 00:00:00 2001 From: Ariel Sosnovsky Date: Mon, 13 Nov 2023 15:59:01 -0500 Subject: [PATCH] videohosting global db --- k8s/apps/videohosting/templates/sts-arrs.yaml | 176 ++++++++++++++++++ ...s-linuxservices.yaml => sts-services.yaml} | 0 k8s/apps/videohosting/values.yaml | 17 +- 3 files changed, 180 insertions(+), 13 deletions(-) create mode 100644 k8s/apps/videohosting/templates/sts-arrs.yaml rename k8s/apps/videohosting/templates/{sts-linuxservices.yaml => sts-services.yaml} (100%) diff --git a/k8s/apps/videohosting/templates/sts-arrs.yaml b/k8s/apps/videohosting/templates/sts-arrs.yaml new file mode 100644 index 0000000..4de433d --- /dev/null +++ b/k8s/apps/videohosting/templates/sts-arrs.yaml @@ -0,0 +1,176 @@ +{{ range $k, $v := .Values.arrs }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{$k}}-envs +data: + PUID: "1000" + PGID: "1000" + TZ: {{ $.Values.global.timezone }} +{{- range $envName, $envValue := ($v.envVars | default (dict )) }} + {{ $envName }}: "{{$envValue}}" +{{ end }} + +--- +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: "{{$k}}-config" +spec: + refreshInterval: 1h + secretStoreRef: + kind: ClusterSecretStore + name: chart-database + target: + name: "{{$k}}-config" + creationPolicy: Owned + template: + engineVersion: v2 + data: + config.xml: |- + + info + False + 80 + 443 + + * + 258c8ca51bc54161889705caaf32a824 + None + Docker + False + main + + Sosnovsky {{$k}} + {{ `{{.port}}` }} + {{ `{{.username}}` }} + {{ `{{.password}}` }} + 5432 + {{ `{{.host}}` }} + {{$k}} + {{$k}}-log + + data: + - remoteRef: + key: password.pg.{{$k}} + property: username + secretKey: username + - remoteRef: + key: password.pg.{{$k}} + property: password + secretKey: password + - remoteRef: + key: password.pg.{{$k}} + property: port + secretKey: port + - remoteRef: + key: password.pg.{{$k}} + property: host + secretKey: host +--- +kind: Service +apiVersion: v1 +metadata: + name: {{ $k }} +spec: + selector: + app: {{ $k }} + type: ClusterIP + ports: + - port: 80 + targetPort: 80 + name: "http" + - port: 443 + targetPort: 443 + name: "https" +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{$k}} +spec: + selector: + matchLabels: + app: {{$k}} + replicas: 1 + revisionHistoryLimit: 2 + updateStrategy: + rollingUpdate: + partition: 0 + type: RollingUpdate + volumeClaimTemplates: + - metadata: + finalizers: + - kubernetes.io/pvc-protection + name: config + spec: + storageClassName: {{ $.Values.global.nfs.storageClass }} + accessModes: + - ReadWriteOnce + resources: + {{- $v.configVolumesResources | toYaml | nindent 10 }} + template: + metadata: + labels: + app: {{$k}} + spec: + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: homelab/capacity + operator: In + values: + - med + - low + containers: + - name: {{$k}} + image: "{{ $v.repo }}:{{ $v.tag }}" + imagePullPolicy: Always + envFrom: + - configMapRef: + name: {{$k}}-envs + resources: + {{- $v.podResources | toYaml | nindent 12 }} + ports: + - containerPort: 80 + name: "http" + - containerPort: 443 + name: "https" + volumeMounts: + - name: config + mountPath: /config + - name: torrents + mountPath: /torrents + livenessProbe: + httpGet: + path: "/ping" + port: http + scheme: HTTP + initialDelaySeconds: 30 + failureThreshold: 10 + timeoutSeconds: 30 + readinessProbe: + httpGet: + path: "/ping" + port: http + scheme: HTTP + initialDelaySeconds: 30 + failureThreshold: 10 + timeoutSeconds: 30 + startupProbe: + tcpSocket: + port: http + initialDelaySeconds: 30 + failureThreshold: 10 + timeoutSeconds: 30 + volumes: + - name: torrents + nfs: + server: "{{ $.Values.global.nfs.server }}" + path: "{{ $.Values.global.nfs.additionalShares.torrents }}" + readOnly: false +{{ end }} \ No newline at end of file diff --git a/k8s/apps/videohosting/templates/sts-linuxservices.yaml b/k8s/apps/videohosting/templates/sts-services.yaml similarity index 100% rename from k8s/apps/videohosting/templates/sts-linuxservices.yaml rename to k8s/apps/videohosting/templates/sts-services.yaml diff --git a/k8s/apps/videohosting/values.yaml b/k8s/apps/videohosting/values.yaml index 781492b..491c9d8 100644 --- a/k8s/apps/videohosting/values.yaml +++ b/k8s/apps/videohosting/values.yaml @@ -28,7 +28,7 @@ database: cpu: 250m memory: "256Mi" -services: +arrs: sonarr: repo: lscr.io/linuxserver/sonarr tag: "latest" @@ -44,12 +44,7 @@ services: storage: 10Gi limits: storage: 100Gi - health: - readiness: "/ping" - liveness: "/ping" - ports: - tcp: - web: 8989 + radarr: repo: lscr.io/linuxserver/radarr tag: "latest" @@ -60,17 +55,13 @@ services: requests: cpu: 250m memory: "500M" - health: - readiness: "/ping" - liveness: "/ping" configVolumesResources: requests: storage: 10Gi limits: storage: 100Gi - ports: - tcp: - web: 7878 + +services: jackett: repo: lscr.io/linuxserver/jackett tag: "latest"