# 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"
