Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-lozoya committed Apr 10, 2024
2 parents ecbcbce + 16d7ab7 commit e1b4c24
Show file tree
Hide file tree
Showing 8 changed files with 450 additions and 0 deletions.
53 changes: 53 additions & 0 deletions demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Setup

## Pre-requisites

- [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl)
- [Helm](https://helm.sh/)
- [Minikube](https://minikube.sigs.k8s.io/docs/start/) (or cluster of your choice)

## Create Namespaces
```
kubectl create ns newrelic
kubectl create ns ao-demo
```

## Install Cert Manager
```
helm repo add jetstack https://charts.jetstack.io --force-update
helm install \
cert-manager jetstack/cert-manager \
--namespace cert-manager \
--create-namespace \
--version v1.11.0 \
--set installCRDs=true
```

## Clone the repo

```
git clone https://github.com/newrelic-experimental/newrelic-agent-operator && cd newrelic-agent-operator
```

## Install `newrelic-agent-operator`
```
helm upgrade --install newrelic-agent-operator ./chart/ --set licenseKey='xxxxxxxxxxxxxxxx' -n newrelic
```

## Create custom resource

```
kubectl apply -f ./demo/customresource.yaml -n ao-demo
```

## Create license key for demo apps
```
kubectl create secret generic newrelic-key-secret -n ao-demo --from-literal=new_relic_license_key=xxxxxxxxxxxxxxxx
```

## Deploy demo apps and loadgen

```
kubectl apply -f ./demo/apps/. -n ao-demo
kubectl apply -f ./demo/loadgen/locust.yaml -n ao-demo
```
37 changes: 37 additions & 0 deletions demo/apps/dotnet_deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: aspnetapp
spec:
selector:
matchLabels:
app: aspnetapp
replicas: 1
template:
metadata:
labels:
app: aspnetapp
annotations:
instrumentation.newrelic.com/inject-dotnet: "true"
spec:
containers:
- name: aspnetapp
image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-dotnet:main # source code of the application: https://github.com/dotnet/dotnet-docker/tree/main/samples/aspnetapp
env:
- name: ASPNETCORE_URLS
value: 'http://+:8080'
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: dotnet-service
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8080
selector:
app: aspnetapp
34 changes: 34 additions & 0 deletions demo/apps/java_deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: springboot-java
spec:
selector:
matchLabels:
app: springboot-java
replicas: 1
template:
metadata:
labels:
app: springboot-java
annotations:
instrumentation.newrelic.com/inject-java: "true"
spec:
containers:
- name: springboot-java
image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-java:main
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: springboot-java-service
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8080
selector:
app: springboot-java
38 changes: 38 additions & 0 deletions demo/apps/nodejs_deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: express-hello-world
spec:
selector:
matchLabels:
app: express-hello-world
replicas: 1
template:
metadata:
labels:
app: express-hello-world
annotations:
instrumentation.newrelic.com/inject-nodejs: "true"
spec:
containers:
- name: express-hello-world
image: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-nodejs:main
ports:
- containerPort: 3000
env:
- name: NODE_PATH
value: /usr/local/lib/node_modules
---
apiVersion: v1
kind: Service
metadata:
name: express-hello-world-service
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 3000
selector:
app: express-hello-world

149 changes: 149 additions & 0 deletions demo/apps/php_deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-leader
labels:
app: redis
role: leader
tier: backend
spec:
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
role: leader
tier: backend
spec:
containers:
- name: leader
image: "docker.io/redis:6.0.5"
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379
---
# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook
apiVersion: v1
kind: Service
metadata:
name: redis-leader
labels:
app: redis
role: leader
tier: backend
spec:
ports:
- port: 6379
targetPort: 6379
selector:
app: redis
role: leader
tier: backend
# ---
# # SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook
# apiVersion: apps/v1
# kind: Deployment
# metadata:
# name: redis-follower
# labels:
# app: redis
# role: follower
# tier: backend
# spec:
# replicas: 2
# selector:
# matchLabels:
# app: redis
# template:
# metadata:
# labels:
# app: redis
# role: follower
# tier: backend
# spec:
# containers:
# - name: follower
# image: us-docker.pkg.dev/google-samples/containers/gke/gb-redis-follower:v2
# resources:
# requests:
# cpu: 100m
# memory: 100Mi
# ports:
# - containerPort: 6379
# ---
# # SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook
# apiVersion: v1
# kind: Service
# metadata:
# name: redis-follower
# labels:
# app: redis
# role: follower
# tier: backend
# spec:
# ports:
# # the port that this service should serve on
# - port: 6379
# selector:
# app: redis
# role: follower
# tier: backend
---
# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook
apiVersion: apps/v1
kind: Deployment
metadata:
name: php-frontend
spec:
replicas: 1
selector:
matchLabels:
app: guestbook
tier: frontend
template:
metadata:
labels:
app: guestbook
tier: frontend
annotations:
instrumentation.newrelic.com/inject-php: "true"
spec:
containers:
- name: php-redis
image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5
env:
- name: GET_HOSTS_FROM
value: "dns"
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 80
---
# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook
apiVersion: v1
kind: Service
metadata:
name: php-frontend-service
labels:
app: guestbook
tier: frontend
spec:
# if your cluster supports it, uncomment the following to automatically create
# an external load-balanced IP for the frontend service.
# type: LoadBalancer
#type: LoadBalancer
ports:
# the port that this service should serve on
- port: 80
selector:
app: guestbook
tier: frontend
34 changes: 34 additions & 0 deletions demo/apps/python_deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: flask-hello-world
spec:
selector:
matchLabels:
app: flask-hello-world
replicas: 1
template:
metadata:
labels:
app: flask-hello-world
annotations:
instrumentation.newrelic.com/inject-python: "true"
spec:
containers:
- name: flask-hello-world
image: ghcr.io/anuraaga/flask-hello-world:latest
ports:
- containerPort: 5000
---
apiVersion: v1
kind: Service
metadata:
name: flask-hello-world-service
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 5000
selector:
app: flask-hello-world
35 changes: 35 additions & 0 deletions demo/customresource.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
apiVersion: newrelic.com/v1alpha1
kind: Instrumentation
metadata:
labels:
app.kubernetes.io/name: instrumentation
app.kubernetes.io/created-by: newrelic-agent-operator
name: newrelic-instrumentation
spec:
# # A required but separate opentelemetry collector is required for go autoinstrumentation set to 4318.
# exporter:
# endpoint: http://opentelemetry-collector.ao-demo:4318
# propagators:
# - tracecontext
# sampler:
# type: always_on
# resource:
# resourceAttributes:
# cluster.name: "your-cluster-name"
# ### End OTel config ###
java:
image: ghcr.io/newrelic-experimental/newrelic-agent-operator/instrumentation-java:8.0.1
env:
- name: NEW_RELIC_APPLICATION_LOGGING_FORWARDING_ENABLED
value: "false"
nodejs:
image: ghcr.io/newrelic-experimental/newrelic-agent-operator/instrumentation-nodejs:latest
python:
image: ghcr.io/newrelic-experimental/newrelic-agent-operator/instrumentation-python:8.8.0
dotnet:
image: ghcr.io/newrelic-experimental/newrelic-agent-operator/instrumentation-dotnet:10.13.0
# php:
# image: ghcr.io/newrelic-experimental/newrelic-agent-operator/instrumentation-php:latest
# go:
# image: ghcr.io/open-telemetry/opentelemetry-go-instrumentation/autoinstrumentation-go:latest
Loading

0 comments on commit e1b4c24

Please sign in to comment.