#
# Copyright 2019 Google LLC
#
# 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: apps/v1
kind: Deployment
metadata:
  name: locust-master
  labels:
    name: locust-master
spec:
  replicas: 1
  selector:
    matchLabels:
      app: locust-master
  template:
    metadata:
      labels:
        app: locust-master
    spec:
      containers:
      - name: locust-master
        image: gcr.io/YOUR-PROJECT-ID/locust_tester
        ports:
          - name: loc-master
            containerPort: 8089
            protocol: TCP
          - name: loc-master-p1
            containerPort: 5557
            protocol: TCP
          - name: loc-master-p2
            containerPort: 5558
            protocol: TCP
        command: ["locust","-f","locust/trtis_grpc_client.py"]
        args: ["--host", "CLUSTER-IP-TRTIS", "--master"]
        resources:
          requests:
            cpu: 200m
        env:
          - name: MODEL_NAME
            valueFrom:
              configMapKeyRef:
                name: locust-config
                key: model
          - name: SERVER_ADDRESS
            valueFrom:
              configMapKeyRef:
                name: locust-config
                key: saddr
          - name: REQUEST_PER_SEC
            valueFrom:
              configMapKeyRef:
                name: locust-config
                key: rps
