Skip to content

Commit

Permalink
Add Demo
Browse files Browse the repository at this point in the history
  • Loading branch information
mackjmr committed Nov 27, 2023
1 parent 4abbfd2 commit 6723374
Show file tree
Hide file tree
Showing 20 changed files with 1,078 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,18 @@ build-ci-image-orderproducer:
DOCKERFILE: src/orderproducerservice/Dockerfile
IMAGE_TAG_SUFFIX: orderproducer
CONTEXT: .
build-ci-image-goserverdd:
!!merge <<: *build-ci-image
variables:
DOCKERFILE: src/go_server_dd/Dockerfile
IMAGE_TAG_SUFFIX: go-server-dd
CONTEXT: .
build-ci-image-javaclientotel:
!!merge <<: *build-ci-image
variables:
DOCKERFILE: src/java_client_otel/Dockerfile
IMAGE_TAG_SUFFIX: java-client-otel
CONTEXT: .
.prod-deploy: &prod-deploy
stage: prod-deploy
tags: ["runner:docker", "size:large"]
Expand Down Expand Up @@ -204,6 +216,13 @@ prod-deploy-otel-ingest-agent-eks:
# - aws sts get-caller-identity
- bash $SCRIPT

staging-deploy-otel-demo-eks-reinvent:
!!merge <<: *staging-deploy
variables:
SCRIPT: ./ci/scripts/ci-deploy-reinvent.sh
CLUSTER_NAME: dd-otel
CLUSTER_ARN: "arn:aws:eks:us-east-1:601427279990:cluster/dd-otel"
REGION: us-east-1
# Demo env:otel-staging
staging-deploy-otel-demo-eks:
!!merge <<: *staging-deploy
Expand Down
3 changes: 3 additions & 0 deletions ci/datadog-agent-values-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ agents:
nodeSelector:
alpha.eksctl.io/nodegroup-name: ng-4
datadog:
logs:
enabled: true
containerCollectAll: true
tags:
- "env:otel-ingest-staging"
34 changes: 34 additions & 0 deletions ci/scripts/ci-deploy-reinvent.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash

# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

# This script is used to deploy collector on demo account cluster

set -euo pipefail
IFS=$'\n\t'
set -x

clusterName=$CLUSTER_NAME
clusterArn=$CLUSTER_ARN
region=$REGION

install_reinvent_demos() {
# Set the namespace and release name
release_name="opentelemetry-demo"

# Deploy zookeeper which is not a default component.
sed -i "s/PLACEHOLDER_COMMIT_SHA/v$CI_COMMIT_SHORT_SHA/g" ./src/go_server_dd/deployment-staging.yaml
kubectl apply -f ./src/go_server_dd/deployment-staging.yaml -n otel-ingest-staging

# Deploy java order producer which is not a default component.
sed -i "s/PLACEHOLDER_COMMIT_SHA/v$CI_COMMIT_SHORT_SHA/g" ./src/java_client_otel/deployment-staging.yaml
kubectl apply -f ./src/java_client_otel/deployment-staging.yaml -n otel-staging
}

###########################################################################################################

aws eks --region "${region}" update-kubeconfig --name "${clusterName}"
kubectl config use-context "${clusterArn}"

install_reinvent_demos
14 changes: 14 additions & 0 deletions src/go_server_dd/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Unless explicitly stated otherwise all files in this repository are licensed
# under the Apache 2.0 License.
#
FROM golang:1.21

WORKDIR /app
COPY ./src/go_server_dd go_server_dd/

WORKDIR /app/go_server_dd
RUN go mod download

RUN go build -o /go_server_dd

CMD [ "/go_server_dd" ]
80 changes: 80 additions & 0 deletions src/go_server_dd/deployment-staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: opentelemetry-demo-go-server-dd
labels:
app.kubernetes.io/component: go-server-dd
app.kubernetes.io/instance: opentelemetry-demo
app.kubernetes.io/name: opentelemetry-demo-go-server-dd
app.kubernetes.io/part-of: opentelemetry-demo
app.kubernetes.io/version: "1.4.0"
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app.kubernetes.io/name: opentelemetry-demo-go-server-dd
template:
metadata:
labels:
app.kubernetes.io/component: go-server-dd
app.kubernetes.io/instance: opentelemetry-demo
app.kubernetes.io/name: opentelemetry-demo-go-server-dd
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: alpha.eksctl.io/nodegroup-name
operator: In
values:
- ng-4
containers:
- name: go-server-dd
image: 601427279990.dkr.ecr.us-east-1.amazonaws.com/otel-demo:PLACEHOLDER_COMMIT_SHA-go-server-dd
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8082
name: ddgoserverport
protocol: TCP
env:
- name: DD_SERVICE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: "metadata.labels['app.kubernetes.io/component']"
- name: DD_ENV
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: DD_TRACE_AGENT_URL
value: unix:///var/run/datadog/apm.socket
volumeMounts:
- name: apmsocketpath
mountPath: /var/run/datadog
resources:
limits:
memory: 1Gi
securityContext:
runAsGroup: 1000
runAsNonRoot: true
runAsUser: 1000
volumes:
- hostPath:
path: /var/run/datadog/
name: apmsocketpath
---
apiVersion: v1
kind: Service
metadata:
name: opentelemetry-demo-go-server-dd
spec:
selector:
app.kubernetes.io/name: opentelemetry-demo-go-server-dd
ports:
- name: go-server-dd
port: 8082
protocol: TCP
targetPort: 8082
44 changes: 44 additions & 0 deletions src/go_server_dd/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
module go_server_dd

go 1.21.4

require (
github.com/sirupsen/logrus v1.9.3
go.opentelemetry.io/otel v1.20.0
gopkg.in/DataDog/dd-trace-go.v1 v1.58.0
)

require (
github.com/DataDog/appsec-internal-go v1.0.2 // indirect
github.com/DataDog/datadog-agent/pkg/obfuscate v0.48.0 // indirect
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.48.1 // indirect
github.com/DataDog/datadog-go/v5 v5.3.0 // indirect
github.com/DataDog/go-libddwaf/v2 v2.1.0 // indirect
github.com/DataDog/go-tuf v1.0.2-0.5.2 // indirect
github.com/DataDog/sketches-go v1.4.2 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/ebitengine/purego v0.5.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/outcaste-io/ristretto v0.2.3 // indirect
github.com/philhofer/fwd v1.1.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/secure-systems-lab/go-securesystemslib v0.7.0 // indirect
github.com/tinylib/msgp v1.1.8 // indirect
go.opentelemetry.io/otel/metric v1.20.0 // indirect
go.opentelemetry.io/otel/trace v1.20.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go4.org/intern v0.0.0-20230525184215-6c62f75575cb // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20230525183740-e7c30c78aeb2 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/protobuf v1.30.0 // indirect
inet.af/netaddr v0.0.0-20230525184311-b8eac61e914a // indirect
)
Loading

0 comments on commit 6723374

Please sign in to comment.