Skip to content

Commit

Permalink
Add DPM checks for control plane integration test and add a test for …
Browse files Browse the repository at this point in the history
…annotation autodiscovery

Signed-off-by: Pete Wall <pete.wall@grafana.com>
  • Loading branch information
petewall committed Jan 3, 2025
1 parent c22f4cc commit 5746e4b
Show file tree
Hide file tree
Showing 9 changed files with 875 additions and 39 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: cert-manager
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata:
name: cert-manager
namespace: cert-manager
spec:
interval: 1m
url: https://charts.jetstack.io
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: cert-manager
namespace: cert-manager
spec:
interval: 1m
chart:
spec:
chart: cert-manager
sourceRef:
kind: HelmRepository
name: cert-manager
namespace: cert-manager
interval: 1m
values:
installCRDs: true
serviceAnnotations:
k8s.grafana.com/scrape: "true"
k8s.grafana.com/job: "integrations/cert-manager"
k8s.grafana.com/metrics.portNumber: "9402"
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: grafana
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata:
name: grafana
namespace: grafana
spec:
interval: 1m
url: https://grafana.github.io/helm-charts
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: grafana
namespace: grafana
spec:
interval: 1m
chart:
spec:
chart: grafana
sourceRef:
kind: HelmRepository
name: grafana
namespace: grafana
interval: 1m
values:
datasources:
datasources.yaml:
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
url: http://prometheus-server.prometheus.svc:9090
isDefault: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: prometheus
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata:
name: prometheus-community
namespace: prometheus
spec:
interval: 1m
url: https://prometheus-community.github.io/helm-charts
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: prometheus
namespace: prometheus
spec:
interval: 1m
chart:
spec:
chart: prometheus
version: "^25"
sourceRef:
kind: HelmRepository
name: prometheus-community
namespace: prometheus
interval: 1m
values:
server:
extraFlags:
- enable-feature=remote-write-receiver

persistentVolume:
enabled: false

service:
servicePort: 9090

serverFiles:
prometheus.yml:
scrape_configs: []

configmapReload:
prometheus:
enabled: false

alertmanager:
enabled: false

kube-state-metrics:
enabled: false

prometheus-node-exporter:
enabled: false

prometheus-pushgateway:
enabled: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: k8s-monitoring-test
spec:
interval: 1m
url: https://github.com/grafana/k8s-monitoring-helm
ref:
branch: main
ignore: |
/*
!/charts/k8s-monitoring-test
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: k8s-monitoring-test
spec:
interval: 1m
chart:
spec:
chart: charts/k8s-monitoring-test
sourceRef:
kind: GitRepository
name: k8s-monitoring-test
interval: 1m
values:
tests:
- env:
CLUSTER: annotation-autodiscovery-test
PROMETHEUS_URL: http://prometheus-server.prometheus.svc:9090/api/v1/query
queries:
# Self reporting metrics
- query: grafana_kubernetes_monitoring_build_info{cluster="$CLUSTER"}
type: promql
- query: grafana_kubernetes_monitoring_feature_info{cluster="$CLUSTER", feature="annotationAutodiscovery"}
type: promql

# Annotation Autodiscovery by Servicell
- query: certmanager_clock_time_seconds{cluster="$CLUSTER", job="integrations/cert-manager"}
type: promql

# DPM check
- query: avg(count_over_time(scrape_samples_scraped{cluster="$CLUSTER"}[1m]))
type: promql
expect:
value: 1
operator: ==
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
cluster:
name: annotation-autodiscovery-test

destinations:
- name: prometheus
type: prometheus
url: http://prometheus-server.prometheus.svc:9090/api/v1/write

annotationAutodiscovery:
enabled: true

selfReporting: {scrapeInterval: 1m} # Force self-report to be generated within test time

alloy-metrics:
enabled: true
controller:
replicas: 2
Loading

0 comments on commit 5746e4b

Please sign in to comment.