# Copyright 2020 TriggerMesh Inc.
#
# 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.

apiVersion: v1
kind: Pod
metadata:
  name: &app ramp-requests
spec:
  restartPolicy: Never

  # In production, with n1-standard-4 nodes, the sum of resources requested by
  # all containers can not exceed the values below, considering the
  # system-reserved resources and typical DaemonSets such as kube-proxy and
  # fluentbit:
  #
  #  cpu: 3700m
  #  memory: 12150Mi
  #
  containers:

  - name: *app
    image: gcr.io/triggermesh/perf/ramp-requests
    env:
    - name: TARGET_URL
      value: http://thrpt-receiver.perf-thrpt-receiver

    resources:
      requests:
        # We set the CPU request as high as possible to ensure the container
        # receives the highest possible CPU share.
        # https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#how-pods-with-resource-limits-are-run
        cpu: 3700m
        memory: 12150Mi
      limits:
        memory: 12150Mi

  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: purpose
            operator: In
            values:
            - control

  tolerations:
  - effect: NoSchedule
    key: dedicated
    operator: Equal
    value: control
