Skip to content

Commit

Permalink
Make a test to show how to use the clusterMetrics feature support the…
Browse files Browse the repository at this point in the history
… CoreDNS service integration (#1229)

* Make a test to show how to use the  clusterMetrics feature support the CoreDNS service integration

Signed-off-by: Pete Wall <[email protected]>

* Handle integration tests inside a subdirectory

Signed-off-by: Pete Wall <[email protected]>

* Fix integration test action and unit tests

Signed-off-by: Pete Wall <[email protected]>

* no dir, it's working-directory

Signed-off-by: Pete Wall <[email protected]>

* Get less clever

Signed-off-by: Pete Wall <[email protected]>

* Fix job name

Signed-off-by: Pete Wall <[email protected]>

---------

Signed-off-by: Pete Wall <[email protected]>
  • Loading branch information
petewall authored Feb 12, 2025
1 parent b23bcf9 commit e24ea72
Show file tree
Hide file tree
Showing 31 changed files with 2,964 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ jobs:

- name: List tests
id: list_tests
working-directory: charts/k8s-monitoring/tests/integration
run: |
tests=$(ls charts/k8s-monitoring/tests/integration)
tests=$(find . -name values.yaml -exec dirname {} \;)
echo "Tests: ${tests}"
echo "tests=$(echo "${tests}" | jq --raw-input --slurp --compact-output 'split("\n") | map(select(. != ""))')" >> "${GITHUB_OUTPUT}"
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
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:
grafana.ini:
auth.anonymous:
enabled: true
org_role: Admin
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,47 @@
---
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
dependsOn:
- name: prometheus
namespace: prometheus
values:
tests:
- env:
CLUSTER: coredns-integration-test
PROMETHEUS_URL: http://prometheus-server.prometheus.svc:9090/api/v1/query

queries:
# CoreDNS metrics
- query: coredns_build_info{cluster="$CLUSTER", job="integrations/coredns"}
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,17 @@
---
cluster:
name: coredns-integration-test

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

clusterMetrics:
enabled: true
kubeDNS:
enabled: true
jobLabel: integrations/coredns

alloy-metrics:
enabled: 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

0 comments on commit e24ea72

Please sign in to comment.