From 3a8d83a45f10f8f58db2efeed69bae96d5e4e44e Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Wed, 5 Apr 2023 19:08:11 +0000 Subject: [PATCH] generalized linux servers --- .../templates/configmap-sonarr.yaml | 10 --- .../templates/configmap-transmission.yaml | 10 --- .../videohosting/templates/deploy-sonarr.yaml | 46 ----------- .../templates/deploy-transmission.yaml | 53 ------------- .../videohosting/templates/pvc-sonarr.yaml | 15 ---- .../templates/pvc-transmission.yaml | 15 ---- .../templates/sts-linuxservices.yaml | 76 +++++++++++++++++++ .../videohosting/templates/svc-plex.yaml | 46 ----------- .../videohosting/templates/svc-sonarr.yaml | 13 ---- .../templates/svc-transmission.yaml | 20 ----- k8s/applications/videohosting/values.yaml | 74 ++++++++++++++++-- 11 files changed, 144 insertions(+), 234 deletions(-) delete mode 100644 k8s/applications/videohosting/templates/configmap-sonarr.yaml delete mode 100644 k8s/applications/videohosting/templates/configmap-transmission.yaml delete mode 100644 k8s/applications/videohosting/templates/deploy-sonarr.yaml delete mode 100644 k8s/applications/videohosting/templates/deploy-transmission.yaml delete mode 100644 k8s/applications/videohosting/templates/pvc-sonarr.yaml delete mode 100644 k8s/applications/videohosting/templates/pvc-transmission.yaml create mode 100644 k8s/applications/videohosting/templates/sts-linuxservices.yaml delete mode 100644 k8s/applications/videohosting/templates/svc-plex.yaml delete mode 100644 k8s/applications/videohosting/templates/svc-sonarr.yaml delete mode 100644 k8s/applications/videohosting/templates/svc-transmission.yaml diff --git a/k8s/applications/videohosting/templates/configmap-sonarr.yaml b/k8s/applications/videohosting/templates/configmap-sonarr.yaml deleted file mode 100644 index 30cb24b..0000000 --- a/k8s/applications/videohosting/templates/configmap-sonarr.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: sonarr-envs -data: - PUID: "1000" - PGID: "1000" - TZ: {{ .Values.global.timezone }} - \ No newline at end of file diff --git a/k8s/applications/videohosting/templates/configmap-transmission.yaml b/k8s/applications/videohosting/templates/configmap-transmission.yaml deleted file mode 100644 index 8e3953d..0000000 --- a/k8s/applications/videohosting/templates/configmap-transmission.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: transmission-envs -data: - PUID: "1000" - PGID: "1000" - TZ: {{ .Values.global.timezone }} - \ No newline at end of file diff --git a/k8s/applications/videohosting/templates/deploy-sonarr.yaml b/k8s/applications/videohosting/templates/deploy-sonarr.yaml deleted file mode 100644 index a58ec86..0000000 --- a/k8s/applications/videohosting/templates/deploy-sonarr.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: sonarr -spec: - selector: - matchLabels: - app: sonarr - replicas: 1 - revisionHistoryLimit: 2 - template: - metadata: - labels: - app: sonarr - spec: - containers: - - name: sonarr - image: "{{ .Values.sonarr.repo }}:{{ .Values.sonarr.tag }}" - envFrom: - - configMapRef: - name: sonarr-envs - resources: - limits: - cpu: 2 - memory: "2Gi" - requests: - cpu: 1 - memory: "500M" - ports: - - containerPort: 8989 - volumeMounts: - - name: sonarr-config - mountPath: /config - - name: torrents - mountPath: /data - - volumes: - - name: sonarr-config - persistentVolumeClaim: - claimName: sonarr-config - - name: torrents - nfs: - server: "{{ $.Values.global.nfs.server }}" - path: "{{ .Values.nfs.shares.torrents }}" - readOnly: false diff --git a/k8s/applications/videohosting/templates/deploy-transmission.yaml b/k8s/applications/videohosting/templates/deploy-transmission.yaml deleted file mode 100644 index 70e636d..0000000 --- a/k8s/applications/videohosting/templates/deploy-transmission.yaml +++ /dev/null @@ -1,53 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: transmission -spec: - selector: - matchLabels: - app: transmission - replicas: 1 - revisionHistoryLimit: 2 - template: - metadata: - labels: - app: transmission - spec: - containers: - - name: transmission - image: "{{ .Values.transmission.repo }}:{{ .Values.transmission.tag }}" - envFrom: - - configMapRef: - name: transmission-envs - resources: - limits: - cpu: 2 - memory: "2Gi" - requests: - cpu: 1 - memory: "500M" - ports: - - containerPort: 9091 - - containerPort: 51413 - - containerPort: 51413 - protocol: UDP - volumeMounts: - - name: transmission-config - mountPath: /config - - name: torrents - mountPath: /downloads - subPath: "downloads" - - name: torrents - mountPath: /watch - subPath: "torrents" - - volumes: - - name: transmission-config - persistentVolumeClaim: - claimName: transmission-config - - name: torrents - nfs: - server: "{{ $.Values.global.nfs.server }}" - path: "{{ .Values.nfs.shares.torrents }}" - readOnly: false diff --git a/k8s/applications/videohosting/templates/pvc-sonarr.yaml b/k8s/applications/videohosting/templates/pvc-sonarr.yaml deleted file mode 100644 index 77805eb..0000000 --- a/k8s/applications/videohosting/templates/pvc-sonarr.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - finalizers: - - kubernetes.io/pvc-protection - name: sonarr-config -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 10Gi - limits: - storage: 100Gi diff --git a/k8s/applications/videohosting/templates/pvc-transmission.yaml b/k8s/applications/videohosting/templates/pvc-transmission.yaml deleted file mode 100644 index 38658ee..0000000 --- a/k8s/applications/videohosting/templates/pvc-transmission.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - finalizers: - - kubernetes.io/pvc-protection - name: transmission-config -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 10Gi - limits: - storage: 100Gi diff --git a/k8s/applications/videohosting/templates/sts-linuxservices.yaml b/k8s/applications/videohosting/templates/sts-linuxservices.yaml new file mode 100644 index 0000000..b27486a --- /dev/null +++ b/k8s/applications/videohosting/templates/sts-linuxservices.yaml @@ -0,0 +1,76 @@ +{{ range $k, $v := .Values.linuxserverServices }} +--- +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 }} + +--- +kind: Service +apiVersion: v1 +metadata: + name: {{ $k }} +spec: + selector: + app: {{ $k }} + type: ClusterIP + ports: + {{- $v.ports | toYaml | nindent 4 }} +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{$k}} +spec: + selector: + matchLabels: + app: {{$k}} + replicas: 1 + revisionHistoryLimit: 2 + volumeClaimTemplates: + - metadata: + finalizers: + - kubernetes.io/pvc-protection + name: config + spec: + accessModes: + - ReadWriteOnce + resources: + {{- $v.configVolumesResources | toYaml | nindent 10 }} + template: + metadata: + labels: + app: {{$k}} + spec: + containers: + - name: {{$k}} + image: "{{ $v.repo }}:{{ $v.tag }}" + envFrom: + - configMapRef: + name: {{$k}}-envs + resources: + {{- $v.podResources | toYaml | nindent 12 }} + ports: + {{ range $port := $v.ports}} + - containerPort: {{ $port.targetPort }} + protocol: {{ $port.protocol | default "TCP" }} + {{ end }} + volumeMounts: + - name: config + mountPath: /config + - name: torrents + mountPath: /torrents + volumes: + - name: torrents + nfs: + server: "{{ $.Values.global.nfs.server }}" + path: "{{ $.Values.nfs.shares.torrents }}" + readOnly: false +{{ end }} \ No newline at end of file diff --git a/k8s/applications/videohosting/templates/svc-plex.yaml b/k8s/applications/videohosting/templates/svc-plex.yaml deleted file mode 100644 index f76a799..0000000 --- a/k8s/applications/videohosting/templates/svc-plex.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- -kind: Service -apiVersion: v1 -metadata: - name: plex -spec: - selector: - app: plex - type: ClusterIP - ports: - - port: 32400 - targetPort: 32400 - name: plex - - port: 1900 - targetPort: 1900 - name: "1900" - protocol: UDP - - port: 3005 - targetPort: 3005 - name: "3005" - - port: 5353 - targetPort: 5353 - name: "5353" - protocol: UDP - - port: 8324 - targetPort: 8324 - name: "8324" - - port: 32410 - targetPort: 32410 - name: "32410" - protocol: UDP - - port: 32412 - targetPort: 32412 - name: "32412" - protocol: UDP - - port: 32413 - targetPort: 32413 - name: "32413" - protocol: UDP - - port: 32414 - targetPort: 32414 - name: "32414" - protocol: UDP - - port: 32469 - targetPort: 32469 - name: "32469" diff --git a/k8s/applications/videohosting/templates/svc-sonarr.yaml b/k8s/applications/videohosting/templates/svc-sonarr.yaml deleted file mode 100644 index 7d89c81..0000000 --- a/k8s/applications/videohosting/templates/svc-sonarr.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -kind: Service -apiVersion: v1 -metadata: - name: sonarr -spec: - selector: - app: sonarr - type: ClusterIP - ports: - - port: 8989 - targetPort: 8989 - name: "web" diff --git a/k8s/applications/videohosting/templates/svc-transmission.yaml b/k8s/applications/videohosting/templates/svc-transmission.yaml deleted file mode 100644 index 7708dea..0000000 --- a/k8s/applications/videohosting/templates/svc-transmission.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -kind: Service -apiVersion: v1 -metadata: - name: transmission -spec: - selector: - app: transmission - type: ClusterIP - ports: - - port: 9091 - targetPort: 9091 - name: "web" - - port: 51413 - targetPort: 51413 - name: "51413" - - port: 51413 - targetPort: 51413 - protocol: UDP - name: "51413-udp" diff --git a/k8s/applications/videohosting/values.yaml b/k8s/applications/videohosting/values.yaml index e2ba1de..3b0357a 100644 --- a/k8s/applications/videohosting/values.yaml +++ b/k8s/applications/videohosting/values.yaml @@ -5,9 +5,71 @@ nfs: plex: repo: "plexinc/pms-docker" tag: "1.31.3.6868-28fc46b27" -transmission: - repo: lscr.io/linuxserver/transmission - tag: "4.0.2" -sonarr: - repo: lscr.io/linuxserver/sonarr - tag: "3.0.10" + +linuxserverServices: + transmission: + repo: lscr.io/linuxserver/transmission + tag: "4.0.2" + ports: + - port: 9091 + targetPort: 9091 + name: "web" + - port: 51413 + targetPort: 51413 + name: "51413" + - port: 51413 + targetPort: 51413 + protocol: UDP + name: "51413-udp" + podResources: + limits: + cpu: 2 + memory: "2Gi" + requests: + cpu: 1 + memory: "500M" + configVolumesResources: + requests: + storage: 10Gi + limits: + storage: 100Gi + sonarr: + repo: lscr.io/linuxserver/sonarr + tag: "3.0.10" + podResources: + limits: + cpu: 2 + memory: "2Gi" + requests: + cpu: 1 + memory: "500M" + configVolumesResources: + requests: + storage: 10Gi + limits: + storage: 100Gi + ports: + - port: 8989 + targetPort: 8989 + name: "web" + sonarr: + repo: lscr.io/linuxserver/jackett + tag: "0.20.3772" + envVars: + AUTO_UPDATE: "true" + podResources: + limits: + cpu: 2 + memory: "2Gi" + requests: + cpu: 1 + memory: "500M" + configVolumesResources: + requests: + storage: 10Gi + limits: + storage: 100Gi + ports: + - port: 9117 + targetPort: 9117 + name: "web"