Skip to content

Commit 0b8aeda

Browse files
committed
Spike: test istio k8s discovery
1 parent 5268846 commit 0b8aeda

File tree

23 files changed

+762
-3
lines changed

23 files changed

+762
-3
lines changed

.github/workflows/integration-test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ jobs:
402402
id: get-matrix-k8s
403403
run: |
404404
includes=""
405-
for service in "envoy"; do
405+
for service in "envoy" "istio"; do
406406
for arch in "amd64"; do
407407
includes="${includes},{\"SERVICE\": \"${service}\", \"ARCH\": \"${arch}\"}"
408408
done
@@ -430,7 +430,9 @@ jobs:
430430
cluster_name: kind
431431
- name: Deploy service under test
432432
run: |
433-
kubectl apply -f k8s/${{ matrix.SERVICE }}/*.yaml
433+
for f in k8s/${{ matrix.SERVICE }}/*.sh; do
434+
bash "$f"
435+
done
434436
- uses: actions/setup-go@v5
435437
with:
436438
go-version: ${{ env.GO_VERSION }}

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ smartagent-integration-test:
131131
integration-test-envoy-discovery-k8s:
132132
@set -e; cd tests && $(GOTEST_SERIAL) $(BUILD_INFO_TESTS) --tags=discovery_integration_envoy_k8s -v -timeout 5m -count 1 ./...
133133

134+
.PHONY: integration-test-istio-discovery-k8s
135+
integration-test-istio-discovery-k8s:
136+
@set -e; cd tests && $(GOTEST_SERIAL) $(BUILD_INFO_TESTS) --tags=discovery_integration_istio_k8s -v -timeout 5m -count 1 ./...
137+
134138
.PHONY: test-with-cover
135139
test-with-cover:
136140
@echo Verifying that all packages have test files to count in coverage
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#####################################################################################
2+
# This file is generated by the Splunk Distribution of the OpenTelemetry Collector. #
3+
# #
4+
# It reflects the default configuration bundled in the Collector executable for use #
5+
# in discovery mode (--discovery) and is provided for reference or customization. #
6+
# Please note that any changes made to this file will need to be reconciled during #
7+
# upgrades of the Collector. #
8+
#####################################################################################
9+
# prometheus/istio:
10+
# enabled: true
11+
# rule:
12+
# k8s_observer: type == "pod.container" and container_image matches "istio"
13+
# config:
14+
# default:
15+
# config:
16+
# scrape_configs:
17+
# - job_name: 'envoy'
18+
# metrics_path: /stats/prometheus
19+
# scrape_interval: 10s
20+
# static_configs:
21+
# - targets: ['`endpoint`']
22+
# metric_relabel_configs:
23+
# - source_labels: [__name__]
24+
# action: keep
25+
# regex: '(envoy_cluster_upstream_cx_active|envoy_cluster_upstream_cx_total|envoy_cluster_upstream_cx_connect_fail|envoy_cluster_upstream_cx_connect_ms|envoy_cluster_upstream_rq_active|envoy_cluster_upstream_rq_total|envoy_cluster_upstream_rq_timeout|envoy_cluster_upstream_rq_pending_active|envoy_cluster_upstream_rq_pending_overflow|envoy_cluster_upstream_rq_time|envoy_cluster_membership_total|envoy_cluster_membership_degraded|envoy_cluster_membership_excluded|envoy_listener_downstream_cx_active|envoy_listener_downstream_cx_total|envoy_listener_downstream_cx_transport_socket_connect_timeout|envoy_listener_downstream_cx_overflow|envoy_listener_downstream_cx_overload_reject|envoy_listener_downstream_global_cx_overflow)'
26+
# status:
27+
# metrics:
28+
# - status: successful
29+
# strict: envoy_cluster_upstream_cx_active
30+
# message: istio prometheus receiver is working!
31+
# statements:
32+
# - status: failed
33+
# regexp: "connection refused"
34+
# message: The container is not serving http connections.
35+
# - status: failed
36+
# regexp: "dial tcp: lookup"
37+
# message: Unable to resolve istio prometheus tcp endpoint
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#####################################################################################
2+
# Do not edit manually! #
3+
# All changes must be made to associated .tmpl file before running 'make bundle.d'. #
4+
#####################################################################################
5+
prometheus/istio:
6+
enabled: true
7+
rule:
8+
k8s_observer: type == "pod.container" and container_image matches "istio"
9+
config:
10+
default:
11+
config:
12+
scrape_configs:
13+
- job_name: 'envoy'
14+
metrics_path: /stats/prometheus
15+
scrape_interval: 10s
16+
static_configs:
17+
- targets: ['`endpoint`']
18+
metric_relabel_configs:
19+
- source_labels: [__name__]
20+
action: keep
21+
regex: '(envoy_cluster_upstream_cx_active|envoy_cluster_upstream_cx_total|envoy_cluster_upstream_cx_connect_fail|envoy_cluster_upstream_cx_connect_ms|envoy_cluster_upstream_rq_active|envoy_cluster_upstream_rq_total|envoy_cluster_upstream_rq_timeout|envoy_cluster_upstream_rq_pending_active|envoy_cluster_upstream_rq_pending_overflow|envoy_cluster_upstream_rq_time|envoy_cluster_membership_total|envoy_cluster_membership_degraded|envoy_cluster_membership_excluded|envoy_listener_downstream_cx_active|envoy_listener_downstream_cx_total|envoy_listener_downstream_cx_transport_socket_connect_timeout|envoy_listener_downstream_cx_overflow|envoy_listener_downstream_cx_overload_reject|envoy_listener_downstream_global_cx_overflow)'
22+
status:
23+
metrics:
24+
- status: successful
25+
strict: envoy_cluster_upstream_cx_active
26+
message: istio prometheus receiver is working!
27+
statements:
28+
- status: failed
29+
regexp: "connection refused"
30+
message: The container is not serving http connections.
31+
- status: failed
32+
regexp: "dial tcp: lookup"
33+
message: Unable to resolve istio prometheus tcp endpoint
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{{ receiver "prometheus/istio" }}:
2+
enabled: true
3+
rule:
4+
k8s_observer: type == "pod.container" and container_image matches "istio"
5+
config:
6+
default:
7+
config:
8+
scrape_configs:
9+
- job_name: 'envoy'
10+
metrics_path: /stats/prometheus
11+
scrape_interval: 10s
12+
static_configs:
13+
- targets: ['`endpoint`']
14+
metric_relabel_configs:
15+
- source_labels: [__name__]
16+
action: keep
17+
regex: '(envoy_cluster_upstream_cx_active|envoy_cluster_upstream_cx_total|envoy_cluster_upstream_cx_connect_fail|envoy_cluster_upstream_cx_connect_ms|envoy_cluster_upstream_rq_active|envoy_cluster_upstream_rq_total|envoy_cluster_upstream_rq_timeout|envoy_cluster_upstream_rq_pending_active|envoy_cluster_upstream_rq_pending_overflow|envoy_cluster_upstream_rq_time|envoy_cluster_membership_total|envoy_cluster_membership_degraded|envoy_cluster_membership_excluded|envoy_listener_downstream_cx_active|envoy_listener_downstream_cx_total|envoy_listener_downstream_cx_transport_socket_connect_timeout|envoy_listener_downstream_cx_overflow|envoy_listener_downstream_cx_overload_reject|envoy_listener_downstream_global_cx_overflow)'
18+
status:
19+
metrics:
20+
- status: successful
21+
strict: envoy_cluster_upstream_cx_active
22+
message: istio prometheus receiver is working!
23+
statements:
24+
- status: failed
25+
regexp: "connection refused"
26+
message: The container is not serving http connections.
27+
- status: failed
28+
regexp: "dial tcp: lookup"
29+
message: Unable to resolve istio prometheus tcp endpoint

internal/confmapprovider/discovery/bundle/bundle_gen.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
//go:generate discoverybundler --render --commented --dir ../../../../cmd/otelcol/config/collector/config.d.linux/receivers -t bundle.d/receivers/apache.discovery.yaml.tmpl
2828
//go:generate discoverybundler --render --template bundle.d/receivers/envoy.discovery.yaml.tmpl
2929
//go:generate discoverybundler --render --commented --dir ../../../../cmd/otelcol/config/collector/config.d.linux/receivers -t bundle.d/receivers/envoy.discovery.yaml.tmpl
30+
//go:generate discoverybundler --render --template bundle.d/receivers/istio.discovery.yaml.tmpl
31+
//go:generate discoverybundler --render --commented --dir ../../../../cmd/otelcol/config/collector/config.d.linux/receivers -t bundle.d/receivers/istio.discovery.yaml.tmpl
3032
//go:generate discoverybundler --render --template bundle.d/receivers/jmx-cassandra.discovery.yaml.tmpl
3133
//go:generate discoverybundler --render --commented --dir ../../../../cmd/otelcol/config/collector/config.d.linux/receivers -t bundle.d/receivers/jmx-cassandra.discovery.yaml.tmpl
3234
//go:generate discoverybundler --render --template bundle.d/receivers/kafkametrics.discovery.yaml.tmpl

internal/confmapprovider/discovery/bundle/bundledfs_other_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ func TestBundleDir(t *testing.T) {
2929
require.Equal(t, []string{
3030
"bundle.d/receivers/apache.discovery.yaml",
3131
"bundle.d/receivers/envoy.discovery.yaml",
32+
"bundle.d/receivers/istio.discovery.yaml",
3233
"bundle.d/receivers/jmx-cassandra.discovery.yaml",
3334
"bundle.d/receivers/kafkametrics.discovery.yaml",
3435
"bundle.d/receivers/mongodb.discovery.yaml",

internal/confmapprovider/discovery/bundle/bundledfs_others.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
//go:embed bundle.d/extensions/k8s-observer.discovery.yaml
2828
//go:embed bundle.d/receivers/apache.discovery.yaml
2929
//go:embed bundle.d/receivers/envoy.discovery.yaml
30+
//go:embed bundle.d/receivers/istio.discovery.yaml
3031
//go:embed bundle.d/receivers/jmx-cassandra.discovery.yaml
3132
//go:embed bundle.d/receivers/kafkametrics.discovery.yaml
3233
//go:embed bundle.d/receivers/mongodb.discovery.yaml

internal/confmapprovider/discovery/bundle/bundledfs_windows.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
//go:embed bundle.d/extensions/k8s-observer.discovery.yaml
2828
//go:embed bundle.d/receivers/apache.discovery.yaml
2929
//go:embed bundle.d/receivers/envoy.discovery.yaml
30+
//go:embed bundle.d/receivers/istio.discovery.yaml
3031
//go:embed bundle.d/receivers/jmx-cassandra.discovery.yaml
3132
//go:embed bundle.d/receivers/kafkametrics.discovery.yaml
3233
//go:embed bundle.d/receivers/mongodb.discovery.yaml

internal/confmapprovider/discovery/bundle/bundledfs_windows_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ func TestBundleDir(t *testing.T) {
2929
require.Equal(t, []string{
3030
"bundle.d/receivers/apache.discovery.yaml",
3131
"bundle.d/receivers/envoy.discovery.yaml",
32+
"bundle.d/receivers/istio.discovery.yaml",
3233
"bundle.d/receivers/jmx-cassandra.discovery.yaml",
3334
"bundle.d/receivers/kafkametrics.discovery.yaml",
3435
"bundle.d/receivers/mongodb.discovery.yaml",

0 commit comments

Comments
 (0)