apiVersion: apps/v1
kind: Deployment
metadata:
  name: sm-agent-1
  namespace: synthetic-monitoring
spec:
  minReadySeconds: 10
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      name: sm-agent-1
  strategy:
    rollingUpdate:
      maxSurge: 0
      maxUnavailable: 1
  template:
    metadata:
      labels:
        name: sm-agent-1
    spec:
      containers:
        - args:
            - /usr/local/bin/synthetic-monitoring-agent --api-server-address=${API_SERVER} --api-token=${API_TOKEN} --verbose=true
          command:
            - sh
            - -c
          env:
            - name: API_TOKEN
              valueFrom:
                secretKeyRef:
                  key: api-token
                  name: sm-agent-1
            #
            - name: API_SERVER
              value: "PROBE_API_SERVER_URL"
          image: grafana/synthetic-monitoring-agent:latest
          name: agent
          ports:
            - containerPort: 4050
              name: http-metrics
          readinessProbe:
            httpGet:
              path: /ready
              port: 4050
          livenessProbe:
            httpGet:
              path: /
              port: 4050
          resources:
            requests:
              cpu: 200m
              memory: 500Mi
