Skip to content

Commit

Permalink
tests: consolidate opentelemetry-collector
Browse files Browse the repository at this point in the history
  • Loading branch information
zirain committed Aug 23, 2022
1 parent d7d5536 commit d264cbd
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 138 deletions.
2 changes: 1 addition & 1 deletion manifests/profiles/demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spec:
extensionProviders:
- name: otel
envoyOtelAls:
service: otel-collector.istio-system.svc.cluster.local
service: opentelemetry-collector.istio-system.svc.cluster.local
port: 4317
components:
egressGateways:
Expand Down
6 changes: 5 additions & 1 deletion pkg/test/env/istio.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ var (
LocalOut = verifyFile(LOCAL_OUT, LOCAL_OUT.ValueOrDefaultFunc(getDefaultIstioOut))

// OtelCollectorInstallFilePath is the OpenTelemetry installation file.
OtelCollectorInstallFilePath = path.Join(IstioSrc, getInstallationFile("opentelemetry/opentelemetry-collector.yaml"))
OtelCollectorInstallFilePath = path.Join(IstioSrc, getSampleFile("open-telemetry/otel.yaml"))

// StackdriverInstallFilePath is the stackdriver installation file.
StackdriverInstallFilePath = path.Join(IstioSrc, getInstallationFile("stackdriver/stackdriver.yaml"))
Expand All @@ -98,6 +98,10 @@ func getDefaultIstioSrc() string {
return Root
}

func getSampleFile(p string) string {
return fmt.Sprintf("samples/%s", p)
}

func getInstallationFile(p string) string {
return fmt.Sprintf("pkg/test/framework/components/%s", p)
}
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions samples/open-telemetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This sample demonstrates Istio's Open Telemetry ALS support.
First, create an `otel-collector` backend with simple configuration.

```bash
kubectl apply -f otel.yaml
kubectl apply -f otel.yaml -nistio-system
```

With following configuration, otel-collector will create a grpc receiver on port `4317`, and output to stdout. You can find more details form [here](https://github.com/open-telemetry/opentelemetry-collector).
Expand Down Expand Up @@ -74,6 +74,6 @@ kubectl logs $(kubectl get po -n istio-system | grep otel | awk '{print $1}') -n
## Cleanup

```bash
kubectl delete -f otel.yaml
kubectl delete -f otel.yaml -nistio-system
kubectl delete telemetry mesh-default -nistio-system
```
62 changes: 39 additions & 23 deletions samples/open-telemetry/otel.yaml
Original file line number Diff line number Diff line change
@@ -1,58 +1,71 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: otel-collector-conf
namespace: istio-system
name: opentelemetry-collector-conf
labels:
app: otel-collector
app: opentelemetry-collector
data:
otel-collector-config: |
opentelemetry-collector-config: |
receivers:
opencensus:
endpoint: 0.0.0.0:55678
otlp:
protocols:
grpc:
http:
processors:
batch:
exporters:
zipkin:
# Export to zipkin for easy querying
endpoint: http://zipkin.istio-system.svc:9411/api/v2/spans
logging:
loglevel: debug
extensions:
health_check:
port: 13133
service:
extensions:
- health_check
pipelines:
logs:
receivers: [otlp]
processors: [batch]
exporters: [logging]
traces:
receivers:
- opencensus
exporters:
- zipkin
- logging
---
apiVersion: v1
kind: Service
metadata:
name: otel-collector
namespace: istio-system
name: opentelemetry-collector
labels:
app: otel-collector
app: opentelemetry-collector
spec:
ports:
- name: grpc-opencensus
port: 55678
protocol: TCP
targetPort: 55678
- name: grpc-otlp # Default endpoint for OpenTelemetry receiver.
port: 4317
protocol: TCP
targetPort: 4317
selector:
app: otel-collector
app: opentelemetry-collector
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: otel-collector
namespace: istio-system
name: opentelemetry-collector
spec:
minReadySeconds: 5
progressDeadlineSeconds: 120
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: otel-collector
app: opentelemetry-collector
strategy:
rollingUpdate:
maxSurge: 1
Expand All @@ -61,13 +74,13 @@ spec:
template:
metadata:
labels:
app: otel-collector
app: opentelemetry-collector
sidecar.istio.io/inject: "false" # do not inject
spec:
containers:
- command:
- "/otelcol"
- "--config=/conf/otel-collector-config.yaml"
- "--config=/conf/opentelemetry-collector-config.yaml"
env:
- name: POD_NAME
valueFrom:
Expand All @@ -81,10 +94,13 @@ spec:
fieldPath: metadata.namespace
image: otel/opentelemetry-collector:0.54.0
imagePullPolicy: IfNotPresent
name: otel-collector
name: opentelemetry-collector
ports:
- containerPort: 4317
protocol: TCP
- name: grpc-opencensus
containerPort: 55678
protocol: TCP
resources:
limits:
cpu: "2"
Expand All @@ -95,7 +111,7 @@ spec:
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- name: otel-collector-config-vol
- name: opentelemetry-collector-config-vol
mountPath: /conf
dnsPolicy: ClusterFirst
restartPolicy: Always
Expand All @@ -105,7 +121,7 @@ spec:
- configMap:
defaultMode: 420
items:
- key: otel-collector-config
path: otel-collector-config.yaml
name: otel-collector-conf
name: otel-collector-config-vol
- key: opentelemetry-collector-config
path: opentelemetry-collector-config.yaml
name: opentelemetry-collector-conf
name: opentelemetry-collector-config-vol

0 comments on commit d264cbd

Please sign in to comment.