# create amazon-cloudwatch namespace
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: cloudwatch-agent-windows
  namespace: amazon-cloudwatch
spec:
  selector:
    matchLabels:
      app: cloudwatch-agent
  template:
    metadata:
      labels:
        app: cloudwatch-agent
    spec:
      securityContext:
        windowsOptions:
          hostProcess: true
          runAsUserName: "NT AUTHORITY\\SYSTEM"
      hostNetwork: true
      containers:
        - name: cloudwatch-agent
          image: CW_TEST_IMAGE
          workingDir: "%CONTAINER_SANDBOX_MOUNT_POINT%\\Program Files\\Amazon\\AmazonCloudWatchAgent"
          volumeMounts:
            - name: cwagentconfig
              mountPath: C:\Program Files\Amazon\AmazonCloudWatchAgent\cwagentconfig
          resources:
            limits:
              cpu:  400m
              memory: 400Mi
            requests:
              cpu: 400m
              memory: 400Mi
          imagePullPolicy: Always
          env:
            - name: HOST_IP
              valueFrom:
                fieldRef:
                  fieldPath: "status.hostIP"
            - name: HOST_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: K8S_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: CI_VERSION
              value: "k8s/1.3.20"
            - name: CWAGENT_LOG_LEVEL
              value: DEBUG
            - name: RUN_IN_CONTAINER
              value: "True"
            - name: RUN_AS_HOST_PROCESS_CONTAINER
              value: "True"
      nodeSelector:
        kubernetes.io/os: windows
      serviceAccountName: cloudwatch-agent
      volumes:
        - name: cwagentconfig
          configMap:
            name: cwagentconfig