Skip to content

Commit 838789a

Browse files
committed
[dash0] chore: improve local k8s deployment
* remove deployment to two namespaces, we can resurrect that if we pick up https://linear.app/dash0/issue/ENG-951/make-the-deployment-topology-more-interesting again * rename namespace from otel-demo-ns to otel-demo * extract processing of values file into separate script * add support for sending data to a configurable ingress URL via OTEL_EXPORTER_OTLP_ENDPOINT * add support for using a custom values.yaml file via VALUES_YAML
1 parent cc29ca5 commit 838789a

12 files changed

+52
-224
lines changed

kubernetes/local/.gitignore

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
dash0-values.yaml
2-
ns1-values.yaml
3-
ns2-values.yaml
1+
dash0-otel-demo-local-k8s-values.yaml
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
cd -P -- "$(dirname -- "$0")"
6+
7+
source utils
8+
9+
if [[ -n ${VALUES_YAML:-} ]]; then
10+
echo "Using custom values yaml file: $VALUES_YAML"
11+
cp $VALUES_YAML dash0-otel-demo-local-k8s-values.yaml
12+
else
13+
echo "Creating dash0-otel-demo-local-k8s-values.yaml based on:"
14+
echo "- $dash0_configuration_dir/demo/environments/aws/demo-eu-west-1-demo.yaml and"
15+
echo "- $dash0_configuration_dir/demo/values.yaml"
16+
echo "Set VALUES_YAML to use a custom values file."
17+
echo
18+
yq \
19+
". *= load(\"$dash0_configuration_dir/demo/environments/aws/demo-eu-west-1-demo.yaml\")" \
20+
$dash0_configuration_dir/demo/values.yaml | \
21+
yq --from-file dash0-otel-demo-local-k8s.yq > \
22+
dash0-otel-demo-local-k8s-values.yaml
23+
24+
if [[ -n ${OTEL_EXPORTER_OTLP_ENDPOINT:-} ]]; then
25+
echo "Using non-default reporting endpoint from environment variable"
26+
echo "OTEL_EXPORTER_OTLP_ENDPOINT: $OTEL_EXPORTER_OTLP_ENDPOINT"
27+
echo
28+
yq -i ".opentelemetry-collector.config.exporters.otlp/dash0-dev.endpoint=\"$OTEL_EXPORTER_OTLP_ENDPOINT\" | del(.opentelemetry-collector.config.exporters.otlp/dash0-dev.auth) " dash0-otel-demo-local-k8s-values.yaml
29+
else
30+
echo "Reporting to $(yq '.opentelemetry-collector.config.exporters["otlp/dash0-dev"]'.endpoint dash0-otel-demo-local-k8s-values.yaml), set OTEL_EXPORTER_OTLP_ENDPOINT to report somewhere else."
31+
echo
32+
fi
33+
fi
34+

kubernetes/local/cross-namespace-service-names.yaml

-57
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.otelDemo.helm |
22
.default.image.pullSecrets=[{"name": "regcred"}] |
33
del(.opentelemetry-collector.config.exporters.otlp/dash0-prod) |
4+
del(.opentelemetry-collector.config.exporters.otlp/dash0-prod-pen-testing) |
45
del(.opentelemetry-collector.config.service.pipelines.*.exporters.[] | select(. == "otlp/dash0-prod*") ) |
56
.opentelemetry-collector.config.processors.resource.attributes[] |= select(.key == "cloud.account.id").value |= "012345678901"

kubernetes/local/deploy-two-namespaces.sh

-47
This file was deleted.

kubernetes/local/deploy.sh

+12-16
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,31 @@ git_pull_dash0_configuration
1111
trap switch_back_to_original_context EXIT
1212
switch_to_local_context
1313

14-
refresh_image_pull_secret otel-demo-ns
14+
refresh_image_pull_secret otel-demo
1515

1616
./teardown.sh no-context-switch
1717

1818
sleep 5
1919

20-
yq \
21-
". *= load(\"$dash0_configuration_dir/demo/environments/aws/demo-eu-west-1-demo.yaml\")" \
22-
$dash0_configuration_dir/demo/values.yaml | \
23-
yq --from-file dash0-one-ns.yq > \
24-
dash0-values.yaml
20+
./create-values-yaml.sh $dash0_configuration_dir
2521

26-
helm install --namespace otel-demo-ns --create-namespace opentelemetry-demo-postgresql oci://registry-1.docker.io/bitnamicharts/postgresql --values postgres-values.yaml
22+
helm install --namespace otel-demo --create-namespace opentelemetry-demo-postgresql oci://registry-1.docker.io/bitnamicharts/postgresql --values postgres-values.yaml
2723
helm install \
28-
--namespace otel-demo-ns \
24+
--namespace otel-demo \
2925
--create-namespace \
3026
opentelemetry-demo \
3127
open-telemetry/opentelemetry-demo \
32-
--values dash0-values.yaml
33-
kubectl apply --namespace otel-demo-ns -f postgres-service.yaml
28+
--values dash0-otel-demo-local-k8s-values.yaml
29+
kubectl apply --namespace otel-demo -f postgres-service.yaml
3430

