[qbittorrent] add podMonitor and ability to add exporter as a sidecar (#1153)

* [qbittorrent] add podMonitor and ability to add exporter as a sidecar
This commit is contained in:
j_r0dd 2021-09-05 14:37:09 -04:00 committed by GitHub
parent 62140f8d2c
commit 1aa5bf3cbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 124 additions and 17 deletions

View File

@ -1,8 +1,8 @@
apiVersion: v2 apiVersion: v2
appVersion: v4.3.5 appVersion: v4.3.7
description: qBittorrent is a cross-platform free and open-source BitTorrent client description: qBittorrent is a cross-platform free and open-source BitTorrent client
name: qbittorrent name: qbittorrent
version: 12.0.0 version: 12.1.0
kubeVersion: ">=1.16.0-0" kubeVersion: ">=1.16.0-0"
keywords: keywords:
- qbittorrent - qbittorrent

View File

@ -1,6 +1,6 @@
# qbittorrent # qbittorrent
![Version: 12.0.0](https://img.shields.io/badge/Version-12.0.0-informational?style=flat-square) ![AppVersion: v4.3.5](https://img.shields.io/badge/AppVersion-v4.3.5-informational?style=flat-square) ![Version: 12.1.0](https://img.shields.io/badge/Version-12.1.0-informational?style=flat-square) ![AppVersion: v4.3.7](https://img.shields.io/badge/AppVersion-v4.3.7-informational?style=flat-square)
qBittorrent is a cross-platform free and open-source BitTorrent client qBittorrent is a cross-platform free and open-source BitTorrent client
@ -78,9 +78,20 @@ N/A
|-----|------|---------|-------------| |-----|------|---------|-------------|
| env | object | See below | environment variables. See [image docs](https://docs.k8s-at-home.com/our-container-images/configuration/) for more details. | | env | object | See below | environment variables. See [image docs](https://docs.k8s-at-home.com/our-container-images/configuration/) for more details. |
| env.TZ | string | `"UTC"` | Set the container timezone | | env.TZ | string | `"UTC"` | Set the container timezone |
| exporter.enabled | bool | See values.yaml | Enable and configure prometheus-qbittorrent-exporter sidecar and Prometheus podMonitor. |
| exporter.env.log | string | `"INFO"` | log level [DEBUG|INFO|WARNING|ERROR|CRITICAL] |
| exporter.env.password | string | `"adminadmin"` | qbittorrent password update value after configuring qbittorrent |
| exporter.env.port | int | `9022` | metrics port |
| exporter.env.user | string | `"admin"` | qbittorrent username update value after configuring qbittorrent |
| exporter.image.pullPolicy | string | `"IfNotPresent"` | image pull policy |
| exporter.image.repository | string | `"ghcr.io/k8s-at-home/prometheus-qbittorrent-exporter"` | image repository |
| exporter.image.tag | string | `"v1.2.0"` | image tag |
| exporter.podMonitor.labels | object | `{}` | |
| exporter.podMonitor.interval | string | `"15s"` | |
| exporter.podMonitor.scrapeTimeout | string | `"5s"` | |
| image.pullPolicy | string | `"IfNotPresent"` | image pull policy | | image.pullPolicy | string | `"IfNotPresent"` | image pull policy |
| image.repository | string | `"ghcr.io/k8s-at-home/qbittorrent"` | image repository | | image.repository | string | `"ghcr.io/k8s-at-home/qbittorrent"` | image repository |
| image.tag | string | `"v4.3.5"` | image tag | | image.tag | string | `"v4.3.7"` | image tag |
| ingress.main | object | See values.yaml | Enable and configure ingress settings for the chart under this key. | | ingress.main | object | See values.yaml | Enable and configure ingress settings for the chart under this key. |
| persistence | object | See values.yaml | Configure persistence settings for the chart under this key. | | persistence | object | See values.yaml | Configure persistence settings for the chart under this key. |
| service | object | See values.yaml | Configures service settings for the chart. | | service | object | See values.yaml | Configures service settings for the chart. |
@ -92,6 +103,12 @@ All notable changes to this application Helm chart will be documented in this fi
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### [12.1.0]
#### Added
- Added podMonitor and the ability to use [prometheus-qbittorrent-exporter](https://github.com/esanchezm/prometheus-qbittorrent-exporter) as a sidecar container.
### [12.0.0] ### [12.0.0]
#### Changed #### Changed
@ -119,6 +136,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Initial version - Initial version
[12.1.0]: #1210
[12.0.0]: #1200 [12.0.0]: #1200
[11.0.0]: #1100 [11.0.0]: #1100
[10.0.0]: #1000 [10.0.0]: #1000

View File

@ -9,6 +9,12 @@ All notable changes to this application Helm chart will be documented in this fi
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### [12.1.0]
#### Added
- Added podMonitor and the ability to use [prometheus-qbittorrent-exporter](https://github.com/esanchezm/prometheus-qbittorrent-exporter) as a sidecar container.
### [12.0.0] ### [12.0.0]
#### Changed #### Changed
@ -36,6 +42,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Initial version - Initial version
[12.1.0]: #1210
[12.0.0]: #1200 [12.0.0]: #1200
[11.0.0]: #1100 [11.0.0]: #1100
[10.0.0]: #1000 [10.0.0]: #1000

View File

@ -1,19 +1,45 @@
{{/* Make sure all variables are set properly */}} {{/* Make sure all variables are set properly */}}
{{- include "common.values.setup" . }} {{- include "common.values.setup" . }}
{{/* Append the configMap volume to the volumes */}} {{/* Append the hardcoded settings */}}
{{- define "qbittorrent.configmapVolume" -}} {{- define "qbittorrent.harcodedValues" -}}
enabled: "true" {{ if and .Values.settings.automaticPortSetup }}
mountPath: "/config/custom-cont-init.d" persistence:
type: "custom" qbittorrent-scripts:
volumeSpec: enabled: "true"
configMap: mountPath: "/config/custom-cont-init.d"
name: {{ include "common.names.fullname" . }}-scripts type: "custom"
defaultMode: 511 volumeSpec:
{{- end -}} configMap:
{{- if and .Values.settings.automaticPortSetup -}} name: {{ include "common.names.fullname" . }}-scripts
{{- $_ := set .Values.persistence "qbittorrent-scripts" (include "qbittorrent.configmapVolume" . | fromYaml) -}} defaultMode: 511
{{ end }}
{{ if .Values.exporter.enabled }}
additionalContainers:
exporter:
name: exporter
image: "{{ .Values.exporter.image.repository }}:{{ .Values.exporter.image.tag }}"
imagePullPolicy: {{ .Values.exporter.image.pullPolicy }}
env:
- name: QBITTORRENT_HOST
value: "http://localhost"
- name: QBITTORRENT_PORT
value: "{{ .Values.service.main.ports.http.port }}"
- name: QBITTORRENT_USER
value: "{{ .Values.exporter.env.user }}"
- name: QBITTORRENT_PASS
value: "{{ .Values.exporter.env.password }}"
- name: EXPORTER_PORT
value: "{{ .Values.exporter.env.port }}"
- name: EXPORTER_LOG_LEVEL
value: "{{ .Values.exporter.env.log }}"
ports:
- name: metrics
containerPort: {{ .Values.exporter.env.port }}
{{ end }}
{{- end -}} {{- end -}}
{{- $_ := mergeOverwrite .Values (include "qbittorrent.harcodedValues" . | fromYaml) -}}
{{/* Render the templates */}} {{/* Render the templates */}}
{{ include "common.all" . }} {{ include "common.all" . }}

View File

@ -0,0 +1,29 @@
{{- if .Values.exporter.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ template "common.names.fullname" . }}
labels:
{{- include "common.labels" . | nindent 4 }}
{{- with .Values.exporter.podMonitor.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
{{- include "common.labels.selectorLabels" . | nindent 6 }}
podMetricsEndpoints:
- port: metrics
{{- with .Values.exporter.podMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.exporter.podMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
path: /metrics
relabelings:
- sourceLabels: ['namespace', 'job']
regex: ".+/(.*)"
targetLabel: "job"
replacement: "$1"
{{- end }}

View File

@ -9,7 +9,7 @@ image:
# -- image repository # -- image repository
repository: ghcr.io/k8s-at-home/qbittorrent repository: ghcr.io/k8s-at-home/qbittorrent
# -- image tag # -- image tag
tag: v4.3.5 tag: v4.3.7
# -- image pull policy # -- image pull policy
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
@ -60,3 +60,30 @@ persistence:
downloads: downloads:
enabled: false enabled: false
mountPath: /downloads mountPath: /downloads
exporter:
# -- Enable and configure prometheus-qbittorrent-exporter sidecar and Prometheus podMonitor.
# @default -- See values.yaml
enabled: false
podMonitor:
interval: 15s
scrapeTimeout: 5s
labels: {}
image:
# -- image repository
repository: ghcr.io/k8s-at-home/prometheus-qbittorrent-exporter
# -- image tag
tag: v1.2.0
# -- image pull policy
pullPolicy: IfNotPresent
env:
# -- qbittorrent username
# update value after configuring qbittorrent
user: "admin"
# -- qbittorrent password
# update value after configuring qbittorrent
password: "adminadmin"
# -- metrics port
port: 9022
# -- log level [DEBUG|INFO|WARNING|ERROR|CRITICAL]
log: INFO