From 96c92d807886c85caed874b5d624ec03e9b08afe Mon Sep 17 00:00:00 2001 From: demo-bot Date: Mon, 12 Oct 2026 18:54:52 +0000 Subject: [PATCH] Placement decision and platform artifacts for review (#1) --- .platform/placement.md | 21 +++++++ .platform/placement.yaml | 36 +++++++++++ k6/load-test.js | 87 +++++++++++++++++++++++++++ k6/testrun.yaml | 24 ++++++++ overlays/deploy/k6-configmap.yaml | 49 +++++++++++++++ overlays/otel/kustomization.yaml | 14 +++++ overlays/otel/patches/otel-patch.yaml | 19 ++++++ 7 files changed, 250 insertions(+) create mode 100644 .platform/placement.md create mode 100644 .platform/placement.yaml create mode 100644 k6/load-test.js create mode 100644 k6/testrun.yaml create mode 100644 overlays/deploy/k6-configmap.yaml create mode 100644 overlays/otel/kustomization.yaml create mode 100644 overlays/otel/patches/otel-patch.yaml diff --git a/.platform/placement.md b/.platform/placement.md new file mode 100644 index 0000000..8a5d893 --- /dev/null +++ b/.platform/placement.md @@ -0,0 +1,21 @@ +# Placement decision — place-b-2 + +**Decision: REFUSED.** No offered landing zone provides EU residency. Offered: Public cloud · US East. + +| Criterion | Answer | Rule | Outcome | +|---|---|---|---| +| Latency | Batch — minutes or hours are fine | No constraint | ✓ no constraint | +| Data sensitivity | Personal vehicle data — VINs, location, driver data | Policy: personal vehicle data stays EU-resident | ✗ not met: needs EU residency | +| Run cost | Variable — follows demand | No constraint | ✓ no constraint | +| Lifecycle | Life of a vehicle — 15–20 years | 15–20-year lifecycle: the approver confirms long-term support | ⚑ for the approver | +| Integration | Customers and partners over the internet | Internet-facing needs public ingress | ✓ met by an offered landing zone | +| Skills & control | The platform team | No constraint | ✓ no constraint | + +**For the approver** +- 15–20-year lifecycle: the approver confirms long-term support + +**Landing zone:** none + +Merging this pull request approves the decision. Every deploy reads `.platform/placement.yaml` +and goes only to the landing zone named there. A refused record fails the deploy, with the reason above. + diff --git a/.platform/placement.yaml b/.platform/placement.yaml new file mode 100644 index 0000000..8146053 --- /dev/null +++ b/.platform/placement.yaml @@ -0,0 +1,36 @@ +# Placement decision record. Written by the golden path from the workload profile and +# approved by merging the Gate 1 pull request. deploy.yml reads decision, runner and +# reason on every deploy: keep them top-level, one line each. +decision: refused +landing_zone: none +landing_zone_name: "none" +runner: none +reason: "No offered landing zone provides EU residency. Offered: Public cloud · US East." +workload: "place-b-2" +criteria: + - criterion: "Latency" + answer: "Batch — minutes or hours are fine" + rule: "No constraint" + outcome: "✓ no constraint" + - criterion: "Data sensitivity" + answer: "Personal vehicle data — VINs, location, driver data" + rule: "Policy: personal vehicle data stays EU-resident" + outcome: "✗ not met: needs EU residency" + - criterion: "Run cost" + answer: "Variable — follows demand" + rule: "No constraint" + outcome: "✓ no constraint" + - criterion: "Lifecycle" + answer: "Life of a vehicle — 15–20 years" + rule: "15–20-year lifecycle: the approver confirms long-term support" + outcome: "⚑ for the approver" + - criterion: "Integration" + answer: "Customers and partners over the internet" + rule: "Internet-facing needs public ingress" + outcome: "✓ met by an offered landing zone" + - criterion: "Skills & control" + answer: "The platform team" + rule: "No constraint" + outcome: "✓ no constraint" +flags: ["15–20-year lifecycle: the approver confirms long-term support"] + diff --git a/k6/load-test.js b/k6/load-test.js new file mode 100644 index 0000000..88e9b17 --- /dev/null +++ b/k6/load-test.js @@ -0,0 +1,87 @@ +import http from 'k6/http'; +import { check, sleep, group } from 'k6'; + +const vus = parseInt(__ENV.TEST_VUS || '10'); +const duration = __ENV.TEST_DURATION || '30s'; +const targetUrl = __ENV.TARGET_URL || 'http://frontend.demo-apps.svc.cluster.local:80'; + +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.01'], + }, +}; + +http.setResponseCallback(http.expectedStatuses({ min: 200, max: 399 })); + +export default function () { + group('System API', () => { + const resWelcome = http.get(`${targetUrl}/`); + check(resWelcome, { + 'status is 200': (r) => r.status === 200, + 'response time < 500ms': (r) => r.timings.duration < 500, + }); + }); + + sleep(0.5); + + group('Owner API', () => { + const resFindOwners = http.get(`${targetUrl}/owners/find`); + check(resFindOwners, { + 'status is 200': (r) => r.status === 200, + 'response time < 500ms': (r) => r.timings.duration < 500, + }); + + const resCreateOwner = http.post(`${targetUrl}/owners/new`, 'firstName=John&lastName=Doe&address=123+Main+St&city=Springfield&telephone=1234567890'); + check(resCreateOwner, { + 'status is 302': (r) => r.status === 302, + 'response time < 500ms': (r) => r.timings.duration < 500, + }); + + const resOwnerDetails = http.get(`${targetUrl}/owners/1`); + check(resOwnerDetails, { + 'status is 200': (r) => r.status === 200, + 'response time < 500ms': (r) => r.timings.duration < 500, + }); + }); + + sleep(0.5); + + group('Vet API', () => { + const resVetList = http.get(`${targetUrl}/vets.html`); + check(resVetList, { + 'status is 200': (r) => r.status === 200, + 'response time < 500ms': (r) => r.timings.duration < 500, + }); + + const resVetJson = http.get(`${targetUrl}/vets`); + check(resVetJson, { + 'status is 200': (r) => r.status === 200, + 'response time < 500ms': (r) => r.timings.duration < 500, + 'response contains vet list': (r) => JSON.parse(r.body).vets.length > 0, + }); + }); + + sleep(0.5); + + group('Error Handling', () => { + const resError = http.get(`${targetUrl}/oups`, { responseCallback: http.expectedStatuses(500) }); + check(resError, { + 'status is 500': (r) => r.status === 500, + 'response time < 500ms': (r) => r.timings.duration < 500, + }); + }); + + sleep(0.5); +} \ No newline at end of file diff --git a/k6/testrun.yaml b/k6/testrun.yaml new file mode 100644 index 0000000..a3283ed --- /dev/null +++ b/k6/testrun.yaml @@ -0,0 +1,24 @@ +apiVersion: k6.io/v1alpha1 +kind: TestRun +metadata: + name: k6-place-b-2 + namespace: demo-apps + labels: + app: place-b-2 + backstage.io/component: place-b-2 + app.kubernetes.io/managed-by: backstage + app.kubernetes.io/component: load-testing +spec: + parallelism: 1 + script: + configMap: + name: k6-test-place-b-2 + file: load-test.js + runner: + image: grafana/k6:latest + envFrom: + - configMapRef: + name: k6-test-place-b-2 + env: + - name: K6_OTEL_SERVICE_NAME + value: k6-place-b-2 diff --git a/overlays/deploy/k6-configmap.yaml b/overlays/deploy/k6-configmap.yaml new file mode 100644 index 0000000..4cf5c01 --- /dev/null +++ b/overlays/deploy/k6-configmap.yaml @@ -0,0 +1,49 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: k6-test-place-b-2 + namespace: demo-apps + labels: + app: place-b-2 + 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-place-b-2 + load-test.js: "import http from 'k6/http';\nimport { check, sleep, group } from\ + \ 'k6';\n\nconst vus = parseInt(__ENV.TEST_VUS || '10');\nconst duration = __ENV.TEST_DURATION\ + \ || '30s';\nconst targetUrl = __ENV.TARGET_URL || 'http://frontend.demo-apps.svc.cluster.local:80';\n\ + \nexport const options = {\n scenarios: {\n load_test: {\n executor:\ + \ 'ramping-vus',\n startVUs: 0,\n stages: [\n { duration: '10s',\ + \ target: vus },\n { duration: duration, target: vus },\n { duration:\ + \ '5s', target: 0 },\n ],\n },\n },\n thresholds: {\n http_req_duration:\ + \ ['p(95)<500'],\n http_req_failed: ['rate<0.01'],\n },\n};\n\nhttp.setResponseCallback(http.expectedStatuses({\ + \ min: 200, max: 399 }));\n\nexport default function () {\n group('System API',\ + \ () => {\n const resWelcome = http.get(`${targetUrl}/`);\n check(resWelcome,\ + \ {\n 'status is 200': (r) => r.status === 200,\n 'response time < 500ms':\ + \ (r) => r.timings.duration < 500,\n });\n });\n\n sleep(0.5);\n\n group('Owner\ + \ API', () => {\n const resFindOwners = http.get(`${targetUrl}/owners/find`);\n\ + \ check(resFindOwners, {\n 'status is 200': (r) => r.status === 200,\n\ + \ 'response time < 500ms': (r) => r.timings.duration < 500,\n });\n\n\ + \ const resCreateOwner = http.post(`${targetUrl}/owners/new`, 'firstName=John&lastName=Doe&address=123+Main+St&city=Springfield&telephone=1234567890');\n\ + \ check(resCreateOwner, {\n 'status is 302': (r) => r.status === 302,\n\ + \ 'response time < 500ms': (r) => r.timings.duration < 500,\n });\n\n\ + \ const resOwnerDetails = http.get(`${targetUrl}/owners/1`);\n check(resOwnerDetails,\ + \ {\n 'status is 200': (r) => r.status === 200,\n 'response time < 500ms':\ + \ (r) => r.timings.duration < 500,\n });\n });\n\n sleep(0.5);\n\n group('Vet\ + \ API', () => {\n const resVetList = http.get(`${targetUrl}/vets.html`);\n\ + \ check(resVetList, {\n 'status is 200': (r) => r.status === 200,\n \ + \ 'response time < 500ms': (r) => r.timings.duration < 500,\n });\n\n \ + \ const resVetJson = http.get(`${targetUrl}/vets`);\n check(resVetJson, {\n\ + \ 'status is 200': (r) => r.status === 200,\n 'response time < 500ms':\ + \ (r) => r.timings.duration < 500,\n 'response contains vet list': (r) =>\ + \ JSON.parse(r.body).vets.length > 0,\n });\n });\n\n sleep(0.5);\n\n group('Error\ + \ Handling', () => {\n const resError = http.get(`${targetUrl}/oups`, { responseCallback:\ + \ http.expectedStatuses(500) });\n check(resError, {\n 'status is 500':\ + \ (r) => r.status === 500,\n 'response time < 500ms': (r) => r.timings.duration\ + \ < 500,\n });\n });\n\n sleep(0.5);\n}" diff --git a/overlays/otel/kustomization.yaml b/overlays/otel/kustomization.yaml new file mode 100644 index 0000000..2baa955 --- /dev/null +++ b/overlays/otel/kustomization.yaml @@ -0,0 +1,14 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ../deploy +patches: +- target: + kind: Deployment + name: petclinic + patch: "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: petclinic\nspec:\n\ + \ template:\n metadata:\n annotations:\n instrumentation.opentelemetry.io/inject-java:\ + \ monitoring/otel-instrumentation\n spec:\n containers:\n - name:\ + \ workload\n env:\n - name: OTEL_SERVICE_NAME\n value:\ + \ petclinic\n - name: OTEL_EXPORTER_OTLP_ENDPOINT\n value: http://otel-collector.monitoring.svc.cluster.local:4318\n\ + \ - name: OTEL_RESOURCE_ATTRIBUTES\n value: app=place-b-2\n" diff --git a/overlays/otel/patches/otel-patch.yaml b/overlays/otel/patches/otel-patch.yaml new file mode 100644 index 0000000..b6e87cb --- /dev/null +++ b/overlays/otel/patches/otel-patch.yaml @@ -0,0 +1,19 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: petclinic +spec: + template: + metadata: + annotations: + instrumentation.opentelemetry.io/inject-java: monitoring/otel-instrumentation + spec: + containers: + - name: workload + env: + - name: OTEL_SERVICE_NAME + value: petclinic + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://otel-collector.monitoring.svc.cluster.local:4318 + - name: OTEL_RESOURCE_ATTRIBUTES + value: app=place-b-2