Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/e2e-reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ jobs:
- e2e-multi-instrumentation
- e2e-metadata-filters
- e2e-ta-collector-mtls
- e2e-ta-standalone
- e2e-crd-validations
include:
- group: e2e-instrumentation-default
Expand All @@ -97,6 +98,8 @@ jobs:
setup: "add-operator-arg OPERATOR_ARG='--annotations-filter=.*filter.out --annotations-filter=config.*.gke.io.* --labels-filter=.*filter.out' prepare-e2e"
- group: e2e-ta-collector-mtls
setup: "add-operator-arg OPERATOR_ARG='--feature-gates=operator.targetallocator.mtls' add-certmanager-permissions prepare-e2e"
- group: e2e-ta-standalone
setup: "prepare-e2e-ta-standalone"
- group: e2e-automatic-rbac
setup: "add-rbac-permissions-to-operator prepare-e2e"

Expand Down
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,17 @@ add-certmanager-permissions:
e2e-ta-collector-mtls: chainsaw
$(CHAINSAW) test --test-dir ./tests/e2e-ta-collector-mtls --report-name e2e-ta-collector-mtls

# Standalone Target Allocator integration tests (no operator needed)
.PHONY: prepare-e2e-ta-standalone
prepare-e2e-ta-standalone: chainsaw start-kind load-image-all
@mkdir -p ./.testresults/e2e

.PHONY: e2e-ta-standalone
e2e-ta-standalone: chainsaw
TARGETALLOCATOR_IMG=$(TARGETALLOCATOR_IMG) \
COLLECTOR_IMG=$${COLLECTOR_IMG:-"ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:$$(awk -F= '/^opentelemetry-collector=/ {print $$2}' versions.txt)"} \
$(CHAINSAW) test --test-dir ./tests/e2e-ta-standalone --report-name e2e-ta-standalone

# end-to-end-test for Annotations/Labels Filters
.PHONY: e2e-metadata-filters
e2e-metadata-filters: chainsaw
Expand Down
31 changes: 31 additions & 0 deletions tests/e2e-ta-standalone/ta-standalone/00-rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: ta-standalone
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: ($clusterRoleName)
rules:
- apiGroups: [""]
resources: [pods, nodes, namespaces, services, endpoints]
verbs: [get, list, watch]
- apiGroups: [discovery.k8s.io]
resources: [endpointslices]
verbs: [get, list, watch]
- nonResourceURLs: [/metrics]
verbs: [get]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: ($clusterRoleBindingName)
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: ($clusterRoleName)
subjects:
- kind: ServiceAccount
name: ta-standalone
namespace: ($namespace)
23 changes: 23 additions & 0 deletions tests/e2e-ta-standalone/ta-standalone/01-ta-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: ta-config
data:
targetallocator.yaml: |
allocation_strategy: consistent-hashing
filter_strategy: relabel-config
collector_selector:
matchLabels:
app: otel-collector
config:
scrape_configs:
- job_name: test-targets
scrape_interval: 30s
static_configs:
- targets:
- "target-a:8080"
- "target-b:8080"
- "target-c:8080"
- "target-d:8080"
- "target-e:8080"
- "target-f:8080"
56 changes: 56 additions & 0 deletions tests/e2e-ta-standalone/ta-standalone/02-ta-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ta-standalone
spec:
replicas: 1
selector:
matchLabels:
app: ta-standalone
template:
metadata:
labels:
app: ta-standalone
spec:
serviceAccountName: ta-standalone
containers:
- name: ta
image: ($TARGETALLOCATOR_IMG)
ports:
- containerPort: 8080
name: http
protocol: TCP
env:
- name: OTELCOL_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
volumeMounts:
- name: ta-config
mountPath: /conf
livenessProbe:
httpGet:
path: /livez
port: 8080
initialDelaySeconds: 5
readinessProbe:
httpGet:
path: /readyz
port: 8080
initialDelaySeconds: 5
volumes:
- name: ta-config
configMap:
name: ta-config
---
apiVersion: v1
kind: Service
metadata:
name: ta-standalone
spec:
selector:
app: ta-standalone
ports:
- name: http
port: 80
targetPort: http
13 changes: 13 additions & 0 deletions tests/e2e-ta-standalone/ta-standalone/03-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ta-standalone
status:
readyReplicas: 1
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: collector
status:
readyReplicas: 2
63 changes: 63 additions & 0 deletions tests/e2e-ta-standalone/ta-standalone/03-collectors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: collector-config
data:
collector.yaml: |
receivers:
prometheus:
config: {}
target_allocator:
collector_id: ${POD_NAME}
endpoint: http://ta-standalone:80
interval: 30s
exporters:
debug: {}
service:
pipelines:
metrics:
receivers: [prometheus]
exporters: [debug]
telemetry:
metrics:
readers:
- pull:
exporter:
prometheus:
host: 0.0.0.0
port: 8888
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: collector
spec:
replicas: 2
serviceName: collector
selector:
matchLabels:
app: otel-collector
template:
metadata:
labels:
app: otel-collector
spec:
containers:
- name: collector
image: ($COLLECTOR_IMG)
args: ["--config=/conf/collector.yaml"]
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
ports:
- containerPort: 8888
name: metrics
volumeMounts:
- name: config
mountPath: /conf
volumes:
- name: config
configMap:
name: collector-config
Loading
Loading