# This file has been generated by `helm template datadog-agent datadog/datadog` from datadog/templates/cluster-agent-deployment.yaml. Please re-run `generate.sh` rather than modifying this file manually.
apiVersion: apps/v1
kind: Deployment
metadata:
  name: datadog-cluster-agent
  labels: {}
spec:
  replicas: 1
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  selector:
    matchLabels:
      app: datadog-cluster-agent
  template:
    metadata:
      labels:
        app: datadog-cluster-agent
      name: datadog-cluster-agent
      annotations:
        ad.datadoghq.com/cluster-agent.check_names: '["prometheus"]'
        ad.datadoghq.com/cluster-agent.init_configs: '[{}]'
        ad.datadoghq.com/cluster-agent.instances: |
          [{
            "prometheus_url": "http://%%host%%:5000/metrics",
            "namespace": "datadog.cluster_agent",
            "metrics": [
              "go_goroutines", "go_memstats_*", "process_*",
              "api_requests",
              "datadog_requests", "external_metrics", "rate_limit_queries_*",
              "cluster_checks_*"
            ]
          }]
    spec:
      serviceAccountName: datadog-cluster-agent
      containers:
        - name: cluster-agent
          image: "datadog/cluster-agent:1.7.0"
          imagePullPolicy: IfNotPresent
          resources: {}
          ports:
            - containerPort: 5005
              name: agentport
              protocol: TCP
            - containerPort: 8443
              name: metricsapi
              protocol: TCP
          env:
            - name: DD_HEALTH_PORT
              value: "5555"
            - name: DD_API_KEY
              valueFrom:
                secretKeyRef:
                  name: "datadog"
                  key: api-key
                  optional: true
            - name: DD_APP_KEY
              valueFrom:
                secretKeyRef:
                  name: "datadog-appkey"
                  key: app-key
            - name: DD_EXTERNAL_METRICS_PROVIDER_ENABLED
              value: "true"
            - name: DD_EXTERNAL_METRICS_PROVIDER_PORT
              value: "8443"
            - name: DD_EXTERNAL_METRICS_PROVIDER_WPA_CONTROLLER
              value: "false"
            - name: DD_EXTERNAL_METRICS_PROVIDER_USE_DATADOGMETRIC_CRD
              value: "false"
            - name: DD_CLUSTER_CHECKS_ENABLED
              value: "true"
            - name: DD_EXTRA_CONFIG_PROVIDERS
              value: "kube_endpoints kube_services"
            - name: DD_EXTRA_LISTENERS
              value: "kube_endpoints kube_services"
            - name: DD_LOG_LEVEL
              value: "INFO"
            - name: DD_LEADER_ELECTION
              value: "true"
            - name: DD_LEADER_LEASE_DURATION
              value: "15"
            - name: DD_CLUSTER_AGENT_KUBERNETES_SERVICE_NAME
              value: datadog-cluster-agent
            - name: DD_CLUSTER_AGENT_AUTH_TOKEN
              valueFrom:
                secretKeyRef:
                  name: datadog-cluster-agent
                  key: token
            - name: DD_KUBE_RESOURCES_NAMESPACE
              value: default
          livenessProbe:
            failureThreshold: 6
            httpGet:
              path: /live
              port: 5555
              scheme: HTTP
            initialDelaySeconds: 15
            periodSeconds: 15
            successThreshold: 1
            timeoutSeconds: 5
          readinessProbe:
            failureThreshold: 6
            httpGet:
              path: /ready
              port: 5555
              scheme: HTTP
            initialDelaySeconds: 15
            periodSeconds: 15
            successThreshold: 1
            timeoutSeconds: 5
          volumeMounts:
            - name: installinfo
              subPath: install_info
              mountPath: /etc/datadog-agent/install_info
              readOnly: true
      volumes:
        - name: installinfo
          configMap:
            name: datadog-installinfo
      nodeSelector:
        kubernetes.io/os: linux
