From da85be1d0ae61a77e4f4e7798414369a4e25bb6d Mon Sep 17 00:00:00 2001
From: Adnan Rahic <ado.raha198@gmail.com>
Date: Mon, 26 Aug 2024 19:10:43 +0200
Subject: [PATCH 01/11] k8s: added basic manifest files

---
 docker-compose-kompose.yaml           | 153 ++++++++++++++++++++++++++
 k8s/api-deployment.yaml               |  50 +++++++++
 k8s/api-service.yaml                  |  16 +++
 k8s/cache-deployment.yaml             |  37 +++++++
 k8s/cache-service.yaml                |  16 +++
 k8s/db-deployment.yaml                |  50 +++++++++
 k8s/db-persistent-volume-claim.yaml   |  13 +++
 k8s/db-persistent-volume.yaml         |  15 +++
 k8s/db-service.yaml                   |  16 +++
 k8s/jaeger-deployment.yaml            |  47 ++++++++
 k8s/jaeger-service.yaml               |  22 ++++
 k8s/otel-collector-cm0-configmap.yaml |  45 ++++++++
 k8s/otel-collector-deployment.yaml    |  55 +++++++++
 k8s/otel-collector-service.yaml       |  25 +++++
 k8s/queue-deployment.yaml             |  38 +++++++
 k8s/queue-service.yaml                |  19 ++++
 k8s/rpc-deployment.yaml               |  52 +++++++++
 k8s/rpc-service.yaml                  |  16 +++
 k8s/worker-deployment.yaml            |  40 +++++++
 19 files changed, 725 insertions(+)
 create mode 100644 docker-compose-kompose.yaml
 create mode 100644 k8s/api-deployment.yaml
 create mode 100644 k8s/api-service.yaml
 create mode 100644 k8s/cache-deployment.yaml
 create mode 100644 k8s/cache-service.yaml
 create mode 100644 k8s/db-deployment.yaml
 create mode 100644 k8s/db-persistent-volume-claim.yaml
 create mode 100644 k8s/db-persistent-volume.yaml
 create mode 100644 k8s/db-service.yaml
 create mode 100644 k8s/jaeger-deployment.yaml
 create mode 100644 k8s/jaeger-service.yaml
 create mode 100644 k8s/otel-collector-cm0-configmap.yaml
 create mode 100644 k8s/otel-collector-deployment.yaml
 create mode 100644 k8s/otel-collector-service.yaml
 create mode 100644 k8s/queue-deployment.yaml
 create mode 100644 k8s/queue-service.yaml
 create mode 100644 k8s/rpc-deployment.yaml
 create mode 100644 k8s/rpc-service.yaml
 create mode 100644 k8s/worker-deployment.yaml

