Skip to content

Commit f38dab7

Browse files
authored
Merge pull request #159 from splunk/oteldemo
OpenTelemetry Astronomy Shop Demo
2 parents 3ac0a1e + 217b624 commit f38dab7

File tree

7 files changed

+32
-0
lines changed

7 files changed

+32
-0
lines changed

multipass/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ commands will detect it and remind you to do so if necessary.
5757
- `splunk_realm`: Observability Realm
5858
- `splunk_presetup`: Provide a preconfigured instance (OTel Collector and Online Boutique deployed with RUM enabled)
5959
- `splunk_jdk`: Install OpenJDK and Maven on the instance (for PetClinic workshop or other Java based workshops)
60+
- `otel_demo` : Install and configure the OpenTelemetry Telescope Shop Demo. This requires that `splunk_presetup` is set to FALSE. The default is FALSE
6061

6162
## 6. Create Terraform variables file
6263

@@ -76,6 +77,7 @@ splunk_rum_token = "1234xxxx5678yyyy"
7677
splunk_realm = "us1"
7778
splunk_presetup = true
7879
splunk_jdk = false
80+
otel_demo = false
7981
```
8082

8183
Then run `terraform plan` to see what will be created. Once happy run `terraform apply` to create the instances.

multipass/terraform.tfvars.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ splunk_realm = ""
66
# Optional
77
splunk_presetup = false
88
splunk_jdk = false
9+
otel_demo = false

workshop/aws/ec2/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ The following variables are available. Edit `terraform.tfvars` to reflect what y
5454

5555
- `splunk_presetup`: Provide a preconfigured instance (OTel Collector and Online Boutique deployed with RUM enabled). The default is FALSE.
5656
- `splunk_jdk`: Install OpenJDK and Maven on the instance. The default is FALSE.
57+
- `otel_demo` : Install and configure the OpenTelemetry Astronomy Shop Demo. This requires that `splunk_presetup` is set to FALSE. The default is FALSE
5758

5859
## 6. Create a Terraform plan
5960

workshop/aws/ec2/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ locals {
183183
realm = var.splunk_realm
184184
presetup = var.splunk_presetup
185185
jdk = var.splunk_jdk
186+
otel_demo = var.otel_demo
186187
instance_password = random_string.password.result
187188
}
188189
}
@@ -219,5 +220,10 @@ resource "aws_instance" "observability-instance" {
219220
condition = var.splunk_presetup ? try(var.splunk_access_token, "") != "" && try(var.splunk_realm, "") != "" && try(var.splunk_rum_token, "") != "" : true
220221
error_message = "When requesting a pre-setup instance, splunk_realm, splunk_access_token and splunk_rum_token are required and cannot be null/empty"
221222
}
223+
precondition {
224+
# if otel_demo=true, tokens and realm cannot be empty. also presetup cannot also be true.
225+
condition = var.otel_demo ? try(var.splunk_access_token, "") != "" && try(var.splunk_realm, "") != "" && try(var.splunk_rum_token, "") != "" && try(var.splunk_presetup, "") == false : true
226+
error_message = "When requesting an otel_demo, splunk_realm, splunk_access_token and splunk_rum_token are required and cannot be null/empty. splunk_presetup variable must also be set to false. "
227+
}
222228
}
223229
}

workshop/aws/ec2/templates/userdata.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,21 @@ write_files:
8585
fi
8686
%{ endif ~}
8787

88+
%{ if otel_demo == true ~}
89+
export RUM_TOKEN=${rum_token}
90+
mkdir otel-demo && cd otel-demo
91+
curl -s -OL https://raw.githubusercontent.com/splunk/observability-workshop/main/oteldemo/otel-demo-collector.yaml
92+
curl -s -OL https://raw.githubusercontent.com/splunk/observability-workshop/main/oteldemo/otel-demo.yaml
93+
if [ ! -f ~/.helmok ]; then
94+
helm repo add splunk-otel-collector-chart https://signalfx.github.io/splunk-otel-collector-chart
95+
helm repo update
96+
helm install splunk-otel-collector --set="splunkObservability.realm=$REALM" --set="splunkObservability.accessToken=$ACCESS_TOKEN" --set="clusterName=$(hostname)-k3s-cluster" --set="splunkObservability.logsEnabled=true" --set="logsEngine=otel" --set="splunkObservability.profilingEnabled=true" --set="splunkObservability.infrastructureMonitoringEventsEnabled=true" --set="networkExplorer.enabled=true" --set="networkExplorer.podSecurityPolicy.enabled=false" --set="agent.enabled=true" --set="gateway.replicaCount=1" --set="gateway.resources.limits.cpu=500m" --set="gateway.resources.limits.memory=1Gi" --set="clusterReceiver.enabled=true" --set="environment=$(hostname)-apm-env" splunk-otel-collector-chart/splunk-otel-collector -f otel-demo-collector.yaml
97+
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
98+
helm install my-otel-demo open-telemetry/opentelemetry-demo --values otel-demo.yaml
99+
cd /home/ubuntu
100+
fi
101+
%{ endif ~}
102+
88103
export KUBECONFIG=/home/ubuntu/.kube/config
89104
alias kc='kubectl'
90105
alias dc='docker-compose'

workshop/aws/ec2/terraform.tfvars.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ splunk_realm = ""
1111
# optional
1212
splunk_presetup = false
1313
splunk_jdk = false
14+
otel_demo = false

workshop/aws/ec2/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ variable "splunk_jdk" {
1616
default = false
1717
}
1818

19+
variable "otel_demo" {
20+
description = "Spin up the OpenTelemetry Astronomy Shop Demo? (true/false)"
21+
type = bool
22+
default = false
23+
}
24+
1925
variable "aws_instance_count" {
2026
description = "Instance Count (Usually 1)"
2127
nullable = false

0 commit comments

Comments
 (0)