From 417ba65c2e7fbd997c12f8d273e4c12fc4cfef69 Mon Sep 17 00:00:00 2001 From: Rob Reus Date: Wed, 20 Dec 2023 13:07:01 +0100 Subject: [PATCH] feat(bazarr) Adding exportarr to expose metrics to prometheus (#14761) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** This adds exportarr to the bazarr application as bazarr is supported by exportarr. This allows the user to have prometheus scrape for bazarr metrics. **โš™๏ธ Type of change** - [X] โš™๏ธ Feature/App addition - [ ] ๐Ÿช› Bugfix - [ ] โš ๏ธ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] ๐Ÿ”ƒ Refactor of current code **๐Ÿงช How Has This Been Tested?** Created a personal catalog which I added to TrueNAS. I then installed this app sourced from this catalog to ensure the questions + answers, and actual installation works. **๐Ÿ“ƒ Notes:** Exportarr for bazarr does not work without having the API key to access bazarr set. I have added this as a question to the metrics part (see below screenshot). Is this an acceptable way of doing this, or should it be done differently? Unfortunately bazarr does not support setting the api key via environment variables, so enabling metrics for a new deployment requires 2 deployments. The first one without metrics enabled to bootstrap bazarr, and then a second one to enable metrics and set the api key. ![2023-11-20_12-26](https://github.com/truecharts/charts/assets/20680059/b9455821-6dc5-4f9e-bc8f-16461bbb394d) Also, due to a bug in exportarr (https://github.com/onedr0p/exportarr/issues/244), exportarr does not work when there are no series added/sonarr is not configured. Should this be mentioned anywhere to the users of this chart? **โœ”๏ธ Checklist:** - [X] โš–๏ธ My code follows the style guidelines of this project - [X] ๐Ÿ‘€ I have performed a self-review of my own code - [ ] #๏ธโƒฃ I have commented my code, particularly in hard-to-understand areas - [ ] ๐Ÿ“„ I have made corresponding changes to the documentation - [ ] โš ๏ธ My changes generate no new warnings - [ ] ๐Ÿงช I have added tests to this description that prove my fix is effective or that my feature works - [X] โฌ†๏ธ I increased versions for any altered app according to semantic versioning **โž• App addition** If this PR is an app addition please make sure you have done the following. - [ ] ๐Ÿชž I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] ๐Ÿ–ผ๏ธ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --------- Signed-off-by: Kjeld Schouten Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Kjeld Schouten --- charts/stable/bazarr/Chart.yaml | 2 +- charts/stable/bazarr/ci/default-values.yaml | 3 + charts/stable/bazarr/questions.yaml | 9 +++ charts/stable/bazarr/values.yaml | 70 ++++++++++++++++++++- 4 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 charts/stable/bazarr/ci/default-values.yaml diff --git a/charts/stable/bazarr/Chart.yaml b/charts/stable/bazarr/Chart.yaml index 8932781e51c..b1b3bec328c 100644 --- a/charts/stable/bazarr/Chart.yaml +++ b/charts/stable/bazarr/Chart.yaml @@ -1,7 +1,7 @@ kubeVersion: ">=1.24.0-0" apiVersion: v2 name: bazarr -version: 15.1.3 +version: 15.2.0 appVersion: 1.4.0 description: Bazarr is a companion application to Sonarr and Radarr. It manages and diff --git a/charts/stable/bazarr/ci/default-values.yaml b/charts/stable/bazarr/ci/default-values.yaml new file mode 100644 index 00000000000..8c71aec7cea --- /dev/null +++ b/charts/stable/bazarr/ci/default-values.yaml @@ -0,0 +1,3 @@ +metrics: + main: + apiKey: newsn7zz12j67l4cwovjt6cyq6raqzmz diff --git a/charts/stable/bazarr/questions.yaml b/charts/stable/bazarr/questions.yaml index 4e64dc32feb..fc341a7b20e 100644 --- a/charts/stable/bazarr/questions.yaml +++ b/charts/stable/bazarr/questions.yaml @@ -82,6 +82,15 @@ questions: default: 568 # Include{resources} +# Include{metrics} + - variable: apiKey + label: "Bazarr API key" + description: "Can be found in the Bazarr settings" + schema: + type: string + default: "" + required: true +# Include{prometheusRule} # Include{advanced} # Include{addons} # Include{codeserver} diff --git a/charts/stable/bazarr/values.yaml b/charts/stable/bazarr/values.yaml index 15dcffb1809..1a02d2a2e64 100644 --- a/charts/stable/bazarr/values.yaml +++ b/charts/stable/bazarr/values.yaml @@ -2,6 +2,10 @@ image: repository: ghcr.io/onedr0p/bazarr pullPolicy: IfNotPresent tag: 1.4.0@sha256:c81c4d9cbec093d5a999cfa3cd1af01d3f00d6292d6f5c33608510cef0ed83c7 +exportarrImage: + repository: tccr.io/truecharts/exportarr + pullPolicy: IfNotPresent + tag: v1.6.0@sha256:ee118701a2ebe8ccb5c25e1003fbed9ef7ce217d4e4b8b6df30cc2a0def818f8 service: main: ports: @@ -9,10 +13,74 @@ service: port: 6767 protocol: http targetPort: 6767 + metrics: + enabled: true + type: ClusterIP + targetSelector: exportarr + ports: + metrics: + enabled: true + port: 7879 + targetSelector: exportarr + +workload: + exportarr: + enabled: "{{ .Values.metrics.main.enabled }}" + type: Deployment + strategy: RollingUpdate + replicas: 1 + podSpec: + containers: + exportarr: + primary: true + enabled: true + imageSelector: exportarrImage + args: + - bazarr + probes: + liveness: + enabled: true + type: http + path: /healthz + port: "{{ .Values.service.metrics.ports.metrics.port }}" + readiness: + enabled: true + type: http + path: /healthz + port: "{{ .Values.service.metrics.ports.metrics.port }}" + startup: + enabled: true + type: http + path: /healthz + port: "{{ .Values.service.metrics.ports.metrics.port }}" + env: + INTERFACE: 0.0.0.0 + PORT: "{{ .Values.service.metrics.ports.metrics.port }}" + URL: '{{ printf "http://%v:%v" (include "tc.v1.common.lib.chart.names.fullname" $) .Values.service.main.ports.main.port }}' + APIKEY: "{{ .Values.metrics.main.apiKey }}" + persistence: config: enabled: true - mountPath: /config + targetSelector: + main: + main: + mountPath: /config + exportarr: + exportarr: + mountPath: /config + readOnly: true + +metrics: + main: + enabled: true + type: "servicemonitor" + endpoints: + - port: metrics + path: /metrics + targetSelector: metrics + apiKey: "" + portal: open: enabled: true