apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: loadgenerator
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: loadgenerator
    spec:
      terminationGracePeriodSeconds: 5
      restartPolicy: Always
      initContainers:
      - name: wait-frontend
        image: alpine:3.6
        command: ['sh', '-c', 'set -x;  apk add --no-cache curl; 
          until curl -f "http://${FRONTEND_ADDR}"; do 
            echo "waiting for http://${FRONTEND_ADDR}"; 
            sleep 2;
          done;']
        env:
        - name: FRONTEND_ADDR
          value: "frontend:80"
      containers:
      - name: main
        image: loadgenerator
        env:
        - name: FRONTEND_ADDR
          value: "frontend:80"
        - name: USERS
          value: "1"
        resources:
          requests:
            cpu: 100m
            memory: 64Mi
          limits:
            cpu: 200m
            memory: 128Mi
