Skip to content

Commit

Permalink
Merge pull request #3 from InputObject2/feature/31-add-prowlarr-support
Browse files Browse the repository at this point in the history
feature(prowlarr): kubealex#31 Added prowlarr and extra lb annotations
  • Loading branch information
InputObject2 authored Nov 26, 2022
2 parents 7c62f83 + f08e9b5 commit ba0b791
Show file tree
Hide file tree
Showing 8 changed files with 232 additions and 0 deletions.
2 changes: 2 additions & 0 deletions helm-charts/k8s-mediaserver/templates/jackett-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ apiVersion: v1
kind: Service
metadata:
name: jackett-lb
annotations:
{{- include .Values.jackett.service.extraLBService.annotations . | nindent 4 }}
labels:
{{- include "k8s-mediaserver.labels" . | nindent 4 }}
spec:
Expand Down
2 changes: 2 additions & 0 deletions helm-charts/k8s-mediaserver/templates/plex-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ apiVersion: v1
kind: Service
metadata:
name: plex-lb
annotations:
{{- include .Values.plex.service.extraLBService.annotations . | nindent 4 }}
labels:
{{- include "k8s-mediaserver.labels" . | nindent 4 }}
spec:
Expand Down
192 changes: 192 additions & 0 deletions helm-charts/k8s-mediaserver/templates/prowlarr-resources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
{{ if .Values.prowlarr.enabled }}
---
### CONFIGMAPS
## INIT-CONTAINER
apiVersion: v1
data:
config.xml: |
<Config>
<UrlBase>{{ .Values.prowlarr.ingress.path }}</UrlBase>
</Config>
init-prowlarr.sh: |
#!/bin/bash
echo "### Initializing config ###"
if [ ! -f /prowlarr-config/config.xml ]; then
cp -n /init-prowlarr/config.xml /prowlarr-config/config.xml
echo "### No configuration found, intialized with default settings ###"
fi
kind: ConfigMap
metadata:
name: init-prowlarr-cm
---
## APPLICATION
apiVersion: v1
kind: ConfigMap
metadata:
name: prowlarr-config
data:
PGID: "{{ .Values.general.pgid }}"
PUID: "{{ .Values.general.puid }}"
---
### DEPLOYMENT
apiVersion: apps/v1
kind: Deployment
metadata:
name: prowlarr
labels:
{{- include "k8s-mediaserver.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "k8s-mediaserver.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "k8s-mediaserver.selectorLabels" . | nindent 8 }}
app: prowlarr
spec:
initContainers:
- name: config-prowlarr
image: docker.io/ubuntu:groovy
command: ["/init-prowlarr/init-prowlarr.sh"]
volumeMounts:
- mountPath: /init-prowlarr
name: init-files-prowlarr
{{- if .Values.jackett.volume }}
- name: {{ .Values.jackett.volume.name }}
mountPath: /prowlarr-config
{{- else }}
- name: mediaserver-volume
mountPath: /prowlarr-config
subPath: "{{ .Values.general.storage.subPaths.config }}/prowlarr"
{{- end }}
securityContext:
runAsUser: {{ .Values.general.puid }}
runAsGroup: {{ .Values.general.pgid }}
containers:
- name: {{ .Chart.Name }}
envFrom:
- configMapRef:
name: prowlarr-config
image: "{{ .Values.prowlarr.container.image }}:{{ .Values.prowlarr.container.tag | default .Values.general.image_tag }}"
imagePullPolicy: Always
readinessProbe:
tcpSocket:
port: {{ .Values.prowlarr.container.port }}
initialDelaySeconds: 10
periodSeconds: 20
ports:
- name: prowlarr-port
containerPort: {{ .Values.prowlarr.container.port }}
protocol: TCP
volumeMounts:
{{- if .Values.prowlarr.volume }}
- name: {{ .Values.prowlarr.volume.name }}
mountPath: /config
{{- else }}
- name: mediaserver-volume
mountPath: "/config"
subPath: "{{ .Values.general.storage.subPaths.config }}/prowlarr"
{{- end }}
{{- with .Values.prowlarr.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
{{ if not .Values.general.storage.customVolume }}
- name: mediaserver-volume
persistentVolumeClaim:
claimName: {{ .Values.general.storage.pvcName }}
{{ else }}
- name: mediaserver-volume
{{- toYaml .Values.general.storage.volumes | nindent 10 }}
{{ end }}
{{- if .Values.prowlarr.volume }}
- name: {{ .Values.prowlarr.volume.name }}
persistentVolumeClaim:
claimName: {{ .Values.prowlarr.volume.name }}
{{- end }}
- name: init-files-prowlarr
configMap:
defaultMode: 493
name: init-prowlarr-cm
{{- with .Values.general.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
---
### SERVICES
apiVersion: v1
kind: Service
metadata:
name: prowlarr
labels:
{{- include "k8s-mediaserver.labels" . | nindent 4 }}
spec:
type: {{ .Values.prowlarr.service.type }}
ports:
- port: {{ .Values.prowlarr.service.port }}
targetPort: {{ .Values.prowlarr.container.port }}
protocol: TCP
{{ if eq .Values.prowlarr.service.type "NodePort" }}
nodePort: {{ .Values.prowlarr.service.nodePort }}
{{ end }}
name: prowlarr-port
selector:
app: prowlarr

---
{{ if .Values.prowlarr.service.extraLBService }}
apiVersion: v1
kind: Service
metadata:
name: prowlarr-lb
annotations:
{{- include .Values.prowlarr.service.extraLBService.annotations . | nindent 4 }}
labels:
{{- include "k8s-mediaserver.labels" . | nindent 4 }}
spec:
type: LoadBalancer
ports:
- port: {{ .Values.prowlarr.service.port }}
targetPort: {{ .Values.prowlarr.container.port }}
protocol: TCP
name: prowlarr-port
selector:
app: prowlarr
{{ end }}
---
### INGRESS ###
{{ if .Values.prowlarr.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: prowlarr
labels:
{{- include "k8s-mediaserver.labels" . | nindent 4 }}
{{- with .Values.prowlarr.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{ if .Values.prowlarr.ingress.tls.enabled }}
tls:
- hosts:
- {{ .Values.general.ingress_host | quote }}
secretName: {{ .Values.prowlarr.ingress.tls.secretName }}
{{ end }}
ingressClassName: {{ .Values.general.ingress.ingressClassName }}
rules:
- host: {{ .Values.general.ingress_host | quote }}
http:
paths:
- path: {{ .Values.prowlarr.ingress.path }}
pathType: Prefix
backend:
service:
name: prowlarr
port:
number: {{ .Values.prowlarr.service.port }}
{{ end }}
{{ end }}
2 changes: 2 additions & 0 deletions helm-charts/k8s-mediaserver/templates/radarr-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ apiVersion: v1
kind: Service
metadata:
name: radarr-lb
annotations:
{{- include .Values.radarr.service.extraLBService.annotations . | nindent 4 }}
labels:
{{- include "k8s-mediaserver.labels" . | nindent 4 }}
spec:
Expand Down
2 changes: 2 additions & 0 deletions helm-charts/k8s-mediaserver/templates/sabnzbd-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,8 @@ apiVersion: v1
kind: Service
metadata:
name: sabnzbd-lb
annotations:
{{- include .Values.sabnzbd.service.extraLBService.annotations . | nindent 4 }}
labels:
{{- include "k8s-mediaserver.labels" . | nindent 4 }}
spec:
Expand Down
2 changes: 2 additions & 0 deletions helm-charts/k8s-mediaserver/templates/sonarr-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ apiVersion: v1
kind: Service
metadata:
name: sonarr-lb
annotations:
{{- include .Values.sonarr.service.extraLBService.annotations . | nindent 4 }}
labels:
{{- include "k8s-mediaserver.labels" . | nindent 4 }}
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ apiVersion: v1
kind: Service
metadata:
name: transmission-lb
annotations:
{{- include .Values.transmission.service.extraLBService.annotations . | nindent 4 }}
labels:
{{- include "k8s-mediaserver.labels" . | nindent 4 }}
spec:
Expand Down
28 changes: 28 additions & 0 deletions helm-charts/k8s-mediaserver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,34 @@ sabnzbd:
# storage: 5Gi
# selector: {}

prowlarr:
enabled: true
container:
image: docker.io/linuxserver/prowlarr
nodeSelector: {}
port: 9696
service:
type: ClusterIP
port: 9696
nodePort:
extraLBService: false
ingress:
enabled: true
annotations: {}
path: /prowlarr
tls:
enabled: false
secretName: ""
resources: {}
volume: {}
# name: pvc-prowlarr-config
# storageClassName: longhorn
# annotations: {}
# labels: {}
# accessModes: ReadWriteOnce
# storage: 5Gi
# selector: {}

plex:
enabled: true
claim: "CHANGEME"
Expand Down

0 comments on commit ba0b791

Please sign in to comment.