apiVersion: apps/v1
kind: Deployment
metadata:
  name: loadgenerator
  namespace: hipster
  annotations:
    fluxcd.io/ignore: "false"
    linkerd.io/inject: enabled
    fluxcd.io/automated: "false"
spec:
  selector:
    matchLabels:
      app: loadgenerator
  replicas: 1
  template:
    metadata:
      labels:
        app: loadgenerator
    spec:
      terminationGracePeriodSeconds: 7
      restartPolicy: Always
      initContainers:
      - name: wait-frontend
        image: alpine:3.6
        command: ["sh", "-c", 'set -x;  apk add --no-cache curl && until timeout -t
            2 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: agilewaysreg.azurecr.io/hipster/loadgenerator:9050 # {"$imagepolicy": "flux-system:loadgenerator"}
        env:
        - name: FRONTEND_ADDR
          value: "frontend:80"
        - name: USERS
          value: "10"
        resources:
          requests:
            cpu: 300m
            memory: 256Mi
          limits:
            cpu: 500m
            memory: 512Mi