35-
kubectl cp ../../src/ffspostgres/init-scripts/10-ffs_schema.sql --namespace otel-demo-ns opentelemetry-demo-postgresql-0:/tmp/
36-
kubectl cp ../../src/ffspostgres/init-scripts/20-ffs_data.sql --namespace otel-demo-ns opentelemetry-demo-postgresql-0:/tmp/
37-
kubectl exec --namespace otel-demo-ns opentelemetry-demo-postgresql-0 -- psql postgresql://ffs:ffs@localhost/ffs -a -f /tmp/10-ffs_schema.sql
38-
kubectl exec --namespace otel-demo-ns opentelemetry-demo-postgresql-0 -- psql postgresql://ffs:ffs@localhost/ffs -a -f /tmp/20-ffs_data.sql
31+
kubectl cp ../../src/ffspostgres/init-scripts/10-ffs_schema.sql --namespace otel-demo opentelemetry-demo-postgresql-0:/tmp/
32+
kubectl cp ../../src/ffspostgres/init-scripts/20-ffs_data.sql --namespace otel-demo opentelemetry-demo-postgresql-0:/tmp/
33+
kubectl exec --namespace otel-demo opentelemetry-demo-postgresql-0 -- psql postgresql://ffs:ffs@localhost/ffs -a -f /tmp/10-ffs_schema.sql
34+
kubectl exec --namespace otel-demo opentelemetry-demo-postgresql-0 -- psql postgresql://ffs:ffs@localhost/ffs -a -f /tmp/20-ffs_data.sql
3935

4036
echo waiting for the frontend and frontendproxy pod to become ready
4137
sleep 5
42-
kubectl wait --namespace otel-demo-ns --for=condition=ready pod -l app.kubernetes.io/component=frontendproxy --timeout 10s
43-
kubectl wait --namespace otel-demo-ns --for=condition=ready pod -l app.kubernetes.io/component=frontend --timeout 20s
38+
kubectl wait --namespace otel-demo --for=condition=ready pod -l app.kubernetes.io/component=frontendproxy --timeout 10s
39+
kubectl wait --namespace otel-demo --for=condition=ready pod -l app.kubernetes.io/component=frontend --timeout 20s
4440
./port-forward.sh
4541

kubernetes/local/ns1.yq

-32
This file was deleted.

kubernetes/local/ns2.yq

-36
This file was deleted.

kubernetes/local/port-forward-two-ns.sh

-6
This file was deleted.

kubernetes/local/port-forward.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
set -euo pipefail
44

5-
kubectl port-forward --namespace otel-demo-ns service/opentelemetry-demo-frontendproxy 8080:8080
5+
kubectl port-forward --namespace otel-demo service/opentelemetry-demo-frontendproxy 8080:8080
66

kubernetes/local/postgres-service-two-namespaces.yaml

-15
This file was deleted.

kubernetes/local/teardown.sh

+3-11
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,7 @@ if [[ ${1:-} != "no-context-switch" ]]; then
1414
fi
1515

1616
# tear down things installed by deploy.sh
17-
helm uninstall --namespace otel-demo-ns --ignore-not-found opentelemetry-demo-postgresql
18-
helm uninstall --namespace otel-demo-ns --ignore-not-found opentelemetry-demo
19-
kubectl delete --namespace otel-demo-ns --ignore-not-found -f postgres-service.yaml
20-
kubectl delete --namespace otel-demo-ns --ignore-not-found -f postgres-service-two-namespaces.yaml
21-
22-
# tear down things installed by deploy-two-namespaces.sh
23-
helm uninstall --namespace otel-demo-ns1 --ignore-not-found opentelemetry-demo-ns1
24-
helm uninstall --namespace otel-demo-ns2 --ignore-not-found opentelemetry-demo-ns2
25-
helm uninstall --namespace otel-demo-ns1 --ignore-not-found opentelemetry-demo-postgresql
26-
kubectl delete --namespace otel-demo-ns1 --ignore-not-found -f postgres-service.yaml
27-
kubectl delete --ignore-not-found -f cross-namespace-service-names.yaml
17+
helm uninstall --namespace otel-demo --ignore-not-found opentelemetry-demo-postgresql
18+
helm uninstall --namespace otel-demo --ignore-not-found opentelemetry-demo
19+
kubectl delete --namespace otel-demo --ignore-not-found -f postgres-service.yaml
2820

0 commit comments

Comments
 (0)