Skip to content
Open
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
61 changes: 57 additions & 4 deletions hack/deploy-jaeger.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,76 @@
#!/usr/bin/env bash
# Deploy Jaeger all-in-one for dev OTLP trace collection (OLS-3024)
# Deploy Jaeger v2 all-in-one for dev OTLP trace collection (OLS-3024)
# Configures TLS on OTLP gRPC via OpenShift serving certs so the
# OTel collector can connect with insecure: false.
set -euo pipefail

NAMESPACE="${1:-observability}"
CERT_SECRET="jaeger-serving-cert"
CERT_MOUNT="/etc/jaeger-tls"
CONFIG_CM="jaeger-config"

echo "==> Deploying Jaeger all-in-one to namespace '$NAMESPACE'"

oc get project "$NAMESPACE" &>/dev/null || oc new-project "$NAMESPACE" --skip-config-write

oc create deployment jaeger --image=jaegertracing/jaeger:latest --port=16686 -n "$NAMESPACE" 2>/dev/null || echo "deployment/jaeger already exists"

oc set env deployment/jaeger COLLECTOR_OTLP_ENABLED=true -n "$NAMESPACE"

for svc in jaeger-ui:16686 jaeger-otlp-grpc:4317 jaeger-otlp-http:4318; do
name="${svc%%:*}"
port="${svc##*:}"
oc expose deployment jaeger --port="$port" --target-port="$port" --name="$name" -n "$NAMESPACE" 2>/dev/null || echo "svc/$name already exists"
done

oc annotate svc jaeger-otlp-grpc -n "$NAMESPACE" "service.beta.openshift.io/serving-cert-secret-name=$CERT_SECRET" --overwrite

echo "==> Waiting for serving-cert secret..."
for i in $(seq 1 30); do
oc get secret "$CERT_SECRET" -n "$NAMESPACE" &>/dev/null && break
sleep 2
done
oc get secret "$CERT_SECRET" -n "$NAMESPACE" &>/dev/null || { echo "ERROR: serving-cert secret not created"; exit 1; }

# Jaeger v2 is an OTel collector — configure TLS via its config file.
oc create configmap "$CONFIG_CM" -n "$NAMESPACE" --from-literal=config.yaml="$(cat <<YAMLEOF
extensions:
jaeger_query:
storage:
traces: some_storage
jaeger_storage:
backends:
some_storage:
memory:
max_traces: 100000

receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
tls:
cert_file: $CERT_MOUNT/tls.crt
key_file: $CERT_MOUNT/tls.key
http:
endpoint: 0.0.0.0:4318

exporters:
jaeger_storage_exporter:
trace_storage: some_storage

service:
extensions: [jaeger_query, jaeger_storage]
pipelines:
traces:
receivers: [otlp]
exporters: [jaeger_storage_exporter]
YAMLEOF
)" --dry-run=client -o yaml | oc apply -f -

oc set volume deployment/jaeger -n "$NAMESPACE" --add --overwrite --name=config --type=configmap --configmap-name="$CONFIG_CM" --mount-path=/etc/jaeger
oc set volume deployment/jaeger -n "$NAMESPACE" --add --overwrite --name=serving-cert --type=secret --secret-name="$CERT_SECRET" --mount-path="$CERT_MOUNT" --read-only

oc patch deployment jaeger -n "$NAMESPACE" --type=json -p '[{"op":"replace","path":"/spec/template/spec/containers/0/args","value":["--config","/etc/jaeger/config.yaml"]}]'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Use JSON Patch add for container arguments.

A deployment created on line 16 has no containers[0].args, so replace fails and aborts the script. add creates the field and also replaces it on reruns.

Proposed fix
-oc patch deployment jaeger -n "$NAMESPACE" --type=json -p '[{"op":"replace","path":"/spec/template/spec/containers/0/args","value":["--config","/etc/jaeger/config.yaml"]}]'
+oc patch deployment jaeger -n "$NAMESPACE" --type=json -p '[{"op":"add","path":"/spec/template/spec/containers/0/args","value":["--config","/etc/jaeger/config.yaml"]}]'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
oc patch deployment jaeger -n "$NAMESPACE" --type=json -p '[{"op":"replace","path":"/spec/template/spec/containers/0/args","value":["--config","/etc/jaeger/config.yaml"]}]'
oc patch deployment jaeger -n "$NAMESPACE" --type=json -p '[{"op":"add","path":"/spec/template/spec/containers/0/args","value":["--config","/etc/jaeger/config.yaml"]}]'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@hack/deploy-jaeger.sh` at line 72, Update the JSON patch operation in the
Jaeger deployment patch command to use `add` instead of `replace` for
`/spec/template/spec/containers/0/args`, so it creates the missing field on
initial deployment and replaces it safely on reruns.


oc expose svc jaeger-ui -n "$NAMESPACE" 2>/dev/null || echo "route/jaeger-ui already exists"

echo "==> Waiting for rollout..."
Expand All @@ -27,5 +80,5 @@ ROUTE=$(oc get route jaeger-ui -n "$NAMESPACE" -o jsonpath='{.spec.host}')

echo ""
echo "Jaeger UI: http://$ROUTE"
echo "OTLP gRPC: jaeger-otlp-grpc.$NAMESPACE.svc.cluster.local:4317"
echo "OTLP gRPC: jaeger-otlp-grpc.$NAMESPACE.svc.cluster.local:4317 (TLS)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Publish an https:// OTLP endpoint.

The linked tracing client enables TLS only when OTEL_EXPORTER_OTLP_ENDPOINT starts with https; copying this bare endpoint produces a plaintext connection attempt against the TLS listener.

-echo "OTLP gRPC:   jaeger-otlp-grpc.$NAMESPACE.svc.cluster.local:4317 (TLS)"
+echo "OTLP gRPC:   https://jaeger-otlp-grpc.$NAMESPACE.svc.cluster.local:4317 (TLS)"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
echo "OTLP gRPC: jaeger-otlp-grpc.$NAMESPACE.svc.cluster.local:4317 (TLS)"
echo "OTLP gRPC: https://jaeger-otlp-grpc.$NAMESPACE.svc.cluster.local:4317 (TLS)"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@hack/deploy-jaeger.sh` at line 83, Update the OTLP gRPC endpoint printed by
the deployment script to include the https:// scheme before the Jaeger service
hostname, while preserving the existing namespace and port values.

Source: Linked repositories

echo "OTLP HTTP: jaeger-otlp-http.$NAMESPACE.svc.cluster.local:4318"