Files
reposilite-charts/unittests/podMonitors/podMonitor.yaml
Markus Pesch 413fe95b86
Some checks failed
Generate README / generate-parameters (push) Failing after 15s
Helm / helm-lint (push) Successful in 15s
Helm / helm-unittest (push) Successful in 7s
Markdown linter / markdown-lint (push) Successful in 8s
Release / publish-chart (push) Successful in 8s
Markdown linter / markdown-link-checker (push) Successful in 43s
fix(prometheus): add init containers to download plugins
The following patch extends the helm chart of additional init containers for
each plugin.
2025-09-20 16:21:40 +02:00

179 lines
4.9 KiB
YAML

chart:
appVersion: 0.1.0
version: 0.1.0
suite: PodMonitor template
release:
name: reposilite-unittest
namespace: testing
templates:
- templates/podMonitor.yaml
tests:
- it: Skip podMonitor when metrics are disabled.
set:
prometheus.metrics.enabled: false
prometheus.metrics.podMonitor.enabled: true
prometheus.metrics.serviceMonitor.enabled: true
asserts:
- hasDocuments:
count: 0
- it: Skip podMonitor when podMonitor is disabled.
set:
prometheus.metrics.enabled: true
prometheus.metrics.podMonitor.enabled: false
asserts:
- hasDocuments:
count: 0
- it: Skip podMonitor when both monitor types are enabled.
set:
prometheus.metrics.enabled: true
prometheus.metrics.podMonitor.enabled: true
prometheus.metrics.serviceMonitor.enabled: true
asserts:
- hasDocuments:
count: 0
- it: Rendering podMonitor with default values - enabled manually.
set:
prometheus.metrics.enabled: true
prometheus.metrics.podMonitor.enabled: true
asserts:
- hasDocuments:
count: 1
- containsDocument:
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
name: reposilite-unittest
namespace: testing
- notExists:
path: metadata.annotations
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: reposilite-unittest
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: reposilite
app.kubernetes.io/version: 0.1.0
helm.sh/chart: reposilite-0.1.0
- isSubset:
path: spec.podMetricsEndpoints[0].basicAuth
content:
password:
key: password
name: reposilite-unittest-basic-auth-credentials
username:
key: username
name: reposilite-unittest-basic-auth-credentials
- equal:
path: spec.podMetricsEndpoints[0].enableHttp2
value: false
- equal:
path: spec.podMetricsEndpoints[0].followRedirects
value: false
- equal:
path: spec.podMetricsEndpoints[0].honorLabels
value: false
- equal:
path: spec.podMetricsEndpoints[0].interval
value: 60s
- equal:
path: spec.podMetricsEndpoints[0].path
value: /metrics
- equal:
path: spec.podMetricsEndpoints[0].port
value: http
- notExists:
path: spec.podMetricsEndpoints[0].relabelings
- equal:
path: spec.podMetricsEndpoints[0].scrapeTimeout
value: 30s
- equal:
path: spec.podMetricsEndpoints[0].scheme
value: http
- contains:
path: spec.namespaceSelector.matchNames
content:
testing
- equal:
path: spec.selector.matchLabels
value:
app.kubernetes.io/instance: reposilite-unittest
app.kubernetes.io/name: reposilite
- it: Render podMonitor with custom annotations and labels.
set:
prometheus.metrics.enabled: true
prometheus.metrics.podMonitor.enabled: true
prometheus.metrics.podMonitor.annotations:
foo: bar
prometheus.metrics.podMonitor.labels:
bar: foo
asserts:
- equal:
path: metadata.annotations
value:
foo: bar
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: reposilite-unittest
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: reposilite
app.kubernetes.io/version: 0.1.0
bar: foo
helm.sh/chart: reposilite-0.1.0
- it: Change defaults
set:
prometheus.metrics.enabled: true
prometheus.metrics.podMonitor.enabled: true
prometheus.metrics.podMonitor.enableHttp2: false
prometheus.metrics.podMonitor.followRedirects: true
prometheus.metrics.podMonitor.honorLabels: true
prometheus.metrics.podMonitor.interval: "180s"
prometheus.metrics.podMonitor.path: "/my-metrics"
prometheus.metrics.podMonitor.port: "8443"
prometheus.metrics.podMonitor.relabelings:
- sourceLabels: [ container ]
separator: ";"
regex: "app"
replacement: "$1"
action: "drop"
prometheus.metrics.podMonitor.scheme: https
prometheus.metrics.podMonitor.scrapeTimeout: "5s"
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.podMetricsEndpoints[0].enableHttp2
value: false
- equal:
path: spec.podMetricsEndpoints[0].followRedirects
value: true
- equal:
path: spec.podMetricsEndpoints[0].honorLabels
value: true
- equal:
path: spec.podMetricsEndpoints[0].interval
value: 180s
- equal:
path: spec.podMetricsEndpoints[0].path
value: /my-metrics
- equal:
path: spec.podMetricsEndpoints[0].port
value: "8443"
- contains:
path: spec.podMetricsEndpoints[0].relabelings
content:
sourceLabels: [ container ]
separator: ";"
regex: "app"
replacement: "$1"
action: "drop"
- equal:
path: spec.podMetricsEndpoints[0].scrapeTimeout
value: 5s
- equal:
path: spec.podMetricsEndpoints[0].scheme
value: https