cw-infra-apps/grafana/charts/feature-integrations/tests/etcd_test.yaml
2025-05-28 10:01:42 +03:00

89 lines
2.9 KiB
YAML

# yamllint disable rule:document-start rule:line-length rule:trailing-spaces
suite: Test etcd Integration - Metrics
templates:
- configmap.yaml
tests:
- it: should create the etcd config
set:
deployAsConfigMap: true
etcd:
instances:
- name: etcd
labelSelectors:
app.kubernetes.io/component: etcd
asserts:
- isKind:
of: ConfigMap
- equal:
path: data["metrics.alloy"]
value: |-
declare "etcd_integration" {
argument "metrics_destinations" {
comment = "Must be a list of metric destinations where collected metrics should be forwarded to"
}
import.git "etcd" {
repository = "https://github.com/grafana/alloy-modules.git"
revision = "main"
path = "modules/databases/kv/etcd/metrics.alloy"
pull_frequency = "15m"
}
etcd.kubernetes "etcd" {
label_selectors = ["app.kubernetes.io/component=etcd"]
port_name = "metrics"
}
etcd.scrape "etcd" {
targets = etcd.kubernetes.etcd.output
job_label = "integrations/etcd"
clustering = true
scrape_interval = "60s"
max_cache_size = 100000
forward_to = argument.metrics_destinations.value
}
}
- it: can be restricted to a namespace
set:
deployAsConfigMap: true
etcd:
instances:
- name: my-etcd
labelSelectors:
app.kubernetes.io/component: my-etcd
namespaces:
- kube-system
asserts:
- isKind:
of: ConfigMap
- equal:
path: data["metrics.alloy"]
value: |-
declare "etcd_integration" {
argument "metrics_destinations" {
comment = "Must be a list of metric destinations where collected metrics should be forwarded to"
}
import.git "etcd" {
repository = "https://github.com/grafana/alloy-modules.git"
revision = "main"
path = "modules/databases/kv/etcd/metrics.alloy"
pull_frequency = "15m"
}
etcd.kubernetes "my_etcd" {
namespaces = ["kube-system"]
label_selectors = ["app.kubernetes.io/component=my-etcd"]
port_name = "metrics"
}
etcd.scrape "my_etcd" {
targets = etcd.kubernetes.my_etcd.output
job_label = "integrations/etcd"
clustering = true
scrape_interval = "60s"
max_cache_size = 100000
forward_to = argument.metrics_destinations.value
}
}