Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6e633ef

Browse files
committedNov 19, 2024·
e2e test prometheus operator crds
Signed-off-by: qiyang <dominic.qiyang@gmail.com>
1 parent d87da69 commit 6e633ef

File tree

4 files changed

+104
-0
lines changed

4 files changed

+104
-0
lines changed
 

‎hack/install-targetallocator-prometheus-crds.sh

+2
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ if [[ "$(kubectl api-resources --api-group=monitoring.coreos.com -o name)" ]]; t
55
else
66
kubectl create -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml
77
kubectl create -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml
8+
kubectl create -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/example/prometheus-operator-crd/monitoring.coreos.com_scrapeconfigs.yaml
9+
kubectl create -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/example/prometheus-operator-crd/monitoring.coreos.com_probes.yaml
810
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
apiVersion: apps/v1
2+
kind: StatefulSet
3+
metadata:
4+
name: prometheus-cr-v1beta1-collector
5+
status:
6+
readyReplicas: 1
7+
replicas: 1
8+
---
9+
apiVersion: apps/v1
10+
kind: Deployment
11+
metadata:
12+
name: prometheus-cr-v1beta1-targetallocator
13+
status:
14+
observedGeneration: 1
15+
readyReplicas: 1
16+
replicas: 1
17+
---
18+
apiVersion: v1
19+
data:
20+
targetallocator.yaml: |
21+
( contains(@, join(':', ['service_monitor_selector', ' null'])) ): true
22+
( contains(@, join(':', ['pod_monitor_selector', ' null'])) ): true
23+
( contains(@, join(':', ['probe_selector', ' null'])) ): true
24+
( contains(@, join(':', ['scrape_config_selector', ' null'])) ): false
25+
( contains(@, join(':', ['matchlabels', ' {}}'])) ): false
26+
( contains(@, join(':', ['matchexpressions', ' {}}'])) ): false
27+
kind: ConfigMap
28+
metadata:
29+
name: prometheus-cr-v1beta1-targetallocator
30+
31+
---
32+
apiVersion: v1
33+
data:
34+
collector.yaml: |
35+
exporters:
36+
prometheus:
37+
endpoint: 0.0.0.0:9090
38+
receivers:
39+
prometheus:
40+
config: {}
41+
target_allocator:
42+
collector_id: ${POD_NAME}
43+
endpoint: http://prometheus-cr-v1beta1-targetallocator:80
44+
interval: 30s
45+
service:
46+
pipelines:
47+
metrics:
48+
exporters:
49+
- prometheus
50+
receivers:
51+
- prometheus
52+
telemetry:
53+
metrics:
54+
address: 0.0.0.0:8888
55+
kind: ConfigMap
56+
metadata:
57+
name: prometheus-cr-v1beta1-collector-19c94a81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
apiVersion: opentelemetry.io/v1beta1
3+
kind: OpenTelemetryCollector
4+
metadata:
5+
name: prometheus-cr-v1beta1
6+
spec:
7+
config:
8+
receivers:
9+
prometheus:
10+
config:
11+
scrape_configs: []
12+
13+
processors:
14+
15+
exporters:
16+
prometheus:
17+
endpoint: 0.0.0.0:9090
18+
service:
19+
pipelines:
20+
metrics:
21+
receivers: [prometheus]
22+
exporters: [prometheus]
23+
mode: statefulset
24+
serviceAccount: collector
25+
targetAllocator:
26+
enabled: true
27+
prometheusCR:
28+
enabled: true
29+
scrapeInterval: 1s
30+
scrapeConfigSelector: {}
31+
serviceAccount: ta
32+
---
33+
apiVersion: monitoring.coreos.com/v1alpha1
34+
kind: ScrapeConfig
35+
metadata:
36+
name: scrape-config-cr
37+
spec:
38+
kubernetesSDConfigs:
39+
- role: Node

‎tests/e2e-targetallocator/targetallocator-prometheuscr/chainsaw-test.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,9 @@ spec:
2222
file: 01-install.yaml
2323
- assert:
2424
file: 01-assert.yaml
25+
- name: step-02
26+
try:
27+
- apply:
28+
file: 02-install.yaml
29+
- assert:
30+
file: 02-assert.yaml

0 commit comments

Comments
 (0)
Please sign in to comment.