---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: splunk-kubernetes-metrics-agg
  labels:
    app: splunk-kubernetes-metrics
    component: aggregator
    version: 1.4.14
spec:
  strategy:
    type: RollingUpdate
  replicas: 1
  selector:
    matchLabels:
      app: splunk-kubernetes-metrics
      component: aggregator
  template:
    metadata:
      labels:
        app: splunk-kubernetes-metrics
        component: aggregator
        version: 1.4.14
      annotations:
        scheduler.alpha.kubernetes.io/critical-pod: ''
    spec:
      serviceAccountName: splunk-kubernetes-metrics
      nodeSelector:
        beta.kubernetes.io/os: linux
      containers:
      - name: splunk-fluentd-k8s-metrics-agg
        image: docker.io/splunk/k8s-metrics-aggr:1.1.11
        imagePullPolicy: IfNotPresent
        env:
        - name: SPLUNK_HEC_TOKEN
          valueFrom:
            secretKeyRef:
              name: splunk-kubernetes-metrics
              key: splunk_hec_token
        - name: NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        - name: MY_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: MY_POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        resources:
          limits:
            cpu: 200m
            memory: 300Mi
          requests:
            cpu: 200m
            memory: 300Mi
        securityContext:
          runAsNonRoot: false
        volumeMounts:
        - name: conf-configmap
          mountPath: "/fluentd/etc"
        - name: secrets
          mountPath: "/fluentd/etc/splunk"
          readOnly: true
        livenessProbe:
          httpGet:
            path: "/api/plugins.json"
            port: 24220
          initialDelaySeconds: 60
          periodSeconds: 60
      volumes:
      - name: conf-configmap
        configMap:
          name: splunk-kubernetes-metrics-aggregator
      - name: secrets
        secret:
          secretName: splunk-kubernetes-metrics
