apiVersion: theodolite.rocks/v1beta1
kind: benchmark
metadata:
  name: uc3-beam-samza
spec:
  sut:
    resources:
      - configMap:
          name: "benchmark-resources-uc3-beam-samza"
          files:
          - "uc3-beam-samza-deployment.yaml"
          - "beam-samza-service.yaml"
          - "service-monitor.yaml"
    afterActions:
      - exec:
          selector: # delete zookeeper nodes to reset zookeeper
            pod:
              matchLabels:
                app: "zookeeper-client"
            container: "zookeeper-client"
          command: ["bash", "-c", "bin/zkCli.sh -server $ZOOKEEPER_SERVER deleteall /app-theodolite-uc3-application-1"]
          timeoutSeconds: 60
  loadGenerator:
    resources:
      - configMap:
          name: "benchmark-resources-uc3-load-generator"
          files:
          - "uc3-load-generator-deployment.yaml"
          - "uc3-load-generator-service.yaml"
  resourceTypes:
    - typeName: "Instances"
      patchers:
        - type: "ReplicaPatcher"
          resource: "uc3-beam-samza-deployment.yaml"
  loadTypes:
    - typeName: "NumSensors"
      patchers:
        - type: "EnvVarPatcher"
          resource: "uc3-load-generator-deployment.yaml"
          properties:
            container: "workload-generator"
            variableName: "NUM_SENSORS"
        - type: NumSensorsLoadGeneratorReplicaPatcher
          resource: "uc3-load-generator-deployment.yaml"
          properties:
            loadGenMaxRecords: "150000"
  slos:
    - name: "lag trend"
      sloType: "lag trend"
      prometheusUrl: "http://prometheus-operated:9090"
      offset: 0
      properties:
        threshold: 2000
        externalSloUrl: "http://localhost:80/evaluate-slope"
        warmup: 60 # in seconds
  kafkaConfig:
    bootstrapServer: "theodolite-kafka-kafka-bootstrap:9092"
    topics:
      - name: "input"
        numPartitions: 40
        replicationFactor: 1
      - name: "output"
        numPartitions: 40
        replicationFactor: 1
      - name: ".*samza.*"
        removeOnly: true
      - name: ".*uc3-application.*"
        removeOnly: true