diff --git a/docker-compose-kompose.yaml b/docker-compose-kompose.yaml
new file mode 100644
index 0000000..ef5bd57
--- /dev/null
+++ b/docker-compose-kompose.yaml
@@ -0,0 +1,153 @@
+version: '3.5'
+name: pokeshop
+
+services:
+  db:
+    image: postgres:14
+    ports:
+      - 5434:5432
+    environment:
+      POSTGRES_USER: ashketchum
+      POSTGRES_PASSWORD: squirtle123
+      POSTGRES_DB: pokeshop
+    healthcheck:
+      test: ['CMD-SHELL', 'pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB']
+      interval: 1s
+      timeout: 5s
+      retries: 60
+
+  cache:
+    image: redis:6
+    ports:
+      - 6379:6379
+    healthcheck:
+      test: ['CMD', 'redis-cli', 'ping']
+      interval: 1s
+      timeout: 3s
+      retries: 60
+
+  queue:
+    image: rabbitmq:3.12
+    restart: unless-stopped
+    ports:
+      - 5672:5672
+      - 15672:15672
+    healthcheck:
+      test: rabbitmq-diagnostics -q check_running
+      interval: 1s
+      timeout: 5s
+      retries: 60
+
+  jaeger:
+    image: jaegertracing/all-in-one:latest
+    ports:
+      - 14250:14250
+      - 16685:16685
+      - 16686:16686
+    environment:
+      - COLLECTOR_ZIPKIN_HOST_PORT=:9411
+      - COLLECTOR_OTLP_ENABLED=true
+    healthcheck:
+      test: ['CMD', 'wget', '--spider', 'localhost:16686']
+      interval: 1s
+      timeout: 3s
+      retries: 60
+
+  otel-collector:
+    image: otel/opentelemetry-collector-contrib:0.59.0
+    restart: unless-stopped
+    extra_hosts:
+      - 'host.docker.internal:host-gateway'
+    ports:
+      - 55679:55679
+      - 8888:8888
+      - 4317:4317
+      - 4318:4318
+    command:
+      - '--config'
+      - '/otel-local-config.yaml'
+    volumes:
+      - ./collector.config.yaml:/otel-local-config.yaml
+    environment:
+      - JAEGER_ENDPOINT=jaeger:14250
+    depends_on:
+      jaeger:
+        condition: service_healthy
+
+  api:
+    build: .
+    environment:
+      REDIS_URL: cache
+      DATABASE_URL: postgresql://ashketchum:squirtle123@db:5432/pokeshop?schema=public
+      RABBITMQ_HOST: queue
+      POKE_API_BASE_URL: https://pokeapi.co/api/v2
+      COLLECTOR_ENDPOINT: http://otel-collector:4317
+      ZIPKIN_URL: http://localhost:9411
+    healthcheck:
+      test: ['CMD', 'wget', '--spider', 'localhost:8081/pokemon/healthcheck']
+      interval: 1s
+      timeout: 3s
+      retries: 60
+    ports:
+      - 8081:8081
+    depends_on:
+      db:
+        condition: service_healthy
+      cache:
+        condition: service_healthy
+      queue:
+        condition: service_healthy
+      jaeger:
+        condition: service_healthy
+      otel-collector:
+        condition: service_started
+  rpc:
+    build: .
+    environment:
+      REDIS_URL: cache
+      DATABASE_URL: postgresql://ashketchum:squirtle123@db:5432/pokeshop?schema=public
+      RABBITMQ_HOST: queue
+      POKE_API_BASE_URL: https://pokeapi.co/api/v2
+      COLLECTOR_ENDPOINT: http://otel-collector:4317
+      ZIPKIN_URL: http://localhost:9411
+      NPM_RUN_COMMAND: rpc
+    healthcheck:
+      test: ['CMD', 'wget', '--spider', 'localhost:8081/pokemon/healthcheck']
+      interval: 1s
+      timeout: 3s
+      retries: 60
+    ports:
+      - 8082:8082
+    depends_on:
+      db:
+        condition: service_healthy
+      cache:
+        condition: service_healthy
+      queue:
+        condition: service_healthy
+      jaeger:
+        condition: service_healthy
+      otel-collector:
+        condition: service_started
+
+  worker:
+    build: .
+    environment:
+      REDIS_URL: cache
+      DATABASE_URL: postgresql://ashketchum:squirtle123@db:5432/pokeshop?schema=public
+      RABBITMQ_HOST: queue
+      POKE_API_BASE_URL: https://pokeapi.co/api/v2
+      COLLECTOR_ENDPOINT: http://otel-collector:4317
+      ZIPKIN_URL: http://localhost:9411
+      NPM_RUN_COMMAND: worker
+    depends_on:
+      db:
+        condition: service_healthy
+      cache:
+        condition: service_healthy
+      queue:
+        condition: service_healthy
+      jaeger:
+        condition: service_healthy
+      otel-collector:
+        condition: service_started
diff --git a/k8s/api-deployment.yaml b/k8s/api-deployment.yaml
new file mode 100644
index 0000000..ed5460d
--- /dev/null
+++ b/k8s/api-deployment.yaml
@@ -0,0 +1,50 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  annotations:
+    kompose.cmd: kompose convert -f docker-compose.yaml
+    kompose.version: 1.34.0 (HEAD)
+  labels:
+    io.kompose.service: api
+  name: api
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      io.kompose.service: api
+  template:
+    metadata:
+      annotations:
+        kompose.cmd: kompose convert -f docker-compose.yaml
+        kompose.version: 1.34.0 (HEAD)
+      labels:
+        io.kompose.service: api
+    spec:
+      containers:
+        - env:
+            - name: COLLECTOR_ENDPOINT
+              value: http://otel-collector.default.svc.cluster.local:4317
+            - name: DATABASE_URL
+              value: postgresql://ashketchum:squirtle123@db:5432/pokeshop?schema=public
+            - name: POKE_API_BASE_URL
+              value: https://pokeapi.co/api/v2
+            - name: RABBITMQ_HOST
+              value: guest:guest@queue
+            - name: REDIS_URL
+              value: cache
+          image: kubeshop/demo-pokemon-api:latest
+          imagePullPolicy: Always
+          livenessProbe:
+            exec:
+              command:
+                - wget
+                - --spider
+                - localhost:8081/pokemon/healthcheck
+            failureThreshold: 60
+            periodSeconds: 1
+            timeoutSeconds: 3
+          name: api
+          ports:
+            - containerPort: 8081
+              protocol: TCP
+      restartPolicy: Always
diff --git a/k8s/api-service.yaml b/k8s/api-service.yaml
new file mode 100644
index 0000000..140ab3b
--- /dev/null
+++ b/k8s/api-service.yaml
@@ -0,0 +1,16 @@
+apiVersion: v1
+kind: Service
+metadata:
+  annotations:
+    kompose.cmd: kompose convert -f docker-compose.yaml
+    kompose.version: 1.34.0 (HEAD)
+  labels:
+    io.kompose.service: api
+  name: api
+spec:
+  ports:
+    - name: "8081"
+      port: 8081
+      targetPort: 8081
+  selector:
+    io.kompose.service: api
diff --git a/k8s/cache-deployment.yaml b/k8s/cache-deployment.yaml
new file mode 100644
index 0000000..1712362
--- /dev/null
+++ b/k8s/cache-deployment.yaml
@@ -0,0 +1,37 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  annotations:
+    kompose.cmd: kompose convert -f docker-compose.yaml
+    kompose.version: 1.34.0 (HEAD)
+  labels:
+    io.kompose.service: cache
+  name: cache
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      io.kompose.service: cache
+  template:
+    metadata:
+      annotations:
+        kompose.cmd: kompose convert -f docker-compose.yaml
+        kompose.version: 1.34.0 (HEAD)
+      labels:
+        io.kompose.service: cache
+    spec:
+      containers:
+        - image: redis:6
+          livenessProbe:
+            exec:
+              command:
+                - redis-cli
+                - ping
+            failureThreshold: 60
+            periodSeconds: 1
+            timeoutSeconds: 3
+          name: cache
+          ports:
+            - containerPort: 6379
+              protocol: TCP
+      restartPolicy: Always
diff --git a/k8s/cache-service.yaml b/k8s/cache-service.yaml
new file mode 100644
index 0000000..997aff6
--- /dev/null
+++ b/k8s/cache-service.yaml
@@ -0,0 +1,16 @@
+apiVersion: v1
+kind: Service
+metadata:
+  annotations:
+    kompose.cmd: kompose convert -f docker-compose.yaml
+    kompose.version: 1.34.0 (HEAD)
+  labels:
+    io.kompose.service: cache
+  name: cache
+spec:
+  ports:
+    - name: "6379"
+      port: 6379
+      targetPort: 6379
+  selector:
+    io.kompose.service: cache
diff --git a/k8s/db-deployment.yaml b/k8s/db-deployment.yaml
new file mode 100644
index 0000000..40b4bad
--- /dev/null
+++ b/k8s/db-deployment.yaml
@@ -0,0 +1,50 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  annotations:
+    kompose.cmd: kompose convert -f docker-compose.yaml
+    kompose.version: 1.34.0 (HEAD)
+  labels:
+    io.kompose.service: db
+  name: db
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      io.kompose.service: db
+  template:
+    metadata:
+      annotations:
+        kompose.cmd: kompose convert -f docker-compose.yaml
+        kompose.version: 1.34.0 (HEAD)
+      labels:
+        io.kompose.service: db
+    spec:
+      containers:
+        - env:
+            - name: POSTGRES_DB
+              value: pokeshop
+            - name: POSTGRES_PASSWORD
+              value: squirtle123
+            - name: POSTGRES_USER
+              value: ashketchum
+          image: postgres:14
+          livenessProbe:
+            exec:
+              command:
+                - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
+            failureThreshold: 60
+            periodSeconds: 1
+            timeoutSeconds: 5
+          name: db
+          ports:
+            - containerPort: 5432
+              protocol: TCP
+          volumeMounts:
+            - mountPath: /var/lib/postgresql/data
+              name: dbdata
+      volumes:
+        - name: dbdata
+          persistentVolumeClaim:
+            claimName: db-volume-claim
+      restartPolicy: Always
diff --git a/k8s/db-persistent-volume-claim.yaml b/k8s/db-persistent-volume-claim.yaml
new file mode 100644
index 0000000..3eac9d6
--- /dev/null
+++ b/k8s/db-persistent-volume-claim.yaml
@@ -0,0 +1,13 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  name: db-volume-claim
+  labels:
+    io.kompose.service: db
+spec:
+  storageClassName: manual
+  accessModes:
+    - ReadWriteMany
+  resources:
+    requests:
+      storage: 10Gi
diff --git a/k8s/db-persistent-volume.yaml b/k8s/db-persistent-volume.yaml
new file mode 100644
index 0000000..e02d217
--- /dev/null
+++ b/k8s/db-persistent-volume.yaml
@@ -0,0 +1,15 @@
+apiVersion: v1
+kind: PersistentVolume
+metadata:
+  name: db-volume
+  labels:
+    type: local
+    io.kompose.service: db
+spec:
+  storageClassName: manual
+  capacity:
+    storage: 10Gi
+  accessModes:
+    - ReadWriteMany
+  hostPath:
+    path: /data/postgresql
diff --git a/k8s/db-service.yaml b/k8s/db-service.yaml
new file mode 100644
index 0000000..9d5785a
--- /dev/null
+++ b/k8s/db-service.yaml
@@ -0,0 +1,16 @@
+apiVersion: v1
+kind: Service
+metadata:
+  annotations:
+    kompose.cmd: kompose convert -f docker-compose.yaml
+    kompose.version: 1.34.0 (HEAD)
+  labels:
+    io.kompose.service: db
+  name: db
+spec:
+  ports:
+    - name: "5434"
+      port: 5434
+      targetPort: 5432
+  selector:
+    io.kompose.service: db
diff --git a/k8s/jaeger-deployment.yaml b/k8s/jaeger-deployment.yaml
new file mode 100644
index 0000000..970616b
--- /dev/null
+++ b/k8s/jaeger-deployment.yaml
@@ -0,0 +1,47 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  annotations:
+    kompose.cmd: kompose convert -f docker-compose.yaml
+    kompose.version: 1.34.0 (HEAD)
+  labels:
+    io.kompose.service: jaeger
+  name: jaeger
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      io.kompose.service: jaeger
+  template:
+    metadata:
+      annotations:
+        kompose.cmd: kompose convert -f docker-compose.yaml
+        kompose.version: 1.34.0 (HEAD)
+      labels:
+        io.kompose.service: jaeger
+    spec:
+      containers:
+        - env:
+            - name: COLLECTOR_OTLP_ENABLED
+              value: "true"
+            - name: COLLECTOR_ZIPKIN_HOST_PORT
+              value: :9411
+          image: jaegertracing/all-in-one:latest
+          livenessProbe:
+            exec:
+              command:
+                - wget
+                - --spider
+                - localhost:16686
+            failureThreshold: 60
+            periodSeconds: 1
+            timeoutSeconds: 3
+          name: jaeger
+          ports:
+            - containerPort: 14250
+              protocol: TCP
+            - containerPort: 16685
+              protocol: TCP
+            - containerPort: 16686
+              protocol: TCP
+      restartPolicy: Always
diff --git a/k8s/jaeger-service.yaml b/k8s/jaeger-service.yaml
new file mode 100644
index 0000000..9e139f5
--- /dev/null
+++ b/k8s/jaeger-service.yaml
@@ -0,0 +1,22 @@
+apiVersion: v1
+kind: Service
+metadata:
+  annotations:
+    kompose.cmd: kompose convert -f docker-compose.yaml
+    kompose.version: 1.34.0 (HEAD)
+  labels:
+    io.kompose.service: jaeger
+  name: jaeger
+spec:
+  ports:
+    - name: "14250"
+      port: 14250
+      targetPort: 14250
+    - name: "16685"
+      port: 16685
+      targetPort: 16685
+    - name: "16686"
+      port: 16686
+      targetPort: 16686
+  selector:
+    io.kompose.service: jaeger
diff --git a/k8s/otel-collector-cm0-configmap.yaml b/k8s/otel-collector-cm0-configmap.yaml
new file mode 100644
index 0000000..2ebde60
--- /dev/null
+++ b/k8s/otel-collector-cm0-configmap.yaml
@@ -0,0 +1,45 @@
+apiVersion: v1
+data:
+  collector.config.yaml: |
+    receivers:
+      otlp:
+        protocols:
+          grpc:
+          http:
+            cors:
+              allowed_origins:
+                - "http://*"
+                - "https://*"
+
+    processors:
+      batch:
+
+    exporters:
+      logging:
+        loglevel: debug
+      jaeger:
+        endpoint: ${JAEGER_ENDPOINT}
+        tls:
+          insecure: true
+      otlp/trace:
+        endpoint: ${TRACETEST_AGENT_ENDPOINT}
+        tls:
+          insecure: true
+
+    service:
+      pipelines:
+        traces:
+          receivers: [otlp]
+          processors: []
+          exporters: [logging, jaeger]
+        traces/1:
+          receivers: [otlp]
+          processors: [batch]
+          exporters: [otlp/trace]
+kind: ConfigMap
+metadata:
+  annotations:
+    use-subpath: "true"
+  labels:
+    io.kompose.service: otel-collector
+  name: otel-collector-cm0
diff --git a/k8s/otel-collector-deployment.yaml b/k8s/otel-collector-deployment.yaml
new file mode 100644
index 0000000..c3ae11b
--- /dev/null
+++ b/k8s/otel-collector-deployment.yaml
@@ -0,0 +1,55 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  annotations:
+    kompose.cmd: kompose convert -f docker-compose.yaml
+    kompose.version: 1.34.0 (HEAD)
+  labels:
+    io.kompose.service: otel-collector
+  name: otel-collector
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      io.kompose.service: otel-collector
+  strategy:
+    type: Recreate
+  template:
+    metadata:
+      annotations:
+        kompose.cmd: kompose convert -f docker-compose.yaml
+        kompose.version: 1.34.0 (HEAD)
+      labels:
+        io.kompose.service: otel-collector
+    spec:
+      containers:
+        - args:
+            - --config
+            - /config/otel-local-config.yaml
+          env:
+            - name: JAEGER_ENDPOINT
+              value: jaeger.default.svc.cluster.local:14250
+            - name: TRACETEST_AGENT_ENDPOINT
+              value: tracetest-agent.default.svc.cluster.local:4317
+          image: otel/opentelemetry-collector-contrib:0.59.0
+          name: otel-collector
+          ports:
+            - containerPort: 55679
+              protocol: TCP
+            - containerPort: 8888
+              protocol: TCP
+            - containerPort: 4317
+              protocol: TCP
+            - containerPort: 4318
+              protocol: TCP
+          volumeMounts:
+            - mountPath: /config
+              name: otel-collector-cm0
+      restartPolicy: Always
+      volumes:
+        - configMap:
+            items:
+              - key: collector.config.yaml
+                path: otel-local-config.yaml
+            name: otel-collector-cm0
+          name: otel-collector-cm0
diff --git a/k8s/otel-collector-service.yaml b/k8s/otel-collector-service.yaml
new file mode 100644
index 0000000..4a0e098
--- /dev/null
+++ b/k8s/otel-collector-service.yaml
@@ -0,0 +1,25 @@
+apiVersion: v1
+kind: Service
+metadata:
+  annotations:
+    kompose.cmd: kompose convert -f docker-compose.yaml
+    kompose.version: 1.34.0 (HEAD)
+  labels:
+    io.kompose.service: otel-collector
+  name: otel-collector
+spec:
+  ports:
+    - name: "55679"
+      port: 55679
+      targetPort: 55679
+    - name: "8888"
+      port: 8888
+      targetPort: 8888
+    - name: "4317"
+      port: 4317
+      targetPort: 4317
+    - name: "4318"
+      port: 4318
+      targetPort: 4318
+  selector:
+    io.kompose.service: otel-collector
diff --git a/k8s/queue-deployment.yaml b/k8s/queue-deployment.yaml
new file mode 100644
index 0000000..338b958
--- /dev/null
+++ b/k8s/queue-deployment.yaml
@@ -0,0 +1,38 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  annotations:
+    kompose.cmd: kompose convert -f docker-compose.yaml
+    kompose.version: 1.34.0 (HEAD)
+  labels:
+    io.kompose.service: queue
+  name: queue
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      io.kompose.service: queue
+  template:
+    metadata:
+      annotations:
+        kompose.cmd: kompose convert -f docker-compose.yaml
+        kompose.version: 1.34.0 (HEAD)
+      labels:
+        io.kompose.service: queue
+    spec:
+      containers:
+        - image: rabbitmq:3.12
+          livenessProbe:
+            exec:
+              command:
+                - rabbitmq-diagnostics -q check_running
+            failureThreshold: 60
+            periodSeconds: 1
+            timeoutSeconds: 5
+          name: queue
+          ports:
+            - containerPort: 5672
+              protocol: TCP
+            - containerPort: 15672
+              protocol: TCP
+      restartPolicy: Always
diff --git a/k8s/queue-service.yaml b/k8s/queue-service.yaml
new file mode 100644
index 0000000..8e0f489
--- /dev/null
+++ b/k8s/queue-service.yaml
@@ -0,0 +1,19 @@
+apiVersion: v1
+kind: Service
+metadata:
+  annotations:
+    kompose.cmd: kompose convert -f docker-compose.yaml
+    kompose.version: 1.34.0 (HEAD)
+  labels:
+    io.kompose.service: queue
+  name: queue
+spec:
+  ports:
+    - name: "5672"
+      port: 5672
+      targetPort: 5672
+    - name: "15672"
+      port: 15672
+      targetPort: 15672
+  selector:
+    io.kompose.service: queue
diff --git a/k8s/rpc-deployment.yaml b/k8s/rpc-deployment.yaml
new file mode 100644
index 0000000..2a4ad22
--- /dev/null
+++ b/k8s/rpc-deployment.yaml
@@ -0,0 +1,52 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  annotations:
+    kompose.cmd: kompose convert -f docker-compose.yaml
+    kompose.version: 1.34.0 (HEAD)
+  labels:
+    io.kompose.service: rpc
+  name: rpc
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      io.kompose.service: rpc
+  template:
+    metadata:
+      annotations:
+        kompose.cmd: kompose convert -f docker-compose.yaml
+        kompose.version: 1.34.0 (HEAD)
+      labels:
+        io.kompose.service: rpc
+    spec:
+      containers:
+        - env:
+            - name: NPM_RUN_COMMAND
+              value: rpc
+            - name: COLLECTOR_ENDPOINT
+              value: http://otel-collector.default.svc.cluster.local:4317
+            - name: DATABASE_URL
+              value: postgresql://ashketchum:squirtle123@db:5432/pokeshop?schema=public
+            - name: POKE_API_BASE_URL
+              value: https://pokeapi.co/api/v2
+            - name: RABBITMQ_HOST
+              value: guest:guest@queue
+            - name: REDIS_URL
+              value: cache
+          image: kubeshop/demo-pokemon-api:latest
+          imagePullPolicy: Always
+          livenessProbe:
+            exec:
+              command:
+                - wget
+                - --spider
+                - localhost:8081/pokemon/healthcheck
+            failureThreshold: 60
+            periodSeconds: 1
+            timeoutSeconds: 3
+          name: rpc
+          ports:
+            - containerPort: 8082
+              protocol: TCP
+      restartPolicy: Always
diff --git a/k8s/rpc-service.yaml b/k8s/rpc-service.yaml
new file mode 100644
index 0000000..60e306b
--- /dev/null
+++ b/k8s/rpc-service.yaml
@@ -0,0 +1,16 @@
+apiVersion: v1
+kind: Service
+metadata:
+  annotations:
+    kompose.cmd: kompose convert -f docker-compose.yaml
+    kompose.version: 1.34.0 (HEAD)
+  labels:
+    io.kompose.service: rpc
+  name: rpc
+spec:
+  ports:
+    - name: "8082"
+      port: 8082
+      targetPort: 8082
+  selector:
+    io.kompose.service: rpc
diff --git a/k8s/worker-deployment.yaml b/k8s/worker-deployment.yaml
new file mode 100644
index 0000000..1902b4e
--- /dev/null
+++ b/k8s/worker-deployment.yaml
@@ -0,0 +1,40 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  annotations:
+    kompose.cmd: kompose convert -f docker-compose.yaml
+    kompose.version: 1.34.0 (HEAD)
+  labels:
+    io.kompose.service: worker
+  name: worker
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      io.kompose.service: worker
+  template:
+    metadata:
+      annotations:
+        kompose.cmd: kompose convert -f docker-compose.yaml
+        kompose.version: 1.34.0 (HEAD)
+      labels:
+        io.kompose.service: worker
+    spec:
+      containers:
+        - env:
+            - name: NPM_RUN_COMMAND
+              value: worker
+            - name: COLLECTOR_ENDPOINT
+              value: http://otel-collector.default.svc.cluster.local:4317
+            - name: DATABASE_URL
+              value: postgresql://ashketchum:squirtle123@db:5432/pokeshop?schema=public
+            - name: POKE_API_BASE_URL
+              value: https://pokeapi.co/api/v2
+            - name: RABBITMQ_HOST
+              value: guest:guest@queue
+            - name: REDIS_URL
+              value: cache
+          image: kubeshop/demo-pokemon-api:latest
+          imagePullPolicy: Always
+          name: worker
+      restartPolicy: Always

