diff --git a/applications/lidarr.yaml b/applications/lidarr.yaml new file mode 100644 index 0000000..2372ce9 --- /dev/null +++ b/applications/lidarr.yaml @@ -0,0 +1,26 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: lidarr + namespace: argocd + annotations: +spec: + project: default + source: + repoURL: http://gitea-http.gitea.svc.cluster.local:3000/admin/turingpi.git + targetRevision: HEAD + path: custom_helm_charts/lidarr + helm: + releaseName: lidarr + valueFiles: + - ../../helm-values/lidarr_values.yaml + destination: + server: https://kubernetes.default.svc + namespace: default + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - CreateNamespace=true + - ServerSideApply=true diff --git a/custom_helm_charts/lidarr/.helmignore b/custom_helm_charts/lidarr/.helmignore new file mode 100644 index 0000000..f0c1319 --- /dev/null +++ b/custom_helm_charts/lidarr/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/custom_helm_charts/lidarr/Chart.yaml b/custom_helm_charts/lidarr/Chart.yaml new file mode 100644 index 0000000..df40cd9 --- /dev/null +++ b/custom_helm_charts/lidarr/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +appVersion: "1.0" +description: Lidarr - Automatic music downloader and manager +name: lidarr +version: 0.1.0 +icon: https://lidarr.audio/img/logo.png diff --git a/custom_helm_charts/lidarr/logo/radarr.png b/custom_helm_charts/lidarr/logo/radarr.png new file mode 100644 index 0000000..6679b0c Binary files /dev/null and b/custom_helm_charts/lidarr/logo/radarr.png differ diff --git a/custom_helm_charts/lidarr/templates/NOTES.txt b/custom_helm_charts/lidarr/templates/NOTES.txt new file mode 100644 index 0000000..d668baa --- /dev/null +++ b/custom_helm_charts/lidarr/templates/NOTES.txt @@ -0,0 +1,19 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "lidarr.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get svc -w {{ template "lidarr.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "lidarr.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "lidarr.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8686 to use your application" + kubectl port-forward $POD_NAME 8686:{{ .Values.service.port }} +{{- end }} diff --git a/custom_helm_charts/lidarr/templates/_helpers.tpl b/custom_helm_charts/lidarr/templates/_helpers.tpl new file mode 100644 index 0000000..3e8814d --- /dev/null +++ b/custom_helm_charts/lidarr/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "lidarr.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "lidarr.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "lidarr.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/custom_helm_charts/lidarr/templates/deployment.yaml b/custom_helm_charts/lidarr/templates/deployment.yaml new file mode 100644 index 0000000..5725345 --- /dev/null +++ b/custom_helm_charts/lidarr/templates/deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "lidarr.fullname" . }} + labels: + app: {{ template "lidarr.name" . }} + chart: {{ template "lidarr.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ template "lidarr.name" . }} + release: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ template "lidarr.name" . }} + release: {{ .Release.Name }} + spec: + volumes: +{{ toYaml .Values.volumes | indent 6 }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: +{{ toYaml .Values.env | indent 12 }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + volumeMounts: +{{ toYaml .Values.volumeMounts | indent 12 }} + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} + {{- end }} diff --git a/custom_helm_charts/lidarr/templates/ingress.yaml b/custom_helm_charts/lidarr/templates/ingress.yaml new file mode 100644 index 0000000..a8addd1 --- /dev/null +++ b/custom_helm_charts/lidarr/templates/ingress.yaml @@ -0,0 +1,38 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "lidarr.fullname" . -}} +{{- $ingressPath := .Values.ingress.path -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + app: {{ template "lidarr.name" . }} + chart: {{ template "lidarr.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- with .Values.ingress.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ . }} + http: + paths: + - path: {{ $ingressPath }} + backend: + serviceName: {{ $fullName }} + servicePort: http + {{- end }} +{{- end }} diff --git a/custom_helm_charts/lidarr/templates/service.yaml b/custom_helm_charts/lidarr/templates/service.yaml new file mode 100644 index 0000000..86bdd1a --- /dev/null +++ b/custom_helm_charts/lidarr/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "lidarr.fullname" . }} + labels: + app: {{ template "lidarr.name" . }} + chart: {{ template "lidarr.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: {{ .Values.service.port }} + protocol: TCP + name: http + selector: + app: {{ template "lidarr.name" . }} + release: {{ .Release.Name }} diff --git a/custom_helm_charts/lidarr/values.yaml b/custom_helm_charts/lidarr/values.yaml new file mode 100644 index 0000000..0cf97d7 --- /dev/null +++ b/custom_helm_charts/lidarr/values.yaml @@ -0,0 +1,72 @@ + +replicaCount: 1 + +image: + repository: ghcr.io/linuxserver/lidarr + tag: latest + pullPolicy: Always + +env: + - name: PUID + value: "1000" + - name: PGID + value: "1000" + - name: TZ + value: "Europe/Amsterdam" + - name: LIDARR__POSTGRES_HOST + value: pgsql-postgresql + - name: LIDARR__POSTGRES_PORT + value: "5432" + - name: LIDARR__POSTGRES_USER + value: arr_user + - name: LIDARR__POSTGRES_PASSWORD + value: clavedatabase + - name: LIDARR__POSTGRES_MAIN_DB + value: lidarr_db + - name: LIDARR__POSTGRES_LOG_DB + value: lidarr_db_log + +service: + type: ClusterIP + port: 8686 + +ingress: + enabled: false + annotations: + kubernetes.io/ingress.class: nginx + kubernetes.io/tls-acme: "true" + path: / + hosts: + - lidarr.example.org + tls: + - secretName: lidarr-example-org + hosts: + - lidarr.example.org + +volumes: + - name: plex-data + persistentVolumeClaim: + claimName: plex-data + +volumeMounts: + - name: plex-data + mountPath: "/config" + subPath: "configs/lidarr" + - name: plex-data + mountPath: "/nfs" + +resources: + requests: + memory: 500Mi + cpu: 500m + ephemeral-storage: 50Mi + limits: + memory: 800Mi + cpu: 1000m + ephemeral-storage: 1Gi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/helm-values/lidarr_values.yaml b/helm-values/lidarr_values.yaml index 79a0806..7e20a4b 100644 --- a/helm-values/lidarr_values.yaml +++ b/helm-values/lidarr_values.yaml @@ -7,32 +7,40 @@ image: pullPolicy: Always env: - TZ: "Europe/Amsterdam" - PUID: "1000" - PGID: "1000" - LIDARR__POSTGRES_HOST: pgsql-postgresql - LIDARR__POSTGRES_PORT: "5432" - LIDARR__POSTGRES_USER: arr_user - LIDARR__POSTGRES_PASSWORD: "clavedatabase" - LIDARR__POSTGRES_MAIN_DB: lidarr_db - LIDARR__POSTGRES_LOG_DB: lidarr_db_log + - name: PUID + value: "1000" + - name: PGID + value: "1000" + - name: TZ + value: "Europe/Amsterdam" + - name: LIDARR__POSTGRES_HOST + value: pgsql-postgresql + - name: LIDARR__POSTGRES_PORT + value: "5432" + - name: LIDARR__POSTGRES_USER + value: arr_user + - name: LIDARR__POSTGRES_PASSWORD + value: "clavedatabase" + - name: LIDARR__POSTGRES_MAIN_DB + value: lidarr_db + - name: LIDARR__POSTGRES_LOG_DB + value: lidarr_db_log service: - main: - type: ClusterIP - ports: - http: - port: 8686 + type: ClusterIP + port: 8686 -persistence: - config: - enabled: true - existingClaim: plex-data - subPath: configs/lidarr - media: - enabled: true - existingClaim: plex-data - mountPath: /nfs +volumes: + - name: plex-data + persistentVolumeClaim: + claimName: plex-data + +volumeMounts: + - name: plex-data + mountPath: "/config" + subPath: "configs/lidarr" + - name: plex-data + mountPath: "/nfs" resources: requests: @@ -43,13 +51,3 @@ resources: memory: "800Mi" cpu: "1000m" ephemeral-storage: "1Gi" - -affinity: - nodeAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - nodeSelectorTerms: - - matchExpressions: - - key: kubernetes.io/hostname - operator: NotIn - values: - - turing2