#
# Deploy the Newman/Postman runner and monitor
#

apiVersion: apps/v1
kind: Deployment
metadata:
  name: monitor-${DEPLOY_SUFFIX}
  namespace: ${DEPLOY_NAMESPACE}
spec:
  selector:
    matchLabels:
      app: monitor-${DEPLOY_SUFFIX}
  template:
    metadata:
      labels:
        app: monitor-${DEPLOY_SUFFIX}
      annotations:
        prometheus.io/scrape: 'true'
        prometheus.io/port: '8080'
    spec:
      containers:
        - name: runner
          image: ${DEPLOY_IMAGE}
          imagePullPolicy: Always
          env:
            - name: PORT
              value: '8080'
            - name: COLLECTION_URL
              value: '${DEPLOY_COLLECTION_URL}'
            - name: RUN_ITERATIONS
              value: '${DEPLOY_ITERATIONS}'
            - name: RUN_INTERVAL
              value: '${DEPLOY_INTERVAL}'
            - name: ENABLE_BAIL
              value: 'false'
          resources:
            limits:
              # Why so high? well I think some of the post requests script use a lot of mem
              memory: '300Mi'
              cpu: '200m'
          ports:
            - containerPort: 8080