From 1371d42b783d106e0d65a3a1f26177039c81d010 Mon Sep 17 00:00:00 2001
From: Matheus Nogueira <matheus.nogueira2008@gmail.com>
Date: Mon, 26 Aug 2024 16:02:48 -0300
Subject: [PATCH 02/11] fix postgres manifest

---
 k8s/db-deployment.yaml | 7 -------
 k8s/db-service.yaml    | 4 ++--
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/k8s/db-deployment.yaml b/k8s/db-deployment.yaml
index 40b4bad..11e0d71 100644
--- a/k8s/db-deployment.yaml
+++ b/k8s/db-deployment.yaml
@@ -29,13 +29,6 @@ spec:
             - name: POSTGRES_USER
               value: ashketchum
           image: postgres:14
-          livenessProbe:
-            exec:
-              command:
-                - pg_isready -U $POSTGRES_USER -d $POSTGRES_DB
-            failureThreshold: 60
-            periodSeconds: 1
-            timeoutSeconds: 5
           name: db
           ports:
             - containerPort: 5432
diff --git a/k8s/db-service.yaml b/k8s/db-service.yaml
index 9d5785a..fbbfa1f 100644
--- a/k8s/db-service.yaml
+++ b/k8s/db-service.yaml
@@ -9,8 +9,8 @@ metadata:
   name: db
 spec:
   ports:
-    - name: "5434"
-      port: 5434
+    - name: "5432"
+      port: 5432
       targetPort: 5432
   selector:
     io.kompose.service: db

From a784e0aa08602d7bcc3f010ac29878b89d0f6ab2 Mon Sep 17 00:00:00 2001
From: Adnan Rahic <ado.raha198@gmail.com>
Date: Tue, 27 Aug 2024 14:35:24 +0200
Subject: [PATCH 03/11] cleanup

---
 k8s/jaeger-deployment.yaml            |  2 ++
 k8s/jaeger-service.yaml               |  3 +++
 k8s/otel-collector-cm0-configmap.yaml | 18 ++++++++----------
 k8s/otel-collector-deployment.yaml    |  4 ++--
 4 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/k8s/jaeger-deployment.yaml b/k8s/jaeger-deployment.yaml
index 970616b..6dea5cb 100644
--- a/k8s/jaeger-deployment.yaml
+++ b/k8s/jaeger-deployment.yaml
@@ -38,6 +38,8 @@ spec:
             timeoutSeconds: 3
           name: jaeger
           ports:
+            - containerPort: 4317
+              protocol: TCP
             - containerPort: 14250
               protocol: TCP
             - containerPort: 16685
diff --git a/k8s/jaeger-service.yaml b/k8s/jaeger-service.yaml
index 9e139f5..7a81880 100644
--- a/k8s/jaeger-service.yaml
+++ b/k8s/jaeger-service.yaml
@@ -9,6 +9,9 @@ metadata:
   name: jaeger
 spec:
   ports:
+    - name: "4317"
+      port: 4317
+      targetPort: 4317
     - name: "14250"
       port: 14250
       targetPort: 14250
diff --git a/k8s/otel-collector-cm0-configmap.yaml b/k8s/otel-collector-cm0-configmap.yaml
index 2ebde60..6dfb2a4 100644
--- a/k8s/otel-collector-cm0-configmap.yaml
+++ b/k8s/otel-collector-cm0-configmap.yaml
@@ -5,11 +5,9 @@ data:
       otlp:
         protocols:
           grpc:
+            endpoint: 0.0.0.0:4317
           http:
-            cors:
-              allowed_origins:
-                - "http://*"
-                - "https://*"
+              endpoint: 0.0.0.0:4318
 
     processors:
       batch:
@@ -17,25 +15,25 @@ data:
     exporters:
       logging:
         loglevel: debug
-      jaeger:
+      otlp/jaeger:
         endpoint: ${JAEGER_ENDPOINT}
         tls:
           insecure: true
-      otlp/trace:
+      otlp/tracetest:
         endpoint: ${TRACETEST_AGENT_ENDPOINT}
         tls:
           insecure: true
 
     service:
       pipelines:
-        traces:
+        traces/jaeger:
           receivers: [otlp]
           processors: []
-          exporters: [logging, jaeger]
-        traces/1:
+          exporters: [logging, otlp/jaeger]
+        traces/tracetest:
           receivers: [otlp]
           processors: [batch]
-          exporters: [otlp/trace]
+          exporters: [otlp/tracetest]
 kind: ConfigMap
 metadata:
   annotations:
diff --git a/k8s/otel-collector-deployment.yaml b/k8s/otel-collector-deployment.yaml
index c3ae11b..9982a91 100644
--- a/k8s/otel-collector-deployment.yaml
+++ b/k8s/otel-collector-deployment.yaml
@@ -28,10 +28,10 @@ spec:
             - /config/otel-local-config.yaml
           env:
             - name: JAEGER_ENDPOINT
-              value: jaeger.default.svc.cluster.local:14250
+              value: jaeger.default.svc.cluster.local:4317
             - name: TRACETEST_AGENT_ENDPOINT
               value: tracetest-agent.default.svc.cluster.local:4317
-          image: otel/opentelemetry-collector-contrib:0.59.0
+          image: otel/opentelemetry-collector-contrib:0.107.0 #0.59.0
           name: otel-collector
           ports:
             - containerPort: 55679

From 298c44990f757b60ac7343f28ec435483583bb99 Mon Sep 17 00:00:00 2001
From: Adnan Rahic <ado.raha198@gmail.com>
Date: Tue, 27 Aug 2024 14:39:57 +0200
Subject: [PATCH 04/11] add tt agent

---
 k8s/tracetest-agent.yaml | 59 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 k8s/tracetest-agent.yaml

