Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: consolidate opentelemetry-collector #40606

Merged
merged 2 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we keep the namespace? all the other samples have it baked in?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would forbidden user install the other namespace?

kubectl apply -f samples/open-telemetry/otel.yaml  --namespace=default
the namespace from the provided object "istio-system" does not match the namespace "default". You must pass '--namespace=istio-system' to perform this operation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is just a sample though, they can change it. Also the meshconfig in docs, etc will use the hardcoded namespace

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upadted

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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