From 6dbebcd79f431f1d89f88b2d7ef5edae2bde0cf8 Mon Sep 17 00:00:00 2001 From: Navratan Lal Gupta Date: Sun, 30 Jun 2024 20:50:13 +0530 Subject: [PATCH] multipoddeployment: add ingress for qbt and prowlarr ingress --- helm/media-stack/templates/NOTES.txt | 2 +- .../templates/ingress-qbt-prowlarr.yaml | 90 +++++++++++++++++++ helm/media-stack/values.yaml | 4 +- 3 files changed, 92 insertions(+), 4 deletions(-) create mode 100644 helm/media-stack/templates/ingress-qbt-prowlarr.yaml diff --git a/helm/media-stack/templates/NOTES.txt b/helm/media-stack/templates/NOTES.txt index c3974ae..38e7629 100644 --- a/helm/media-stack/templates/NOTES.txt +++ b/helm/media-stack/templates/NOTES.txt @@ -51,6 +51,6 @@ {{- if not .Values.multiPodDeployment }} kubectl --namespace {{ .Release.Namespace }} logs deploy/media-stack -c qbittorrent {{- else }} -kubectl --namespace {{ .Release.Namespace }} logs -l app=qbittorrent -c qbittorrent +kubectl --namespace {{ .Release.Namespace }} logs -l app=qbt-prowlarr -c qbittorrent {{- end }} diff --git a/helm/media-stack/templates/ingress-qbt-prowlarr.yaml b/helm/media-stack/templates/ingress-qbt-prowlarr.yaml new file mode 100644 index 0000000..f85c659 --- /dev/null +++ b/helm/media-stack/templates/ingress-qbt-prowlarr.yaml @@ -0,0 +1,90 @@ +{{- if .Values.ingress.enabled -}} +{{- if .multiPodDeployment -}} +{{- $fullName := include "media-stack.fullname" . -}}-qbt-prowlarr +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.qbittorrent.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.qbittorrent.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "media-stack.labels" . | nindent 4 }} + app: qbt-prowlarr + {{- with .Values.qbittorrent.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + tls: + {{- if .Values.qbittorrent.ingress.tls }} + {{- with .Values.qbittorrent.ingress.tls }} + - hosts: + - {{ $.Values.qbittorrent.ingress.host | quote }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + {{- if .Values.prowlarr.ingress.tls }} + {{- with .Values.prowlarr.ingress.tls }} + - hosts: + - {{ $.Values.prowlarr.ingress.host | quote }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- with .Values.qbittorrent.ingress }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ .servicePort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ .servicePort }} + {{- end }} + {{- end }} + {{- end }} + + {{- with .Values.prowlarr.ingress }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ .servicePort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ .servicePort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} +{{- end }} diff --git a/helm/media-stack/values.yaml b/helm/media-stack/values.yaml index 56d8716..8452ae8 100644 --- a/helm/media-stack/values.yaml +++ b/helm/media-stack/values.yaml @@ -172,6 +172,7 @@ radarr: ingress: annotations: {} + # Add ingress annotations for qbittorrent and prowlarr here, if needed # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" host: radarr.local @@ -284,9 +285,6 @@ prowlarr: accessMode: ReadWriteOnce ingress: - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" host: prowlarr.local paths: - path: /