diff --git a/k8s/tracetest-agent.yaml b/k8s/tracetest-agent.yaml
new file mode 100644
index 0000000..b95380f
--- /dev/null
+++ b/k8s/tracetest-agent.yaml
@@ -0,0 +1,59 @@
+---
+# Service
+apiVersion: v1
+kind: Service
+metadata:
+  name: tracetest-agent
+  labels:
+    app.kubernetes.io/name: tracetest-agent
+    app.kubernetes.io/instance: tracetest-agent
+spec:
+  selector:
+    app.kubernetes.io/name: tracetest-agent
+    app.kubernetes.io/instance: tracetest-agent
+  ports:
+    - name: grpc-collector-entrypoint
+      protocol: TCP
+      port: 4317
+      targetPort: 4317
+    - name: http-collector-entrypoint
+      protocol: TCP
+      port: 4318
+      targetPort: 4318
+---
+# Deployment
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: tracetest-agent
+  labels:
+    app: tracetest-agent
+    app.kubernetes.io/name: tracetest-agent
+    app.kubernetes.io/instance: tracetest-agent
+spec:
+  selector:
+    matchLabels:
+      app.kubernetes.io/name: tracetest-agent
+      app.kubernetes.io/instance: tracetest-agent
+  template:
+    metadata:
+      labels:
+        app.kubernetes.io/name: tracetest-agent
+        app.kubernetes.io/instance: tracetest-agent
+    spec:
+      containers:
+        - name: agent
+          image: "kubeshop/tracetest-agent:latest"
+          imagePullPolicy: Always
+          args: [
+            "--environment",
+            "<TRACETEST_ENVIRONMENT_ID>", # Add your env id
+            "--api-key",
+            "$TRACETEST_API_KEY",
+            "--server-url",
+            "https://app.tracetest.io",
+            "--mode='verbose'",
+          ]
+          env:
+          - name: TRACETEST_API_KEY
+            value: "<TRACETEST_API_KEY>" # Add your API key

From 7999587a8ef5735bfed4cd2740e3269562bb8e9e Mon Sep 17 00:00:00 2001
From: Adnan Rahic <ado.raha198@gmail.com>
Date: Tue, 27 Aug 2024 15:00:40 +0200
Subject: [PATCH 05/11] simplify manifests

---
 k8s/api-service.yaml                        |  16 ---
 k8s/{api-deployment.yaml => api.yaml}       |  21 +++-
 k8s/cache-service.yaml                      |  16 ---
 k8s/{cache-deployment.yaml => cache.yaml}   |  24 +++-
 k8s/db-persistent-volume-claim.yaml         |  13 ---
 k8s/db-persistent-volume.yaml               |  15 ---
 k8s/db-service.yaml                         |  16 ---
 k8s/{db-deployment.yaml => db.yaml}         |  58 +++++++++-
 k8s/jaeger-service.yaml                     |  25 ----
 k8s/{jaeger-deployment.yaml => jaeger.yaml} |  33 +++++-
 k8s/otel-collector-cm0-configmap.yaml       |  43 -------
 k8s/otel-collector-deployment.yaml          |  55 ---------
 k8s/otel-collector-service.yaml             |  25 ----
 k8s/otel-collector.yaml                     | 119 ++++++++++++++++++++
 k8s/queue-service.yaml                      |  19 ----
 k8s/{queue-deployment.yaml => queue.yaml}   |  27 ++++-
 k8s/rpc-service.yaml                        |  16 ---
 k8s/{rpc-deployment.yaml => rpc.yaml}       |  26 +++--
 k8s/{worker-deployment.yaml => worker.yaml} |   8 +-
 19 files changed, 276 insertions(+), 299 deletions(-)
 delete mode 100644 k8s/api-service.yaml
 rename k8s/{api-deployment.yaml => api.yaml} (84%)
 delete mode 100644 k8s/cache-service.yaml
 rename k8s/{cache-deployment.yaml => cache.yaml} (72%)
 delete mode 100644 k8s/db-persistent-volume-claim.yaml
 delete mode 100644 k8s/db-persistent-volume.yaml
 delete mode 100644 k8s/db-service.yaml
 rename k8s/{db-deployment.yaml => db.yaml} (52%)
 delete mode 100644 k8s/jaeger-service.yaml
 rename k8s/{jaeger-deployment.yaml => jaeger.yaml} (71%)
 delete mode 100644 k8s/otel-collector-cm0-configmap.yaml
 delete mode 100644 k8s/otel-collector-deployment.yaml
 delete mode 100644 k8s/otel-collector-service.yaml
 create mode 100644 k8s/otel-collector.yaml
 delete mode 100644 k8s/queue-service.yaml
 rename k8s/{queue-deployment.yaml => queue.yaml} (70%)
 delete mode 100644 k8s/rpc-service.yaml
 rename k8s/{rpc-deployment.yaml => rpc.yaml} (81%)
 rename k8s/{worker-deployment.yaml => worker.yaml} (80%)

diff --git a/k8s/api-service.yaml b/k8s/api-service.yaml
deleted file mode 100644
index 140ab3b..0000000
--- a/k8s/api-service.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-apiVersion: v1
-kind: Service
-metadata:
-  annotations:
-    kompose.cmd: kompose convert -f docker-compose.yaml
-    kompose.version: 1.34.0 (HEAD)
-  labels:
-    io.kompose.service: api
-  name: api
-spec:
-  ports:
-    - name: "8081"
-      port: 8081
-      targetPort: 8081
-  selector:
-    io.kompose.service: api
diff --git a/k8s/api-deployment.yaml b/k8s/api.yaml
similarity index 84%
rename from k8s/api-deployment.yaml
rename to k8s/api.yaml
index ed5460d..1f34f8c 100644
--- a/k8s/api-deployment.yaml
+++ b/k8s/api.yaml
@@ -1,9 +1,8 @@
+# Deployment
+---
 apiVersion: apps/v1
 kind: Deployment
 metadata:
-  annotations:
-    kompose.cmd: kompose convert -f docker-compose.yaml
-    kompose.version: 1.34.0 (HEAD)
   labels:
     io.kompose.service: api
   name: api
@@ -48,3 +47,19 @@ spec:
             - containerPort: 8081
               protocol: TCP
       restartPolicy: Always
+
+# Service
+---
+apiVersion: v1
+kind: Service
+metadata:
+  labels:
+    io.kompose.service: api
+  name: api
+spec:
+  ports:
+    - name: "8081"
+      port: 8081
+      targetPort: 8081
+  selector:
+    io.kompose.service: api
diff --git a/k8s/cache-service.yaml b/k8s/cache-service.yaml
deleted file mode 100644
index 997aff6..0000000
--- a/k8s/cache-service.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-apiVersion: v1
-kind: Service
-metadata:
-  annotations:
-    kompose.cmd: kompose convert -f docker-compose.yaml
-    kompose.version: 1.34.0 (HEAD)
-  labels:
-    io.kompose.service: cache
-  name: cache
-spec:
-  ports:
-    - name: "6379"
-      port: 6379
-      targetPort: 6379
-  selector:
-    io.kompose.service: cache
diff --git a/k8s/cache-deployment.yaml b/k8s/cache.yaml
similarity index 72%
rename from k8s/cache-deployment.yaml
rename to k8s/cache.yaml
index 1712362..563703d 100644
--- a/k8s/cache-deployment.yaml
+++ b/k8s/cache.yaml
@@ -1,9 +1,8 @@
+# Deployment
+---
 apiVersion: apps/v1
 kind: Deployment
 metadata:
-  annotations:
-    kompose.cmd: kompose convert -f docker-compose.yaml
-    kompose.version: 1.34.0 (HEAD)
   labels:
     io.kompose.service: cache
   name: cache
@@ -14,9 +13,6 @@ spec:
       io.kompose.service: cache
   template:
     metadata:
-      annotations:
-        kompose.cmd: kompose convert -f docker-compose.yaml
-        kompose.version: 1.34.0 (HEAD)
       labels:
         io.kompose.service: cache
     spec:
@@ -35,3 +31,19 @@ spec:
             - containerPort: 6379
               protocol: TCP
       restartPolicy: Always
+
+# Service
+---
+apiVersion: v1
+kind: Service
+metadata:
+  labels:
+    io.kompose.service: cache
+  name: cache
+spec:
+  ports:
+    - name: "6379"
+      port: 6379
+      targetPort: 6379
+  selector:
+    io.kompose.service: cache
diff --git a/k8s/db-persistent-volume-claim.yaml b/k8s/db-persistent-volume-claim.yaml
deleted file mode 100644
index 3eac9d6..0000000
--- a/k8s/db-persistent-volume-claim.yaml
+++ /dev/null
@@ -1,13 +0,0 @@
-apiVersion: v1
-kind: PersistentVolumeClaim
-metadata:
-  name: db-volume-claim
-  labels:
-    io.kompose.service: db
-spec:
-  storageClassName: manual
-  accessModes:
-    - ReadWriteMany
-  resources:
-    requests:
-      storage: 10Gi
diff --git a/k8s/db-persistent-volume.yaml b/k8s/db-persistent-volume.yaml
deleted file mode 100644
index e02d217..0000000
--- a/k8s/db-persistent-volume.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
-apiVersion: v1
-kind: PersistentVolume
-metadata:
-  name: db-volume
-  labels:
-    type: local
-    io.kompose.service: db
-spec:
-  storageClassName: manual
-  capacity:
-    storage: 10Gi
-  accessModes:
-    - ReadWriteMany
-  hostPath:
-    path: /data/postgresql
diff --git a/k8s/db-service.yaml b/k8s/db-service.yaml
deleted file mode 100644
index fbbfa1f..0000000
--- a/k8s/db-service.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-apiVersion: v1
-kind: Service
-metadata:
-  annotations:
-    kompose.cmd: kompose convert -f docker-compose.yaml
-    kompose.version: 1.34.0 (HEAD)
-  labels:
-    io.kompose.service: db
-  name: db
-spec:
-  ports:
-    - name: "5432"
-      port: 5432
-      targetPort: 5432
-  selector:
-    io.kompose.service: db
diff --git a/k8s/db-deployment.yaml b/k8s/db.yaml
similarity index 52%
rename from k8s/db-deployment.yaml
rename to k8s/db.yaml
index 11e0d71..e8d08b2 100644
--- a/k8s/db-deployment.yaml
+++ b/k8s/db.yaml
@@ -1,9 +1,8 @@
+# Deployment
+---
 apiVersion: apps/v1
 kind: Deployment
 metadata:
-  annotations:
-    kompose.cmd: kompose convert -f docker-compose.yaml
-    kompose.version: 1.34.0 (HEAD)
   labels:
     io.kompose.service: db
   name: db
@@ -14,9 +13,6 @@ spec:
       io.kompose.service: db
   template:
     metadata:
-      annotations:
-        kompose.cmd: kompose convert -f docker-compose.yaml
-        kompose.version: 1.34.0 (HEAD)
       labels:
         io.kompose.service: db
     spec:
@@ -41,3 +37,53 @@ spec:
           persistentVolumeClaim:
             claimName: db-volume-claim
       restartPolicy: Always
