apiVersion: v1
kind: ConfigMap
metadata:
  name: keptn-bookinfo-config
  namespace: orkestra
data:
  config.yaml: |
    apiVersion: v2
    actions:
      - name: "Run hey"
        events:
          - name: "sh.keptn.event.test.triggered"
        tasks:
          - name: "Run hey load tests"
            image: "azureorkestra/hey"
            cmd: ["hey"]
            args: ["-host", "example.com", "-z", "5m", "http://gateway.istio-system.svc.cluster.local/productpage"]
            maxPollDuration: 10000
  keptn-config.json: |-
    {
      "url": "http://api-gateway-nginx.orkestra.svc.cluster.local/api",
      "namespace": "orkestra",
      "timeframe": "5m",
      "token": {
        "secretRef":  {
          "name": "keptn-api-token",
          "namespace": "orkestra"
        }
      }
    }
  shipyard.yaml: |-
    apiVersion: "spec.keptn.sh/0.2.2"
    kind: "Shipyard"
    metadata:
      name: "shipyard-bookinfo"
    spec:
      stages:
        - name: "dev"
          sequences:
            - name: "evaluation"
              tasks:
              - name: "test"
                properties:
                  teststrategy: "functional"
              - name: "evaluation"
  sli.yaml: |
    spec_version: "1.0"
    indicators:
      error_percentage: sum(rate(istio_requests_total{app="gateway", response_code="500"}[$DURATION_SECONDS])) / sum(rate(istio_requests_total{app="gateway"}[$DURATION_SECONDS])) * 100
  slo.yaml: |-
    spec_version: '1.0'
    comparison:
      compare_with: "single_result"
      include_result_with_score: "pass"
      aggregate_function: avg
    objectives:
      - sli: error_percentage
        pass:
          - criteria:
            - "<10"
        warning:
          - criteria:
            - "<=5"
    total_score:
      pass: "100%"
      warning: "75%"
