From 9ca7a671035ed360321b68fa9d04d402d741edb1 Mon Sep 17 00:00:00 2001 From: demo-bot Date: Mon, 3 Aug 2026 21:13:03 +0000 Subject: [PATCH 1/6] feat: add service discovery, OTel instrumentation, and k6 load tests -- 2.49.1 From 3d6ca9da4b5ce3c1447686e8f88a01a427434de5 Mon Sep 17 00:00:00 2001 From: demo-bot Date: Mon, 3 Aug 2026 21:13:04 +0000 Subject: [PATCH 2/6] feat: add service discovery, OTel instrumentation, and k6 load tests --- overlays/otel/patches/otel-patch.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 overlays/otel/patches/otel-patch.yaml diff --git a/overlays/otel/patches/otel-patch.yaml b/overlays/otel/patches/otel-patch.yaml new file mode 100644 index 0000000..cafb308 --- /dev/null +++ b/overlays/otel/patches/otel-patch.yaml @@ -0,0 +1,19 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: reno-realworld-5 +spec: + template: + metadata: + annotations: + instrumentation.opentelemetry.io/inject-nodejs: monitoring/otel-instrumentation + spec: + containers: + - name: reno-realworld-5 + env: + - name: OTEL_SERVICE_NAME + value: reno-realworld-5 + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://otel-collector.monitoring.svc.cluster.local:4318 + - name: OTEL_RESOURCE_ATTRIBUTES + value: app=reno-realworld-5 -- 2.49.1 From af87a41abdce155aba93908589f81c72e69719c4 Mon Sep 17 00:00:00 2001 From: demo-bot Date: Mon, 3 Aug 2026 21:13:05 +0000 Subject: [PATCH 3/6] feat: add service discovery, OTel instrumentation, and k6 load tests --- overlays/otel/kustomization.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 overlays/otel/kustomization.yaml diff --git a/overlays/otel/kustomization.yaml b/overlays/otel/kustomization.yaml new file mode 100644 index 0000000..56086db --- /dev/null +++ b/overlays/otel/kustomization.yaml @@ -0,0 +1,15 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ../deploy +patches: +- target: + kind: Deployment + name: reno-realworld-5 + patch: "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: reno-realworld-5\n\ + spec:\n template:\n metadata:\n annotations:\n instrumentation.opentelemetry.io/inject-nodejs:\ + \ monitoring/otel-instrumentation\n spec:\n containers:\n - name:\ + \ reno-realworld-5\n env:\n - name: OTEL_SERVICE_NAME\n \ + \ value: reno-realworld-5\n - name: OTEL_EXPORTER_OTLP_ENDPOINT\n \ + \ value: http://otel-collector.monitoring.svc.cluster.local:4318\n \ + \ - name: OTEL_RESOURCE_ATTRIBUTES\n value: app=reno-realworld-5\n" -- 2.49.1 From ae80cdb0f5aed82088d73b6559d7bc72f6536157 Mon Sep 17 00:00:00 2001 From: demo-bot Date: Mon, 3 Aug 2026 21:13:06 +0000 Subject: [PATCH 4/6] feat: add service discovery, OTel instrumentation, and k6 load tests --- overlays/deploy/k6-configmap.yaml | 59 +++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 overlays/deploy/k6-configmap.yaml diff --git a/overlays/deploy/k6-configmap.yaml b/overlays/deploy/k6-configmap.yaml new file mode 100644 index 0000000..bde0f88 --- /dev/null +++ b/overlays/deploy/k6-configmap.yaml @@ -0,0 +1,59 @@ +# FALLBACK ConfigMap. +# This static skeleton is only used when The Watcher agent fails to generate +# a bespoke k6 script. When generation succeeds, the agent produces a custom +# ConfigMap containing the tailored load-test.js that replaces this file in +# the scaffolded output repository. +apiVersion: v1 +kind: ConfigMap +metadata: + name: k6-test-${{ values.component_id }} + namespace: ${{ values.destination_namespace }} + labels: + app: ${{ values.component_id }} + app.kubernetes.io/managed-by: backstage + app.kubernetes.io/component: load-testing +data: + K6_OUT: "opentelemetry" + K6_OTEL_GRPC_EXPORTER_INSECURE: "true" + K6_OTEL_GRPC_EXPORTER_ENDPOINT: "otel-collector.monitoring.svc.cluster.local:4317" + K6_OTEL_METRIC_PREFIX: "k6_" + K6_OTEL_FLUSH_INTERVAL: "1000" + K6_OTEL_EXPORT_INTERVAL: "5000" + K6_OTEL_SERVICE_NAME: "k6-${{ values.component_id }}" + load-test.js: | + import http from 'k6/http'; + import { check, sleep } from 'k6'; + + const vus = parseInt(__ENV.TEST_VUS || '10'); + const duration = __ENV.TEST_DURATION || '30s'; + const targetUrl = __ENV.TARGET_URL || 'http://localhost'; + + export const options = { + scenarios: { + load_test: { + executor: 'ramping-vus', + startVUs: 0, + stages: [ + { duration: '10s', target: vus }, + { duration: duration, target: vus }, + { duration: '5s', target: 0 }, + ], + }, + }, + thresholds: { + http_req_duration: ['p(95)<500'], + http_req_failed: ['rate<0.075'], + }, + }; + + // Treat 2xx and 3xx responses as expected (redirects won't inflate http_req_failed) + http.setResponseCallback(http.expectedStatuses({ min: 200, max: 399 })); + + export default function () { + const res = http.get(targetUrl); + check(res, { + 'status is 200': (r) => r.status === 200, + 'response time < 500ms': (r) => r.timings.duration < 500, + }); + sleep(0.5); + } -- 2.49.1 From 23b375b85a518b77be86f7cc044d16c1342f86a9 Mon Sep 17 00:00:00 2001 From: demo-bot Date: Mon, 3 Aug 2026 21:13:07 +0000 Subject: [PATCH 5/6] feat: add service discovery, OTel instrumentation, and k6 load tests --- k6/testrun.yaml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 k6/testrun.yaml diff --git a/k6/testrun.yaml b/k6/testrun.yaml new file mode 100644 index 0000000..5550c67 --- /dev/null +++ b/k6/testrun.yaml @@ -0,0 +1,36 @@ +# FALLBACK k6 TestRun CRD — reference template for load testing ${{ values.component_id }}. +# This static skeleton is only used when The Watcher agent fails to generate +# a bespoke k6 script. When generation succeeds, the agent produces a custom +# TestRun CRD that replaces this file in the scaffolded output repository. +# +# TestRun CRDs are committed to the repo as a reference. They are created +# dynamically from Backstage (not auto-synced by ArgoCD) because they are +# ephemeral one-shot resources. +apiVersion: k6.io/v1alpha1 +kind: TestRun +metadata: + name: k6-${{ values.component_id }} + namespace: ${{ values.destination_namespace }} + labels: + app: ${{ values.component_id }} + backstage.io/component: ${{ values.component_id }} + app.kubernetes.io/managed-by: backstage + app.kubernetes.io/component: load-testing +spec: + parallelism: 1 + script: + configMap: + name: k6-test-${{ values.component_id }} + file: load-test.js + runner: + image: grafana/k6:latest + envFrom: + - configMapRef: + name: k6-test-${{ values.component_id }} + env: + - name: K6_OTEL_SERVICE_NAME + value: k6-${{ values.component_id }} + - name: TEST_VUS + value: "10" + - name: TEST_DURATION + value: "30s" -- 2.49.1 From 86068152e65830b9ffff5722ca25e9d6d4126de0 Mon Sep 17 00:00:00 2001 From: demo-bot Date: Mon, 3 Aug 2026 21:13:08 +0000 Subject: [PATCH 6/6] feat: add service discovery, OTel instrumentation, and k6 load tests --- k6/load-test.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 k6/load-test.js diff --git a/k6/load-test.js b/k6/load-test.js new file mode 100644 index 0000000..b590d11 --- /dev/null +++ b/k6/load-test.js @@ -0,0 +1,36 @@ +// FALLBACK k6 load-test script. +// This static skeleton is only used when The Watcher agent fails to generate +// a bespoke k6 script tailored to the application's detected HTTP endpoints. +// When generation succeeds, the agent produces a custom script that replaces +// this file in the scaffolded output repository. +import http from 'k6/http'; +import { check, sleep } from 'k6'; + +export const options = { + scenarios: { + load_test: { + executor: 'ramping-vus', + startVUs: 0, + stages: [ + { duration: '${{ values.k6_ramp_up | default("10s") }}', target: ${{ values.k6_virtual_users | default(10) }} }, + { duration: '${{ values.k6_duration | default("30s") }}', target: ${{ values.k6_virtual_users | default(10) }} }, + { duration: '5s', target: 0 }, + ], + }, + }, + thresholds: { + http_req_duration: ['p(95)<500'], + http_req_failed: ['rate<0.01'], + }, +}; + +const BASE_URL = `http://${{ values.frontend_service_name | default("frontend") }}.${{ values.destination_namespace }}.svc.cluster.local:${{ values.frontend_service_port | default(80) }}`; + +export default function () { + const res = http.get(`${BASE_URL}${{ values.k6_target_path | default("/") }}`); + check(res, { + 'status is 200': (r) => r.status === 200, + 'response time < 500ms': (r) => r.timings.duration < 500, + }); + sleep(0.5); +} -- 2.49.1