+
+# Service
+---
+apiVersion: v1
+kind: Service
+metadata:
+  labels:
+    io.kompose.service: db
+  name: db
+spec:
+  ports:
+    - name: "5432"
+      port: 5432
+      targetPort: 5432
+  selector:
+    io.kompose.service: db
+
+# Persistent Volume
+---
+apiVersion: v1
+kind: PersistentVolume
+metadata:
+  name: db-volume
+  labels:
+    type: local
+    io.kompose.service: db
+spec:
+  storageClassName: manual
+  capacity:
+    storage: 10Gi
+  accessModes:
+    - ReadWriteMany
+  hostPath:
+    path: /data/postgresql
+
+# Persistent Volume Claim
+---
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  name: db-volume-claim
+  labels:
+    io.kompose.service: db
+spec:
+  storageClassName: manual
+  accessModes:
+    - ReadWriteMany
+  resources:
+    requests:
+      storage: 10Gi
diff --git a/k8s/jaeger-service.yaml b/k8s/jaeger-service.yaml
deleted file mode 100644
index 7a81880..0000000
--- a/k8s/jaeger-service.yaml
+++ /dev/null
@@ -1,25 +0,0 @@
-apiVersion: v1
-kind: Service
-metadata:
-  annotations:
-    kompose.cmd: kompose convert -f docker-compose.yaml
-    kompose.version: 1.34.0 (HEAD)
-  labels:
-    io.kompose.service: jaeger
-  name: jaeger
-spec:
-  ports:
-    - name: "4317"
-      port: 4317
-      targetPort: 4317
-    - name: "14250"
-      port: 14250
-      targetPort: 14250
-    - name: "16685"
-      port: 16685
-      targetPort: 16685
-    - name: "16686"
-      port: 16686
-      targetPort: 16686
-  selector:
-    io.kompose.service: jaeger
diff --git a/k8s/jaeger-deployment.yaml b/k8s/jaeger.yaml
similarity index 71%
rename from k8s/jaeger-deployment.yaml
rename to k8s/jaeger.yaml
index 6dea5cb..6d3d840 100644
--- a/k8s/jaeger-deployment.yaml
+++ b/k8s/jaeger.yaml
@@ -1,9 +1,8 @@
+# Deployment
+---
 apiVersion: apps/v1
 kind: Deployment
 metadata:
-  annotations:
-    kompose.cmd: kompose convert -f docker-compose.yaml
-    kompose.version: 1.34.0 (HEAD)
   labels:
     io.kompose.service: jaeger
   name: jaeger
@@ -14,9 +13,6 @@ spec:
       io.kompose.service: jaeger
   template:
     metadata:
-      annotations:
-        kompose.cmd: kompose convert -f docker-compose.yaml
-        kompose.version: 1.34.0 (HEAD)
       labels:
         io.kompose.service: jaeger
     spec:
@@ -47,3 +43,28 @@ spec:
             - containerPort: 16686
               protocol: TCP
       restartPolicy: Always
+
+# Service
+---
+apiVersion: v1
+kind: Service
+metadata:
+  labels:
+    io.kompose.service: jaeger
+  name: jaeger
+spec:
+  ports:
+    - name: "4317"
+      port: 4317
+      targetPort: 4317
+    - name: "14250"
+      port: 14250
+      targetPort: 14250
+    - name: "16685"
+      port: 16685
+      targetPort: 16685
+    - name: "16686"
+      port: 16686
+      targetPort: 16686
+  selector:
+    io.kompose.service: jaeger
diff --git a/k8s/otel-collector-cm0-configmap.yaml b/k8s/otel-collector-cm0-configmap.yaml
deleted file mode 100644
index 6dfb2a4..0000000
--- a/k8s/otel-collector-cm0-configmap.yaml
+++ /dev/null
@@ -1,43 +0,0 @@
-apiVersion: v1
-data:
-  collector.config.yaml: |
-    receivers:
-      otlp:
-        protocols:
-          grpc:
-            endpoint: 0.0.0.0:4317
-          http:
-              endpoint: 0.0.0.0:4318
-
-    processors:
-      batch:
-
-    exporters:
-      logging:
-        loglevel: debug
-      otlp/jaeger:
-        endpoint: ${JAEGER_ENDPOINT}
-        tls:
-          insecure: true
-      otlp/tracetest:
-        endpoint: ${TRACETEST_AGENT_ENDPOINT}
-        tls:
-          insecure: true
-
-    service:
-      pipelines:
-        traces/jaeger:
-          receivers: [otlp]
-          processors: []
-          exporters: [logging, otlp/jaeger]
-        traces/tracetest:
-          receivers: [otlp]
-          processors: [batch]
-          exporters: [otlp/tracetest]
-kind: ConfigMap
-metadata:
-  annotations:
-    use-subpath: "true"
-  labels:
-    io.kompose.service: otel-collector
-  name: otel-collector-cm0
diff --git a/k8s/otel-collector-deployment.yaml b/k8s/otel-collector-deployment.yaml
deleted file mode 100644
index 9982a91..0000000
--- a/k8s/otel-collector-deployment.yaml
+++ /dev/null
@@ -1,55 +0,0 @@
-apiVersion: apps/v1
-kind: Deployment
-metadata:
-  annotations:
-    kompose.cmd: kompose convert -f docker-compose.yaml
-    kompose.version: 1.34.0 (HEAD)
-  labels:
-    io.kompose.service: otel-collector
-  name: otel-collector
-spec:
-  replicas: 1
-  selector:
-    matchLabels:
-      io.kompose.service: otel-collector
-  strategy:
-    type: Recreate
-  template:
-    metadata:
-      annotations:
-        kompose.cmd: kompose convert -f docker-compose.yaml
-        kompose.version: 1.34.0 (HEAD)
-      labels:
-        io.kompose.service: otel-collector
-    spec:
-      containers:
-        - args:
-            - --config
-            - /config/otel-local-config.yaml
-          env:
-            - name: JAEGER_ENDPOINT
-              value: jaeger.default.svc.cluster.local:4317
-            - name: TRACETEST_AGENT_ENDPOINT
-              value: tracetest-agent.default.svc.cluster.local:4317
-          image: otel/opentelemetry-collector-contrib:0.107.0 #0.59.0
-          name: otel-collector
-          ports:
-            - containerPort: 55679
-              protocol: TCP
-            - containerPort: 8888
-              protocol: TCP
-            - containerPort: 4317
-              protocol: TCP
-            - containerPort: 4318
-              protocol: TCP
-          volumeMounts:
-            - mountPath: /config
-              name: otel-collector-cm0
-      restartPolicy: Always
-      volumes:
-        - configMap:
-            items:
-              - key: collector.config.yaml
-                path: otel-local-config.yaml
-            name: otel-collector-cm0
-          name: otel-collector-cm0
diff --git a/k8s/otel-collector-service.yaml b/k8s/otel-collector-service.yaml
deleted file mode 100644
index 4a0e098..0000000
--- a/k8s/otel-collector-service.yaml
+++ /dev/null
@@ -1,25 +0,0 @@
-apiVersion: v1
-kind: Service
-metadata:
-  annotations:
-    kompose.cmd: kompose convert -f docker-compose.yaml
-    kompose.version: 1.34.0 (HEAD)
-  labels:
-    io.kompose.service: otel-collector
-  name: otel-collector
-spec:
-  ports:
-    - name: "55679"
-      port: 55679
-      targetPort: 55679
-    - name: "8888"
-      port: 8888
-      targetPort: 8888
-    - name: "4317"
-      port: 4317
-      targetPort: 4317
-    - name: "4318"
-      port: 4318
-      targetPort: 4318
-  selector:
-    io.kompose.service: otel-collector
diff --git a/k8s/otel-collector.yaml b/k8s/otel-collector.yaml
new file mode 100644
index 0000000..1e2c460
--- /dev/null
+++ b/k8s/otel-collector.yaml
@@ -0,0 +1,119 @@
+# Deployment
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  labels:
+    io.kompose.service: otel-collector
+  name: otel-collector
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      io.kompose.service: otel-collector
+  strategy:
+    type: Recreate
+  template:
+    metadata:
+      labels:
+        io.kompose.service: otel-collector
+    spec:
+      containers:
+        - args:
+            - --config
+            - /config/otel-local-config.yaml
+          env:
+            - name: JAEGER_ENDPOINT
+              value: jaeger.default.svc.cluster.local:4317
+            - name: TRACETEST_AGENT_ENDPOINT
+              value: tracetest-agent.default.svc.cluster.local:4317
+          image: otel/opentelemetry-collector-contrib:0.107.0
+          name: otel-collector
+          ports:
+            - containerPort: 55679
+              protocol: TCP
+            - containerPort: 8888
+              protocol: TCP
+            - containerPort: 4317
+              protocol: TCP
+            - containerPort: 4318
+              protocol: TCP
+          volumeMounts:
+            - mountPath: /config
+              name: otel-collector-cm0
+      restartPolicy: Always
+      volumes:
+        - configMap:
+            items:
+              - key: collector.config.yaml
+                path: otel-local-config.yaml
+            name: otel-collector-cm0
+          name: otel-collector-cm0
+
+# Service
+---
+apiVersion: v1
+kind: Service
+metadata:
+  labels:
+    io.kompose.service: otel-collector
+  name: otel-collector
+spec:
+  ports:
+    - name: "55679"
+      port: 55679
+      targetPort: 55679
+    - name: "8888"
+      port: 8888
+      targetPort: 8888
+    - name: "4317"
+      port: 4317
+      targetPort: 4317
+    - name: "4318"
+      port: 4318
+      targetPort: 4318
+  selector:
+    io.kompose.service: otel-collector
+
+# ConfigMap
+---
+apiVersion: v1
+data:
+  collector.config.yaml: |
+    receivers:
+      otlp:
+        protocols:
+          grpc:
+            endpoint: 0.0.0.0:4317
+          http:
+              endpoint: 0.0.0.0:4318
+    processors:
+      batch:
+    exporters:
+      logging:
+        loglevel: debug
+      otlp/jaeger:
+        endpoint: ${JAEGER_ENDPOINT}
+        tls:
+          insecure: true
+      otlp/tracetest:
+        endpoint: ${TRACETEST_AGENT_ENDPOINT}
+        tls:
+          insecure: true
+    service:
+      pipelines:
+        traces/jaeger:
+          receivers: [otlp]
+          processors: []
+          exporters: [logging, otlp/jaeger]
+        traces/tracetest:
+          receivers: [otlp]
+          processors: [batch]
+          exporters: [otlp/tracetest]
+kind: ConfigMap
+metadata:
+  annotations:
+    use-subpath: "true"
+  labels:
+    io.kompose.service: otel-collector
+  name: otel-collector-cm0
diff --git a/k8s/queue-service.yaml b/k8s/queue-service.yaml
deleted file mode 100644
index 8e0f489..0000000
--- a/k8s/queue-service.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
-apiVersion: v1
-kind: Service
-metadata:
-  annotations:
-    kompose.cmd: kompose convert -f docker-compose.yaml
-    kompose.version: 1.34.0 (HEAD)
-  labels:
-    io.kompose.service: queue
-  name: queue
-spec:
-  ports:
-    - name: "5672"
-      port: 5672
-      targetPort: 5672
-    - name: "15672"
-      port: 15672
-      targetPort: 15672
-  selector:
-    io.kompose.service: queue
diff --git a/k8s/queue-deployment.yaml b/k8s/queue.yaml
similarity index 70%
rename from k8s/queue-deployment.yaml
rename to k8s/queue.yaml
index 338b958..535111b 100644
--- a/k8s/queue-deployment.yaml
+++ b/k8s/queue.yaml
@@ -1,9 +1,8 @@
+# Deployment
+---
 apiVersion: apps/v1
 kind: Deployment
 metadata:
