apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: cloudwatch-agent-statsd
  namespace: amazon-cloudwatch
spec:
  selector:
    matchLabels:
      name: cloudwatch-agent-statsd
  template:
    metadata:
      labels:
        name: cloudwatch-agent-statsd
    spec:
      containers:
        - name: cloudwatch-agent
          image: amazon/cloudwatch-agent:latest
          imagePullPolicy: Always
          ports:
            # containerPort should be consistent with the listen port defined in configmap
            - containerPort: 8125
              hostPort: 8125
              protocol: UDP
          resources:
            limits:
              cpu:  200m
              memory: 100Mi
            requests:
              cpu: 200m
              memory: 100Mi
          # Please don't change the env
          env:
            - name: HOST_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
          # Please don't change the mountPath
          volumeMounts:
            - name: cwagentconfig
              mountPath: /etc/cwagentconfig
      volumes:
        - name: cwagentconfig
          configMap:
            name: cwagentstatsdconfig
      terminationGracePeriodSeconds: 60