-
Notifications
You must be signed in to change notification settings - Fork 463
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add e2e tests for prometheus receiver configuration (#1762)
* Add e2e tests for prometheus receiver configuration * add new tests to the modify images script
- Loading branch information
Mikołaj Świątek
authored
May 24, 2023
1 parent
5805127
commit a5537a1
Showing
9 changed files
with
323 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: promreceiver-allocatorconfig-collector | ||
status: | ||
replicas: 1 | ||
readyReplicas: 1 | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: promreceiver-allocatorconfig-targetallocator | ||
status: | ||
replicas: 1 | ||
readyReplicas: 1 | ||
--- | ||
# Print TA and operator logs if test fails | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
collectors: | ||
- selector: app.kubernetes.io/component=opentelemetry-targetallocator | ||
- selector: app.kubernetes.io/component=opentelemetry-collector | ||
- selector: app.kubernetes.io/name=opentelemetry-operator | ||
namespace: opentelemetry-operator-system | ||
container: manager |
69 changes: 69 additions & 0 deletions
69
tests/e2e/prometheus-config-validation/00-promreceiver-allocatorconfig.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: ta | ||
automountServiceAccountToken: true | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: pod-view | ||
rules: | ||
- apiGroups: [""] | ||
resources: [ "pods" ] | ||
verbs: [ "get", "list", "watch"] | ||
--- | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- command: kubectl -n $NAMESPACE create rolebinding default-view-$NAMESPACE --role=pod-view --serviceaccount=$NAMESPACE:ta | ||
--- | ||
apiVersion: opentelemetry.io/v1alpha1 | ||
kind: OpenTelemetryCollector | ||
metadata: | ||
name: promreceiver-allocatorconfig | ||
spec: | ||
mode: statefulset | ||
targetAllocator: | ||
enabled: true | ||
image: "local/opentelemetry-operator-targetallocator:e2e" | ||
serviceAccount: ta | ||
prometheusCR: | ||
enabled: true | ||
|
||
config: | | ||
receivers: | ||
jaeger: | ||
protocols: | ||
grpc: | ||
# Collect own metrics | ||
prometheus: | ||
config: | ||
scrape_configs: | ||
- job_name: 'otel-collector' | ||
scrape_interval: 10s | ||
static_configs: | ||
- targets: [ '0.0.0.0:8888' ] | ||
target_allocator: | ||
endpoint: http://promreceiver-allocatorconfig-targetallocator | ||
interval: 30s | ||
collector_id: ${POD_NAME} | ||
processors: | ||
exporters: | ||
logging: | ||
extensions: | ||
health_check: | ||
service: | ||
telemetry: | ||
metrics: | ||
address: :8888 | ||
extensions: | ||
- health_check | ||
pipelines: | ||
traces: | ||
receivers: [jaeger] | ||
processors: [] | ||
exporters: [logging] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
## Uncomment this after https://github.com/open-telemetry/opentelemetry-operator/issues/958 is resolved | ||
## Unfortunately kuttl doesn't have a way to skip tests | ||
|
||
# apiVersion: apps/v1 | ||
# kind: StatefulSet | ||
# metadata: | ||
# name: labeldrop-collector | ||
# status: | ||
# replicas: 1 | ||
# readyReplicas: 1 | ||
# --- | ||
# apiVersion: apps/v1 | ||
# kind: Deployment | ||
# metadata: | ||
# name: labeldrop-targetallocator | ||
# status: | ||
# replicas: 1 | ||
# readyReplicas: 1 | ||
# --- | ||
# # Print TA and operator logs if test fails | ||
# apiVersion: kuttl.dev/v1beta1 | ||
# kind: TestAssert | ||
# collectors: | ||
# - selector: app.kubernetes.io/component=opentelemetry-targetallocator | ||
# - selector: app.kubernetes.io/component=opentelemetry-collector | ||
# - selector: app.kubernetes.io/name=opentelemetry-operator | ||
# namespace: opentelemetry-operator-system | ||
# container: manager |
49 changes: 49 additions & 0 deletions
49
tests/e2e/prometheus-config-validation/01-promreceiver-labeldrop.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
## Uncomment this after https://github.com/open-telemetry/opentelemetry-operator/issues/958 is resolved | ||
## Unfortunately kuttl doesn't have a way to skip tests | ||
|
||
# apiVersion: opentelemetry.io/v1alpha1 | ||
# kind: OpenTelemetryCollector | ||
# metadata: | ||
# name: labeldrop | ||
# spec: | ||
# mode: statefulset | ||
# targetAllocator: | ||
# enabled: true | ||
# image: "local/opentelemetry-operator-targetallocator:e2e" | ||
# serviceAccount: ta | ||
# prometheusCR: | ||
# enabled: true | ||
|
||
# config: | | ||
# receivers: | ||
# jaeger: | ||
# protocols: | ||
# grpc: | ||
|
||
# # Collect own metrics | ||
# prometheus: | ||
# config: | ||
# scrape_configs: | ||
# - job_name: 'otel-collector' | ||
# scrape_interval: 10s | ||
# static_configs: | ||
# - targets: [ '0.0.0.0:8888' ] | ||
# metric_relabel_configs: | ||
# - action: labeldrop | ||
# regex: (id|name) | ||
|
||
# target_allocator: | ||
# endpoint: http://labeldrop-targetallocator | ||
# interval: 30s | ||
# collector_id: ${POD_NAME} | ||
|
||
# processors: | ||
|
||
# exporters: | ||
# logging: | ||
# service: | ||
# pipelines: | ||
# traces: | ||
# receivers: [jaeger] | ||
# processors: [] | ||
# exporters: [logging] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: promreceiver-allocatorconfig-extra-collector | ||
status: | ||
replicas: 1 | ||
readyReplicas: 1 | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: promreceiver-allocatorconfig-extra-targetallocator | ||
status: | ||
replicas: 1 | ||
readyReplicas: 1 | ||
--- | ||
# Print TA and operator logs if test fails | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
collectors: | ||
- selector: app.kubernetes.io/component=opentelemetry-targetallocator | ||
- selector: app.kubernetes.io/component=opentelemetry-collector | ||
- selector: app.kubernetes.io/name=opentelemetry-operator | ||
namespace: opentelemetry-operator-system | ||
container: manager |
53 changes: 53 additions & 0 deletions
53
tests/e2e/prometheus-config-validation/02-promreceiver-allocatorconfig-extra.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
apiVersion: opentelemetry.io/v1alpha1 | ||
kind: OpenTelemetryCollector | ||
metadata: | ||
name: promreceiver-allocatorconfig-extra | ||
spec: | ||
mode: statefulset | ||
targetAllocator: | ||
enabled: true | ||
image: "local/opentelemetry-operator-targetallocator:e2e" | ||
serviceAccount: ta | ||
prometheusCR: | ||
enabled: true | ||
|
||
config: | | ||
receivers: | ||
jaeger: | ||
protocols: | ||
grpc: | ||
# Collect own metrics | ||
prometheus: | ||
config: | ||
scrape_configs: | ||
- job_name: 'otel-collector' | ||
scrape_interval: 10s | ||
static_configs: | ||
- targets: [ '0.0.0.0:8888' ] | ||
target_allocator: | ||
endpoint: http://promreceiver-allocatorconfig-extra-targetallocator | ||
interval: 30s | ||
collector_id: ${POD_NAME} | ||
http_sd_config: | ||
refresh_interval: 10s | ||
processors: | ||
exporters: | ||
logging: | ||
extensions: | ||
health_check: | ||
service: | ||
telemetry: | ||
metrics: | ||
address: :8888 | ||
extensions: | ||
- health_check | ||
pipelines: | ||
traces: | ||
receivers: [jaeger] | ||
processors: [] | ||
exporters: [logging] | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: promreceiver-nopromconfig-collector | ||
status: | ||
replicas: 1 | ||
readyReplicas: 1 | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: promreceiver-nopromconfig-targetallocator | ||
status: | ||
replicas: 1 | ||
readyReplicas: 1 | ||
--- | ||
# Print TA and operator logs if test fails | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
collectors: | ||
- selector: app.kubernetes.io/component=opentelemetry-targetallocator | ||
- selector: app.kubernetes.io/component=opentelemetry-collector | ||
- selector: app.kubernetes.io/name=opentelemetry-operator | ||
namespace: opentelemetry-operator-system | ||
container: manager |
48 changes: 48 additions & 0 deletions
48
tests/e2e/prometheus-config-validation/03-promreceiver-nopromconfig.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
apiVersion: opentelemetry.io/v1alpha1 | ||
kind: OpenTelemetryCollector | ||
metadata: | ||
name: promreceiver-nopromconfig | ||
spec: | ||
mode: statefulset | ||
targetAllocator: | ||
enabled: true | ||
image: "local/opentelemetry-operator-targetallocator:e2e" | ||
serviceAccount: ta | ||
prometheusCR: | ||
enabled: true | ||
|
||
config: | | ||
receivers: | ||
jaeger: | ||
protocols: | ||
grpc: | ||
prometheus: | ||
config: | ||
scrape_configs: [] | ||
target_allocator: | ||
endpoint: http://promreceiver-nopromconfig-targetallocator | ||
interval: 30s | ||
collector_id: ${POD_NAME} | ||
http_sd_config: | ||
refresh_interval: 10s | ||
processors: | ||
exporters: | ||
logging: | ||
extensions: | ||
health_check: | ||
service: | ||
telemetry: | ||
metrics: | ||
address: :8888 | ||
extensions: | ||
- health_check | ||
pipelines: | ||
traces: | ||
receivers: [jaeger] | ||
processors: [] | ||
exporters: [logging] | ||