-  annotations:
-    kompose.cmd: kompose convert -f docker-compose.yaml
-    kompose.version: 1.34.0 (HEAD)
   labels:
     io.kompose.service: queue
   name: queue
@@ -14,9 +13,6 @@ spec:
       io.kompose.service: queue
   template:
     metadata:
-      annotations:
-        kompose.cmd: kompose convert -f docker-compose.yaml
-        kompose.version: 1.34.0 (HEAD)
       labels:
         io.kompose.service: queue
     spec:
@@ -36,3 +32,22 @@ spec:
             - containerPort: 15672
               protocol: TCP
       restartPolicy: Always
+
+# Service
+---
+apiVersion: v1
+kind: Service
+metadata:
+  labels:
+    io.kompose.service: queue
+  name: queue
+spec:
+  ports:
+    - name: "5672"
+      port: 5672
+      targetPort: 5672
+    - name: "15672"
+      port: 15672
+      targetPort: 15672
+  selector:
+    io.kompose.service: queue
diff --git a/k8s/rpc-service.yaml b/k8s/rpc-service.yaml
deleted file mode 100644
index 60e306b..0000000
--- a/k8s/rpc-service.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-apiVersion: v1
-kind: Service
-metadata:
-  annotations:
-    kompose.cmd: kompose convert -f docker-compose.yaml
-    kompose.version: 1.34.0 (HEAD)
-  labels:
-    io.kompose.service: rpc
-  name: rpc
-spec:
-  ports:
-    - name: "8082"
-      port: 8082
-      targetPort: 8082
-  selector:
-    io.kompose.service: rpc
diff --git a/k8s/rpc-deployment.yaml b/k8s/rpc.yaml
similarity index 81%
rename from k8s/rpc-deployment.yaml
rename to k8s/rpc.yaml
index 2a4ad22..13cb947 100644
--- a/k8s/rpc-deployment.yaml
+++ b/k8s/rpc.yaml
@@ -1,9 +1,8 @@
+# Deployment
+---
 apiVersion: apps/v1
 kind: Deployment
 metadata:
-  annotations:
-    kompose.cmd: kompose convert -f docker-compose.yaml
-    kompose.version: 1.34.0 (HEAD)
   labels:
     io.kompose.service: rpc
   name: rpc
@@ -14,9 +13,6 @@ spec:
       io.kompose.service: rpc
   template:
     metadata:
-      annotations:
-        kompose.cmd: kompose convert -f docker-compose.yaml
-        kompose.version: 1.34.0 (HEAD)
       labels:
         io.kompose.service: rpc
     spec:
@@ -41,7 +37,7 @@ spec:
               command:
                 - wget
                 - --spider
-                - localhost:8081/pokemon/healthcheck
+                - 0.0.0.0:8081/pokemon/healthcheck
             failureThreshold: 60
             periodSeconds: 1
             timeoutSeconds: 3
@@ -50,3 +46,19 @@ spec:
             - containerPort: 8082
               protocol: TCP
       restartPolicy: Always
+
+# Service
+---
+apiVersion: v1
+kind: Service
+metadata:
+  labels:
+    io.kompose.service: rpc
+  name: rpc
+spec:
+  ports:
+    - name: "8082"
+      port: 8082
+      targetPort: 8082
+  selector:
+    io.kompose.service: rpc
diff --git a/k8s/worker-deployment.yaml b/k8s/worker.yaml
similarity index 80%
rename from k8s/worker-deployment.yaml
rename to k8s/worker.yaml
index 1902b4e..a600a69 100644
--- a/k8s/worker-deployment.yaml
+++ b/k8s/worker.yaml
@@ -1,9 +1,8 @@
+# Deployment
+---
 apiVersion: apps/v1
 kind: Deployment
 metadata:
-  annotations:
-    kompose.cmd: kompose convert -f docker-compose.yaml
-    kompose.version: 1.34.0 (HEAD)
   labels:
     io.kompose.service: worker
   name: worker
@@ -14,9 +13,6 @@ spec:
       io.kompose.service: worker
   template:
     metadata:
-      annotations:
-        kompose.cmd: kompose convert -f docker-compose.yaml
-        kompose.version: 1.34.0 (HEAD)
       labels:
         io.kompose.service: worker
     spec:

From 10e5d6fe5c84160877972f2620c92772a332850d Mon Sep 17 00:00:00 2001
From: Adnan Rahic <ado.raha198@gmail.com>
Date: Tue, 27 Aug 2024 15:02:51 +0200
Subject: [PATCH 06/11] add readme

---
 k8s/readme.md | 9 +++++++++
 1 file changed, 9 insertions(+)
 create mode 100644 k8s/readme.md

