diff --git a/charts/readarr/Chart.yaml b/charts/readarr/Chart.yaml new file mode 100644 index 00000000..ad920742 --- /dev/null +++ b/charts/readarr/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: readarr +description: Book Manager and Automation (Sonarr for Ebooks) +type: application +version: 1.0.0 +# renovate: image=ghcr.io/onedr0p/readarr-develop +appVersion: "0.3.5.2217" +keywords: + - readarr + - servarr + - torrent + - usenet +home: https://github.com/pree/helm-charts/tree/master/charts/readarr +icon: https://raw.githubusercontent.com/Readarr/Readarr/develop/Logo/512.png +sources: + - https://github.com/Readarr/Readarr + - https://github.com/onedr0p/containers +maintainers: + - name: pree + email: pascal@reeb.io +dependencies: + - name: common + repository: https://bjw-s.github.io/helm-charts/ + version: 1.5.1 diff --git a/charts/readarr/README.md b/charts/readarr/README.md new file mode 100644 index 00000000..bbc57ebb --- /dev/null +++ b/charts/readarr/README.md @@ -0,0 +1,53 @@ +# readarr + +![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.3.5.2217](https://img.shields.io/badge/AppVersion-0.3.5.2217-informational?style=flat-square) + +Book Manager and Automation (Sonarr for Ebooks) + +**Homepage:** + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| pree | | | + +## Source Code + +* +* + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://bjw-s.github.io/helm-charts/ | common | 1.5.1 | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| env | object | See below | environment variables. | +| env.TZ | string | `"UTC"` | Set the container timezone | +| image.pullPolicy | string | `"IfNotPresent"` | image pull policy | +| image.repository | string | `"ghcr.io/onedr0p/readarr"` | image repository | +| image.tag | string | `nil` | | +| ingress.main | object | See values.yaml | Enable and configure ingress settings for the chart under this key. | +| metrics.enabled | bool | See values.yaml | Enable and configure Exportarr sidecar and Prometheus serviceMonitor. | +| metrics.exporter.env.additionalMetrics | bool | `false` | Set to true to enable gathering of additional metrics (slow) | +| metrics.exporter.env.port | int | `9794` | metrics port | +| metrics.exporter.env.unknownQueueItems | bool | `false` | Set to true to enable gathering unknown queue items | +| metrics.exporter.image.pullPolicy | string | `"IfNotPresent"` | image pull policy | +| metrics.exporter.image.repository | string | `"ghcr.io/onedr0p/exportarr"` | image repository | +| metrics.exporter.image.tag | string | `"v1.5.3"` | image tag | +| metrics.prometheusRule | object | See values.yaml | Enable and configure Prometheus Rules for the chart under this key. | +| metrics.prometheusRule.rules | list | See prometheusrules.yaml | Configure additionial rules for the chart under this key. | +| metrics.serviceMonitor.interval | string | `"3m"` | | +| metrics.serviceMonitor.labels | object | `{}` | | +| metrics.serviceMonitor.scrapeTimeout | string | `"1m"` | | +| persistence | object | See values.yaml | Configure persistence settings for the chart under this key. # Config persistence is required for the Prometheus exporter sidecar. | +| probes | object | See values.yaml | Configures the probes for the main Pod. | +| service | object | See values.yaml | Configures service settings for the chart. | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0) diff --git a/charts/readarr/ci/ct-exportarr-values.yaml b/charts/readarr/ci/ct-exportarr-values.yaml new file mode 100644 index 00000000..d1a4f800 --- /dev/null +++ b/charts/readarr/ci/ct-exportarr-values.yaml @@ -0,0 +1,26 @@ +# Test exportarr +persistence: + config: + enabled: true + type: emptyDir + +additionalContainers: + exportarr: + name: exportarr + image: ghcr.io/onedr0p/exportarr:v1.0.0 + imagePullPolicy: IfNotPresent + args: ["readarr"] + env: + - name: PORT + value: "32123" + - name: URL + value: "http://localhost" + - name: CONFIG + value: "/config/config.xml" + ports: + - name: exportarr + containerPort: 32123 + volumeMounts: + - name: config + mountPath: /config + readOnly: true diff --git a/charts/readarr/templates/common.yaml b/charts/readarr/templates/common.yaml new file mode 100644 index 00000000..f7e6a41e --- /dev/null +++ b/charts/readarr/templates/common.yaml @@ -0,0 +1,50 @@ +{{/* Make sure all variables are set properly */}} +{{- include "bjw-s.common.loader.init" . }} + +{{/* Append the hardcoded settings */}} +{{- define "readarr.harcodedValues" -}} +{{ if .Values.metrics.enabled }} +additionalContainers: + exporter: + name: exporter + image: "{{ .Values.metrics.exporter.image.repository }}:{{ .Values.metrics.exporter.image.tag }}" + imagePullPolicy: {{ .Values.metrics.exporter.image.pullPolicy }} + args: ["readarr"] + env: + - name: URL + value: "http://localhost" + - name: CONFIG + value: "/config/config.xml" + - name: PORT + value: "{{ .Values.metrics.exporter.env.port }}" + - name: ENABLE_ADDITIONAL_METRICS + value: "{{ .Values.metrics.exporter.env.additionalMetrics }}" + - name: ENABLE_UNKNOWN_QUEUE_ITEMS + value: "{{ .Values.metrics.exporter.env.unknownQueueItems }}" + ports: + - name: metrics + containerPort: {{ .Values.metrics.exporter.env.port }} + volumeMounts: + {{ if .Values.persistence.config.enabled }} + - name: config + mountPath: /config + readOnly: true + {{ if .Values.persistence.config.subPath }} + subPath: {{ .Values.persistence.config.subPath }} + {{ end }} + {{ end }} + +service: + metrics: + enabled: true + ports: + metrics: + enabled: true + protocol: TCP + port: {{ .Values.metrics.exporter.env.port }} +{{ end }} +{{- end -}} +{{- $_ := mergeOverwrite .Values (include "readarr.harcodedValues" . | fromYaml) -}} + +{{/* Render the templates */}} +{{ include "bjw-s.common.loader.generate" . }} diff --git a/charts/readarr/templates/prometheusrules.yaml b/charts/readarr/templates/prometheusrules.yaml new file mode 100644 index 00000000..61012d78 --- /dev/null +++ b/charts/readarr/templates/prometheusrules.yaml @@ -0,0 +1,39 @@ +{{- if and .Values.metrics.enabled .Values.metrics.prometheusRule.enabled }} +{{- include "bjw-s.common.loader.init" . -}} +--- +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + name: {{ include "bjw-s.common.lib.chart.names.fullname" . }} + labels: + {{- include "bjw-s.common.lib.controller.metadata.labels" . | nindent 4 }} + {{- with .Values.metrics.prometheusRule.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + groups: + - name: {{ include "bjw-s.common.lib.chart.names.fullname" . }} + rules: + - alert: ExportarrAbsent + annotations: + description: Readarr Exportarr has disappeared from Prometheus + service discovery. + summary: Exportarr is down. + expr: | + absent(up{job=~".*{{ include "bjw-s.common.lib.chart.names.fullname" . }}.*"} == 1) + for: 5m + labels: + severity: critical + - alert: ReadarrDown + annotations: + description: Readarr service is down. + summary: Readarr is down. + expr: | + readarr_system_status{job=~".*{{ include "bjw-s.common.lib.chart.names.fullname" . }}.*"} == 0 + for: 5m + labels: + severity: critical + {{- with .Values.metrics.prometheusRule.rules }} + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} diff --git a/charts/readarr/templates/servicemonitor.yaml b/charts/readarr/templates/servicemonitor.yaml new file mode 100644 index 00000000..d3b1ad64 --- /dev/null +++ b/charts/readarr/templates/servicemonitor.yaml @@ -0,0 +1,26 @@ +{{- if .Values.metrics.enabled }} +{{- include "bjw-s.common.loader.init" . -}} +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "bjw-s.common.lib.chart.names.fullname" . }} + labels: + {{- include "bjw-s.common.lib.controller.metadata.labels" . | nindent 4 }} + {{- with .Values.metrics.serviceMonitor.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + selector: + matchLabels: + {{- include "bjw-s.common.lib.metadata.selectorLabels" . | nindent 6 }} + endpoints: + - port: metrics + {{- with .Values.metrics.serviceMonitor.interval }} + interval: {{ . }} + {{- end }} + {{- with .Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ . }} + {{- end }} + path: /metrics +{{- end }} diff --git a/charts/readarr/values.yaml b/charts/readarr/values.yaml new file mode 100644 index 00000000..51db11b2 --- /dev/null +++ b/charts/readarr/values.yaml @@ -0,0 +1,109 @@ +# +# IMPORTANT NOTE +# +# This chart inherits from bjw-s's common library chart. You can check the default values/options here: +# https://github.com/bjw-s/helm-charts/tree/main/charts/library/common/values.yaml +# + +image: + # -- image repository + repository: ghcr.io/onedr0p/readarr + # @default -- chart.appVersion + tag: + # -- image pull policy + pullPolicy: IfNotPresent + +# -- environment variables. +# @default -- See below +env: + # -- Set the container timezone + TZ: UTC + +# -- Configures service settings for the chart. +# @default -- See values.yaml +service: + main: + ports: + http: + port: 8787 + +ingress: + # -- Enable and configure ingress settings for the chart under this key. + # @default -- See values.yaml + main: + enabled: false + +# -- Configures the probes for the main Pod. +# @default -- See values.yaml +probes: + liveness: + enabled: true + ## Set this to true if you wish to specify your own livenessProbe + custom: true + ## The spec field contains the values for the default livenessProbe. + ## If you selected custom: true, this field holds the definition of the livenessProbe. + spec: + exec: + command: + - /usr/bin/env + - bash + - -c + - curl --fail localhost:8787/api/v3/system/status?apiKey=`IFS=\> && while + read -d \< E C; do if [[ $E = "ApiKey" ]]; then echo $C; fi; done < /config/config.xml` + failureThreshold: 5 + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 10 + +# -- Configure persistence settings for the chart under this key. +## Config persistence is required for the Prometheus exporter sidecar. +# @default -- See values.yaml +persistence: + config: + enabled: false + + media: + enabled: false + mountPath: /media + +metrics: + # -- Enable and configure Exportarr sidecar and Prometheus serviceMonitor. + # @default -- See values.yaml + enabled: false + serviceMonitor: + interval: 3m + scrapeTimeout: 1m + labels: {} + # -- Enable and configure Prometheus Rules for the chart under this key. + # @default -- See values.yaml + prometheusRule: + enabled: false + labels: {} + # -- Configure additionial rules for the chart under this key. + # @default -- See prometheusrules.yaml + rules: [] + # - alert: ReadarrDown + # annotations: + # description: Readarr service is down. + # summary: Readarr is down. + # expr: | + # readarr_system_status == 0 + # for: 5m + # labels: + # severity: critical + exporter: + image: + # -- image repository + repository: ghcr.io/onedr0p/exportarr + # -- image tag + tag: v1.5.3 + # -- image pull policy + pullPolicy: IfNotPresent + env: + # -- metrics port + port: 9794 + # -- Set to true to enable gathering of additional metrics (slow) + additionalMetrics: false + # -- Set to true to enable gathering unknown queue items + unknownQueueItems: false