# Copyright 2021 The Knative Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# To run this:
# ko resolve -f 300-broker-perf-consumer-job.yml | kubectl create -f -

apiVersion: batch/v1
kind: Job
metadata:
  generateName: rabbitmq-broker-perf-send-receive-
  namespace: perf-eventing
  labels:
    role: rabbitmq-broker-perf-consumer
spec:
  completions: 1
  parallelism: 1
  backoffLimit: 0
  template:
    metadata:
      labels:
        role: rabbitmq-broker-perf-consumer
    spec:
      serviceAccountName: perf-eventing
      restartPolicy: Never
      containers:
      - name: sender-receiver
        image: ko://knative.dev/eventing/test/test_images/performance
        args:
        - "--roles=sender,receiver"
        - "--sink=http://rabbitmq-test-broker-broker-ingress.perf-eventing.svc.cluster.local/"
        - "--aggregator=rabbitmq-broker-perf-aggregator:10000"
        - "--pace=1000:300"
        env:
        - name: GOGC
          value: "off"
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        resources:
          requests:
            cpu: 2
            memory: 2Gi
        ports:
        - name: cloudevents
          containerPort: 8080