diff --git a/k8s/readme.md b/k8s/readme.md
new file mode 100644
index 0000000..f496c16
--- /dev/null
+++ b/k8s/readme.md
@@ -0,0 +1,9 @@
+# Install Pokeshop with K8s Manifests
+
+1. [Get your Tracetest API key and env id](https://app.tracetest.io/retrieve-token)
+2. Add your API key and env id in the `tracetest-agent.yaml`
+3. Apply all resources
+
+    ```bash
+    kubectl apply -f .
+    ```

From a659ef4bfa5b2b23c1a4b38bffa1453e9f60481f Mon Sep 17 00:00:00 2001
From: Adnan Rahic <ado.raha198@gmail.com>
Date: Tue, 27 Aug 2024 15:08:44 +0200
Subject: [PATCH 07/11] improve readme

---
 k8s/readme.md | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/k8s/readme.md b/k8s/readme.md
index f496c16..c20fb20 100644
--- a/k8s/readme.md
+++ b/k8s/readme.md
@@ -7,3 +7,13 @@
     ```bash
     kubectl apply -f .
     ```
+4. Create and run a test by going to [`app.tracetest.io`](https://app.tracetest.io) and using the internal Kubernetes service networking:
+
+    - **POST** `http://api.default.svc.cluster.local:8081/pokemon/import` - Body: `{ "id": 1 }`
+    - **GET** `http://api.default.svc.cluster.local:8081/pokemon`
+
+    ![](https://res.cloudinary.com/djwdcmwdz/image/upload/v1724764008/docs/app.tracetest.io_organizations_ttorg_e66318ba6544b856_environments_ttenv_4b0e8945dbe5045a_test_tTFZ453Ig_run_9_selectedSpan_bb8ba205b42a8619_nylqid.png)
+
+5. View the trace and create test specs by going to the `Test` tab.
+
+    ![](https://res.cloudinary.com/djwdcmwdz/image/upload/v1724764098/docs/app.tracetest.io_organizations_ttorg_e66318ba6544b856_environments_ttenv_4b0e8945dbe5045a_test_tTFZ453Ig_run_9_selectedSpan_bb8ba205b42a8619_1_xaxlbi.png)
\ No newline at end of file

From 11516b798ceff4ba3a8bcfe02eefc6c2ff145741 Mon Sep 17 00:00:00 2001
From: Matheus Nogueira <matheus.nogueira2008@gmail.com>
Date: Tue, 27 Aug 2024 18:22:07 -0300
Subject: [PATCH 08/11] add port env

---
 k8s/rpc.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/k8s/rpc.yaml b/k8s/rpc.yaml
index 13cb947..aeebb4e 100644
--- a/k8s/rpc.yaml
+++ b/k8s/rpc.yaml
@@ -30,6 +30,8 @@ spec:
               value: guest:guest@queue
             - name: REDIS_URL
               value: cache
+            - name: RPC_PORT
+              value: "8082"
           image: kubeshop/demo-pokemon-api:latest
           imagePullPolicy: Always
           livenessProbe:

From c5cbd6aa5349efa5cf26147a02c9d33a636eed43 Mon Sep 17 00:00:00 2001
From: Adnan Rahic <ado.raha198@gmail.com>
Date: Wed, 28 Aug 2024 13:49:25 +0200
Subject: [PATCH 09/11] delete kompose file

---
 docker-compose-kompose.yaml | 153 ------------------------------------
 1 file changed, 153 deletions(-)
 delete mode 100644 docker-compose-kompose.yaml

diff --git a/docker-compose-kompose.yaml b/docker-compose-kompose.yaml
deleted file mode 100644
index ef5bd57..0000000
--- a/docker-compose-kompose.yaml
+++ /dev/null
@@ -1,153 +0,0 @@
-version: '3.5'
-name: pokeshop
-
-services:
-  db:
-    image: postgres:14
-    ports:
-      - 5434:5432
-    environment:
-      POSTGRES_USER: ashketchum
-      POSTGRES_PASSWORD: squirtle123
-      POSTGRES_DB: pokeshop
-    healthcheck:
-      test: ['CMD-SHELL', 'pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB']
-      interval: 1s
-      timeout: 5s
-      retries: 60
-
-  cache:
-    image: redis:6
-    ports:
-      - 6379:6379
-    healthcheck:
-      test: ['CMD', 'redis-cli', 'ping']
-      interval: 1s
-      timeout: 3s
-      retries: 60
-
-  queue:
-    image: rabbitmq:3.12
-    restart: unless-stopped
-    ports:
-      - 5672:5672
-      - 15672:15672
-    healthcheck:
-      test: rabbitmq-diagnostics -q check_running
-      interval: 1s
-      timeout: 5s
-      retries: 60
-
-  jaeger:
-    image: jaegertracing/all-in-one:latest
-    ports:
-      - 14250:14250
-      - 16685:16685
-      - 16686:16686
-    environment:
-      - COLLECTOR_ZIPKIN_HOST_PORT=:9411
-      - COLLECTOR_OTLP_ENABLED=true
-    healthcheck:
-      test: ['CMD', 'wget', '--spider', 'localhost:16686']
-      interval: 1s
-      timeout: 3s
-      retries: 60
-
-  otel-collector:
-    image: otel/opentelemetry-collector-contrib:0.59.0
-    restart: unless-stopped
-    extra_hosts:
-      - 'host.docker.internal:host-gateway'
-    ports:
-      - 55679:55679
-      - 8888:8888
-      - 4317:4317
-      - 4318:4318
-    command:
-      - '--config'
-      - '/otel-local-config.yaml'
-    volumes:
-      - ./collector.config.yaml:/otel-local-config.yaml
-    environment:
-      - JAEGER_ENDPOINT=jaeger:14250
-    depends_on:
-      jaeger:
-        condition: service_healthy
-
-  api:
-    build: .
-    environment:
-      REDIS_URL: cache
-      DATABASE_URL: postgresql://ashketchum:squirtle123@db:5432/pokeshop?schema=public
-      RABBITMQ_HOST: queue
-      POKE_API_BASE_URL: https://pokeapi.co/api/v2
-      COLLECTOR_ENDPOINT: http://otel-collector:4317
-      ZIPKIN_URL: http://localhost:9411
-    healthcheck:
-      test: ['CMD', 'wget', '--spider', 'localhost:8081/pokemon/healthcheck']
-      interval: 1s
-      timeout: 3s
-      retries: 60
-    ports:
-      - 8081:8081
-    depends_on:
-      db:
-        condition: service_healthy
-      cache:
-        condition: service_healthy
-      queue:
-        condition: service_healthy
-      jaeger:
-        condition: service_healthy
-      otel-collector:
-        condition: service_started
-  rpc:
-    build: .
-    environment:
-      REDIS_URL: cache
-      DATABASE_URL: postgresql://ashketchum:squirtle123@db:5432/pokeshop?schema=public
-      RABBITMQ_HOST: queue
-      POKE_API_BASE_URL: https://pokeapi.co/api/v2
-      COLLECTOR_ENDPOINT: http://otel-collector:4317
-      ZIPKIN_URL: http://localhost:9411
-      NPM_RUN_COMMAND: rpc
-    healthcheck:
-      test: ['CMD', 'wget', '--spider', 'localhost:8081/pokemon/healthcheck']
-      interval: 1s
-      timeout: 3s
-      retries: 60
-    ports:
-      - 8082:8082
-    depends_on:
-      db:
-        condition: service_healthy
-      cache:
-        condition: service_healthy
-      queue:
-        condition: service_healthy
-      jaeger:
-        condition: service_healthy
-      otel-collector:
-        condition: service_started
-
-  worker:
-    build: .
-    environment:
-      REDIS_URL: cache
-      DATABASE_URL: postgresql://ashketchum:squirtle123@db:5432/pokeshop?schema=public
-      RABBITMQ_HOST: queue
-      POKE_API_BASE_URL: https://pokeapi.co/api/v2
-      COLLECTOR_ENDPOINT: http://otel-collector:4317
-      ZIPKIN_URL: http://localhost:9411
-      NPM_RUN_COMMAND: worker
-    depends_on:
-      db:
-        condition: service_healthy
-      cache:
-        condition: service_healthy
-      queue:
-        condition: service_healthy
-      jaeger:
-        condition: service_healthy
-      otel-collector:
-        condition: service_started

From bf9baed63ca97e4df837d151d176667939075be3 Mon Sep 17 00:00:00 2001
From: Adnan Rahic <ado.raha198@gmail.com>
Date: Wed, 28 Aug 2024 16:59:02 +0200
Subject: [PATCH 10/11] added deps to helm chart

---
 helm-chart/Chart.lock  |  16 +++++--
 helm-chart/Chart.yaml  |   6 +++
 helm-chart/readme.md   |  17 +++++++
 helm-chart/values.yaml | 103 ++++++++++++++++++++++++++++++++++++-----
 k8s/readme.md          |   3 +-
 5 files changed, 127 insertions(+), 18 deletions(-)
 create mode 100644 helm-chart/readme.md

diff --git a/helm-chart/Chart.lock b/helm-chart/Chart.lock
index 0c90569..8327e0c 100644
--- a/helm-chart/Chart.lock
+++ b/helm-chart/Chart.lock
@@ -1,12 +1,18 @@
 dependencies:
 - name: postgresql
   repository: https://charts.bitnami.com/bitnami
-  version: 11.1.19
+  version: 12.1.6
 - name: rabbitmq
   repository: https://charts.bitnami.com/bitnami
-  version: 8.30.0
+  version: 11.2.2
 - name: redis
   repository: https://charts.bitnami.com/bitnami
-  version: 16.8.5
-digest: sha256:7cba0f80b53fc0f7da7cf6402dd131cbfbeab5d7615feb26a005f3f861277195
-generated: "2022-04-15T14:45:15.128266901-03:00"
+  version: 17.3.17
+- name: opentelemetry-collector
+  repository: https://open-telemetry.github.io/opentelemetry-helm-charts
+  version: 0.92.0
+- name: jaeger
+  repository: https://jaegertracing.github.io/helm-charts
+  version: 3.0.10
+digest: sha256:3004524c4ef3f6cb0d3b04bd4f652b239ff0f0ffb73b39ae96c89f71d7221591
+generated: "2024-08-28T14:20:10.713465+02:00"
diff --git a/helm-chart/Chart.yaml b/helm-chart/Chart.yaml
index 055ee07..6f28614 100644
--- a/helm-chart/Chart.yaml
+++ b/helm-chart/Chart.yaml
@@ -33,3 +33,9 @@ dependencies:
   - name: redis
     version: 17.3.17
     repository: https://charts.bitnami.com/bitnami
+  - name: opentelemetry-collector
+    version: 0.92.0
+    repository: https://open-telemetry.github.io/opentelemetry-helm-charts
+  - name: jaeger
+    version: 3.0.10
+    repository: https://jaegertracing.github.io/helm-charts
diff --git a/helm-chart/readme.md b/helm-chart/readme.md
new file mode 100644
index 0000000..b622b9c
--- /dev/null
+++ b/helm-chart/readme.md
@@ -0,0 +1,17 @@
+# Install Pokeshop with Helm
+
+1. Execute `helm dependency update`
+2. Execute `helm install -f ./values.yaml pokeshop .`
+3. [Get your Tracetest API key and env id](https://app.tracetest.io/retrieve-token)
+4. Execute
+
+    ```bash
+    helm repo add tracetestcloud https://kubeshop.github.io/tracetest-cloud-charts --force-update && helm install agent tracetestcloud/tracetest-agent --set agent.apiKey=<TRACETEST_API_KEY> --set agent.environmentId=<TRACETEST_ENVIRONMENT_ID>
+    ```
+
+5. Create and run a test by going to [`app.tracetest.io`](https://app.tracetest.io) and using the internal Kubernetes service networking:
+
+    - **POST** `http://pokeshop-pokemon-api.default.svc.cluster.local:8081/pokemon/import` - Body: `{ "id": 1 }`
+    - **GET** `http://pokeshop-pokemon-api.default.svc.cluster.local:8081/pokemon`
+
+    ![](https://res.cloudinary.com/djwdcmwdz/image/upload/v1724764008/docs/app.tracetest.io_organizations_ttorg_e66318ba6544b856_environments_ttenv_4b0e8945dbe5045a_test_tTFZ453Ig_run_9_selectedSpan_bb8ba205b42a8619_nylqid.png)
diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml
index b30024a..ee5425c 100644
--- a/helm-chart/values.yaml
+++ b/helm-chart/values.yaml
@@ -6,29 +6,21 @@ replicaCount: 1
 
 image:
   repository: kubeshop/demo-pokemon-api
-  pullPolicy: IfNotPresent
+  pullPolicy: Always
   # Overrides the image tag whose default is the chart appVersion.
   tag: latest
 
 env:
+  - name: COLLECTOR_ENDPOINT
+    value: http://pokeshop-opentelemetry-collector:44317
   - name: DATABASE_URL
     value: postgresql://ashketchum:squirtle123@postgresql:5432/pokeshop?schema=public
   - name: REDIS_URL
-    value: redis-master
+    value: redis-headless
   - name: RABBITMQ_HOST
     value: guest:guest@rabbitmq-headless
   - name: POKE_API_BASE_URL
     value: https://pokeapi.co/api/v2
-  - name: COLLECTOR_ENDPOINT
-    value: http://otel-collector.tracetest.svc.cluster.local:4317
-  - name: ZIPKIN_URL
-    value: http://jaeger-agent.tracetest.svc.cluster.local:9411
-  - name: KAFKA_BROKER
-    value: stream:9092
-  - name: KAFKA_TOPIC
-    value: pokemon
-  - name: KAFKA_CLIENT_ID
-    value: streaming-worker
 
 imagePullSecrets: []
 nameOverride: ""
@@ -144,3 +136,90 @@ rabbitmq:
     requests:
       cpu: 400m
       memory: 512Mi
+
+opentelemetry-collector:
+  mode: deployment
+
+  image:
+    repository: "otel/opentelemetry-collector-contrib"
+
+
+  ports:
+    otlp:
+      enabled: true
+      containerPort: 4317
+      servicePort: 44317
+      hostPort: 44317
+      protocol: TCP
+      appProtocol: grpc
+    otlp-http:
+      enabled: true
+      containerPort: 4318
+      servicePort: 44318
+      hostPort: 44318
+      protocol: TCP
+    jaeger-compact:
+      enabled: false
+    jaeger-thrift:
+      enabled: false
+    jaeger-grpc:
+      enabled: false
+    zipkin:
+      enabled: false
+
+  config:
+    receivers:
+      otlp:
+        protocols:
+          http:
+          grpc:
+
+    processors:
+      batch:
+        timeout: 5s
+
+    exporters:
+      debug/noop:
+        verbosity: normal
+        sampling_initial: 0
+        sampling_thereafter: 0
+
+      debug:
+        verbosity: detailed
+      
+      otlp/jaeger:
+        endpoint: pokeshop-jaeger-collector:4317
+        tls:
+          insecure: true
+
+    service:
+      pipelines:
+        logs:
+          exporters: [debug/noop]
+          processors: [memory_limiter, batch]
+          receivers: [otlp]
+        metrics:
+          exporters: [debug/noop]
+          processors: [memory_limiter, batch]
+          receivers: [otlp,prometheus]
+        traces:
+          receivers: [otlp]
+          processors: [batch]
+          exporters: [otlp/jaeger]
+
+jaeger:
+  enabled: true
+  provisionDataStore:
+    cassandra: false
+  allInOne:
+    enabled: true
+
+  storage:
+    type: memory
+
+  agent:
+    enabled: false
+  collector:
+    enabled: false
+  query:
+    enabled: false
diff --git a/k8s/readme.md b/k8s/readme.md
index c20fb20..2cd8114 100644
--- a/k8s/readme.md
+++ b/k8s/readme.md
@@ -7,6 +7,7 @@
     ```bash
     kubectl apply -f .
     ```
+
 4. Create and run a test by going to [`app.tracetest.io`](https://app.tracetest.io) and using the internal Kubernetes service networking:
 
     - **POST** `http://api.default.svc.cluster.local:8081/pokemon/import` - Body: `{ "id": 1 }`
@@ -16,4 +17,4 @@
 
 5. View the trace and create test specs by going to the `Test` tab.
 
-    ![](https://res.cloudinary.com/djwdcmwdz/image/upload/v1724764098/docs/app.tracetest.io_organizations_ttorg_e66318ba6544b856_environments_ttenv_4b0e8945dbe5045a_test_tTFZ453Ig_run_9_selectedSpan_bb8ba205b42a8619_1_xaxlbi.png)
\ No newline at end of file
+    ![](https://res.cloudinary.com/djwdcmwdz/image/upload/v1724764098/docs/app.tracetest.io_organizations_ttorg_e66318ba6544b856_environments_ttenv_4b0e8945dbe5045a_test_tTFZ453Ig_run_9_selectedSpan_bb8ba205b42a8619_1_xaxlbi.png)

From 09fb1dcbd1f57ac37b0566db1c82b1805d34f125 Mon Sep 17 00:00:00 2001
From: Adnan Rahic <ado.raha198@gmail.com>
Date: Tue, 3 Sep 2024 12:29:39 +0200
Subject: [PATCH 11/11] remove stream simplify chart

---
 helm-chart/readme.md                        | 22 +++++--
 helm-chart/templates/deployment.yaml        | 23 ++-----
 helm-chart/templates/service.yaml           |  4 ++
 helm-chart/templates/stream.deployment.yaml | 68 ---------------------
 helm-chart/templates/stream.service.yaml    | 20 ------
 helm-chart/values.yaml                      | 12 +++-
 6 files changed, 36 insertions(+), 113 deletions(-)
 delete mode 100644 helm-chart/templates/stream.deployment.yaml
 delete mode 100644 helm-chart/templates/stream.service.yaml

diff --git a/helm-chart/readme.md b/helm-chart/readme.md
index b622b9c..afe32e8 100644
--- a/helm-chart/readme.md
+++ b/helm-chart/readme.md
@@ -1,9 +1,19 @@
 # Install Pokeshop with Helm
 
-1. Execute `helm dependency update`
-2. Execute `helm install -f ./values.yaml pokeshop .`
+1. Update Helm dependencies
+
+    ```bash
+    helm dependency update
+    ```
+
+2. Install the Helm chart
+
+    ```bash
+    helm install -f ./values.yaml pokeshop .
+    ```
+
 3. [Get your Tracetest API key and env id](https://app.tracetest.io/retrieve-token)
-4. Execute
+4. Install Tracetest Agent
 
     ```bash
     helm repo add tracetestcloud https://kubeshop.github.io/tracetest-cloud-charts --force-update && helm install agent tracetestcloud/tracetest-agent --set agent.apiKey=<TRACETEST_API_KEY> --set agent.environmentId=<TRACETEST_ENVIRONMENT_ID>
@@ -11,7 +21,7 @@
 
 5. Create and run a test by going to [`app.tracetest.io`](https://app.tracetest.io) and using the internal Kubernetes service networking:
 
-    - **POST** `http://pokeshop-pokemon-api.default.svc.cluster.local:8081/pokemon/import` - Body: `{ "id": 1 }`
-    - **GET** `http://pokeshop-pokemon-api.default.svc.cluster.local:8081/pokemon`
+    - **POST** `http://pokeshop-pokemon-api:8081/pokemon/import` - Body: `{ "id": 1 }`
+    - **GET** `http://pokeshop-pokemon-api:8081/pokemon`
 
-    ![](https://res.cloudinary.com/djwdcmwdz/image/upload/v1724764008/docs/app.tracetest.io_organizations_ttorg_e66318ba6544b856_environments_ttenv_4b0e8945dbe5045a_test_tTFZ453Ig_run_9_selectedSpan_bb8ba205b42a8619_nylqid.png)
+    ![](https://res.cloudinary.com/djwdcmwdz/image/upload/v1725358889/docs/app.tracetest.io_organizations_ttorg_e66318ba6544b856_environments_ttenv_4b0e8945dbe5045a_test_Q6Mr5o3Ig_run_24_trigger_agj1ls.png)
diff --git a/helm-chart/templates/deployment.yaml b/helm-chart/templates/deployment.yaml
index e32cb3c..23c8f5c 100644
--- a/helm-chart/templates/deployment.yaml
+++ b/helm-chart/templates/deployment.yaml
@@ -1,4 +1,6 @@
 {{- $rpcPort := .Values.service.rpcPort -}}
+{{- $httpPort := .Values.service.httpPort -}}
+{{- $port := .Values.service.port -}}
 apiVersion: apps/v1
 kind: Deployment
 metadata:
@@ -36,7 +38,7 @@ spec:
           imagePullPolicy: {{ .Values.image.pullPolicy }}
           ports:
             - name: http
-              containerPort: 80
+              containerPort: {{ $httpPort }}
               protocol: TCP
           resources:
             {{- toYaml .Values.resources | nindent 12 }}
@@ -79,23 +81,8 @@ spec:
               value: rpc
             - name: SERVICE_NAME
               value: pokeshop
-            {{- toYaml .Values.env | nindent 12 }}
-        - name: {{ .Chart.Name }}-stream-worker
-          securityContext:
-            {{- toYaml .Values.securityContext | nindent 12 }}
-          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
-          imagePullPolicy: {{ .Values.image.pullPolicy }}
-          ports:
-            - name: http
-              containerPort: 80
-              protocol: TCP
-          resources:
-            {{- toYaml .Values.resources | nindent 12 }}
-          env:
-            - name: NPM_RUN_COMMAND
-              value: stream-worker
-            - name: SERVICE_NAME
-              value: pokeshop-stream-worker
+            - name: RPC_PORT
+              value: "8082"
             {{- toYaml .Values.env | nindent 12 }}
       {{- with .Values.nodeSelector }}
       nodeSelector:
diff --git a/helm-chart/templates/service.yaml b/helm-chart/templates/service.yaml
index 767f942..5c9a949 100644
--- a/helm-chart/templates/service.yaml
+++ b/helm-chart/templates/service.yaml
@@ -8,6 +8,10 @@ spec:
   type: {{ .Values.service.type }}
   ports:
     - port: {{ .Values.service.port }}
+      targetPort: 80
+      protocol: TCP
+      name: ingress
+    - port: {{ .Values.service.httpPort }}
       targetPort: 8081
       protocol: TCP
       name: http
diff --git a/helm-chart/templates/stream.deployment.yaml b/helm-chart/templates/stream.deployment.yaml
deleted file mode 100644
index 56c0c5d..0000000
--- a/helm-chart/templates/stream.deployment.yaml
+++ /dev/null
@@ -1,68 +0,0 @@
-apiVersion: apps/v1
-kind: Deployment
-metadata:
-  name: {{ include "pokemon-api.fullname" . }}-stream
-  labels:
-    {{- include "pokemon-api.labels" . | nindent 4 }}
-spec:
-  {{- if not .Values.autoscaling.enabled }}
-  replicas: {{ .Values.replicaCount }}
-  {{- end }}
-  selector:
-    matchLabels:
-      {{- include "pokemon-api.selectorLabelsStream" . | nindent 6 }}
-  template:
-    metadata:
-      {{- with .Values.podAnnotations }}
-      annotations:
-        {{- toYaml . | nindent 8 }}
-      {{- end }}
-      labels:
-        {{- include "pokemon-api.selectorLabelsStream" . | nindent 8 }}
-    spec:
-      containers:
-        - name: {{ .Chart.Name }}-stream
-          image: "confluentinc/cp-kafka:latest-ubi8"
-          imagePullPolicy: IfNotPresent
-          ports:                                                                                                                                                                                                                       
-            - containerPort: 9092                                                                                                                                                                                                               
-              name: plaintext                                                                                                                                                                                                                   
-              protocol: TCP                                                                                                                                                                                                                     
-            - containerPort: 9093                                                                                                                                                                                                               
-              name: controller                                                                                                                                                                                                                  
-              protocol: TCP
-          resources:
-            {{- toYaml .Values.kafka.resources | nindent 12 }}
-          env: 
-            - name: KAFKA_ADVERTISED_LISTENERS
-              value: PLAINTEXT://stream.{{ .Release.Namespace }}:9092
-            - name: KAFKA_LISTENERS
-              value: PLAINTEXT://0.0.0.0:9092,CONTROLLER://0.0.0.0:9093
-            - name: KAFKA_CONTROLLER_QUORUM_VOTERS
-              value: 1@0.0.0.0:9093
-            - name: KAFKA_CONTROLLER_LISTENER_NAMES
-              value: CONTROLLER
-            - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP
-              value: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
-            - name: KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS
-              value: "0"
-            - name: KAFKA_PROCESS_ROLES
-              value: controller,broker
-            - name: KAFKA_NODE_ID
-              value: "1"
-            - name: KAFKA_METADATA_LOG_SEGMENT_MS
-              value: "15000"
-            - name: KAFKA_METADATA_MAX_RETENTION_MS
-              value: "60000"
-            - name: KAFKA_METADATA_LOG_MAX_RECORD_BYTES_BETWEEN_SNAPSHOTS
-              value: "2800"
-            - name: KAFKA_AUTO_CREATE_TOPICS_ENABLE
-              value: "true"
-            - name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR
-              value: "1"
-            - name: KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR
-              value: "1"
-            - name: KAFKA_HEAP_OPTS
-              value: -Xmx200m -Xms200m
-            - name: CLUSTER_ID
-              value: ckjPoprWQzOf0-FuNkGfFQ
\ No newline at end of file
diff --git a/helm-chart/templates/stream.service.yaml b/helm-chart/templates/stream.service.yaml
deleted file mode 100644
index 7b4e0a7..0000000
--- a/helm-chart/templates/stream.service.yaml
+++ /dev/null
@@ -1,20 +0,0 @@
-apiVersion: v1
-kind: Service
-metadata:
-  name: stream
-  labels:
-    {{- include "pokemon-api.labels" . | nindent 4 }}
-spec:
-  type: ClusterIP
-  ports:
-    - name: plaintext                                                                                                                                                                                                                        
-      port: 9092                                                                                                                                                                                                                              
-      protocol: TCP                                                                                                                                                                                                                           
-      targetPort: 9092                                                                                                                                                                                                                        
-    - name: controller                                                                                                                                                                                                                        
-      port: 9093                                                                                                                                                                                                                              
-      protocol: TCP                                                                                                                                                                                                                           
-      targetPort: 9093
-
-  selector:
-    {{- include "pokemon-api.selectorLabelsStream" . | nindent 4 }}
diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml
index ee5425c..fe2c619 100644
--- a/helm-chart/values.yaml
+++ b/helm-chart/values.yaml
@@ -53,6 +53,7 @@ securityContext:
 service:
   type: ClusterIP
   port: 80
+  httpPort: 8081
   rpcPort: 8082
 
 ingress:
@@ -192,6 +193,11 @@ opentelemetry-collector:
         tls:
           insecure: true
 
+      otlp/tracetest:
+        endpoint: agent-tracetest-agent:4317
+        tls:
+          insecure: true
+
     service:
       pipelines:
         logs:
@@ -202,10 +208,14 @@ opentelemetry-collector:
           exporters: [debug/noop]
           processors: [memory_limiter, batch]
           receivers: [otlp,prometheus]
-        traces:
+        traces/jaeger:
           receivers: [otlp]
           processors: [batch]
           exporters: [otlp/jaeger]
+        traces/tracetest:
+          receivers: [otlp]
+          processors: [batch]
+          exporters: [otlp/tracetest]
 
 jaeger:
   enabled: true