Skip to content

Commit

Permalink
[processor/k8sattribute] add more test cases for k8sattribute e2e
Browse files Browse the repository at this point in the history
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
  • Loading branch information
fatsheep9146 committed Feb 13, 2023
1 parent 2ce8945 commit faf3ee2
Show file tree
Hide file tree
Showing 8 changed files with 354 additions and 29 deletions.
16 changes: 16 additions & 0 deletions .chloggen/k8sattribute-e2e-more-case.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: processor/k8sattribute

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: add more test cases for k8sattribute e2e

# One or more tracking issues related to the change
issues: [18512]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
14 changes: 13 additions & 1 deletion .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,19 @@ jobs:
kubectl -n default create -f .github/workflows/e2e/k8s/telemetrygen-job.yml
- name: check telemetrygen job status
run: |
kubectl wait --for=condition=Complete --timeout=60s job/test-telemetrygen
kubectl wait --for=condition=Complete --timeout=60s job/test-telemetrygen-job
- name: start telemetrygen statefulset
run: |
kubectl -n default create -f .github/workflows/e2e/k8s/telemetrygen-statefulset.yml
- name: start telemetrygen deployment
run: |
kubectl -n default create -f .github/workflows/e2e/k8s/telemetrygen-deployment.yml
- name: start telemetrygen daemonset
run: |
kubectl -n default create -f .github/workflows/e2e/k8s/telemetrygen-daemonset.yml
- name: wait telemetrygen statefulset/deployment/daemonset to generate trace
run: |
sleep 30
- name: copy trace output
run: |
kubectl cp -c filecp default/test-opentelemetry-collector-0:tmp/trace.json processor/k8sattributesprocessor/testdata/trace.json
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/e2e/k8s/collector-helm-values.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,36 @@ presets:
enabled: true

config:
processors:
k8sattributes:
extract:
metadata:
- "k8s.pod.name"
- "k8s.pod.start_time"
- "k8s.pod.uid"
- "k8s.namespace.name"
- "k8s.deployment.name"
- "k8s.replicaset.name"
- "k8s.replicaset.uid"
- "k8s.statefulset.name"
- "k8s.statefulset.uid"
- "k8s.daemonset.name"
- "k8s.daemonset.uid"
- "k8s.cronjob.name"
- "k8s.job.name"
- "k8s.job.uid"
- "k8s.node.name"
- "container.id"
- "container.image.name"
- "container.image.tag"
annotations:
- tag_name: "k8s.annotations.workload"
key: "workload"
from: pod
labels:
- tag_name: "k8s.labels.app"
key: "app"
from: pod
exporters:
logging: {}
file/trace:
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/e2e/k8s/telemetrygen-daemonset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: test-telemetrygen-daemonset
spec:
selector:
matchLabels:
app: test-telemetrygen-daemonset
template:
metadata:
annotations:
workload: daemonset
labels:
app: test-telemetrygen-daemonset
spec:
containers:
- command:
- /telemetrygen
- traces
- --otlp-insecure
- --otlp-endpoint=test-opentelemetry-collector:4317
- --service=test-daemonset
- --duration=36000s
- --rate=1
- --otlp-attributes=k8s.container.name="telemetrygen"
- --otlp-attributes=k8s.container.restart_count="0"
image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest
imagePullPolicy: IfNotPresent
name: telemetrygen
resources: {}
securityContext: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
38 changes: 38 additions & 0 deletions .github/workflows/e2e/k8s/telemetrygen-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: test-telemetrygen-deployment
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: test-telemetrygen-deployment
template:
metadata:
annotations:
workload: deployment
labels:
app: test-telemetrygen-deployment
spec:
containers:
- command:
- /telemetrygen
- traces
- --otlp-insecure
- --otlp-endpoint=test-opentelemetry-collector:4317
- --service=test-deployment
- --duration=36000s
- --rate=1
- --otlp-attributes=k8s.container.name="telemetrygen"
- --otlp-attributes=k8s.container.restart_count="0"
image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest
imagePullPolicy: IfNotPresent
name: telemetrygen
resources: {}
securityContext: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
12 changes: 9 additions & 3 deletions .github/workflows/e2e/k8s/telemetrygen-job.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
apiVersion: batch/v1
kind: Job
metadata:
name: test-telemetrygen
name: test-telemetrygen-job
namespace: default
spec:
template:
metadata:
annotations:
workload: job
labels:
component: test-telemetrygen
app: test-telemetrygen
spec:
containers:
- command:
- /telemetrygen
- traces
- --otlp-insecure
- --otlp-endpoint=test-opentelemetry-collector:4317
- --duration=5s
- --service=test-job
- --traces=5
- --rate=1
- --otlp-attributes=k8s.container.name="telemetrygen"
- --otlp-attributes=k8s.container.restart_count="0"
image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest
imagePullPolicy: IfNotPresent
name: telemetrygen
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/e2e/k8s/telemetrygen-statefulset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: test-telemetrygen-statefulset
namespace: default
spec:
serviceName: test-telemetrygen-statefulset
replicas: 1
selector:
matchLabels:
app: test-telemetrygen-statefulset
template:
metadata:
metadata:
annotations:
workload: statefulset
labels:
app: test-telemetrygen-statefulset
spec:
containers:
- command:
- /telemetrygen
- traces
- --otlp-insecure
- --otlp-endpoint=test-opentelemetry-collector:4317
- --service=test-statefulset
- --duration=36000s
- --rate=1
- --otlp-attributes=k8s.container.name="telemetrygen"
- --otlp-attributes=k8s.container.restart_count="0"
image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest
imagePullPolicy: IfNotPresent
name: telemetrygen
resources: {}
securityContext: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
Loading

0 comments on commit faf3ee2

Please sign in to comment.