# The PROJECT_ID and TARGET_HOST will get sed'ed out with actual values
# Locust is optimized to run on 1 CPU / worker pod. We need to make sure the gke node pool is using compute optimized instances.
# Generally speaking, each of the CPU limits should be about 1 or slightly less. The reason why I made it 940m or 0.94 is because if you use the default node pool using the E2 machine instance sizes, they won't let you schedule pods if it's greater than 0.94. You are better off just keeping it at 0.94. 

apiVersion: "apps/v1"
kind: "Deployment"
metadata:
  name: locust-worker
  labels:
    name: locust-worker
spec:
  replicas: 1 
  selector:
    matchLabels:
      app: locust-worker
  template:
    metadata:
      labels:
        app: locust-worker
    spec:
      containers:
        - name: locust-worker
          image: gcr.io/[PROJECT_ID]/[CLUSTER_NM]:latest
          resources:
            limits:
              cpu: "0.94"
            requests:
              cpu: "0.75"
          env:
            - name: LOCUST_MODE
              value: worker
            - name: LOCUST_MASTER
              value: locust-master
            - name: TARGET_HOST
              value: https://[TARGET_HOST]
