---
# Source: splunk-otel-collector/templates/daemonset.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: default-splunk-otel-collector-agent
  labels:
    app: splunk-otel-collector
    chart: splunk-otel-collector-0.24.13
    release: default
    heritage: Helm
    engine: fluentd
spec:
  updateStrategy:
    type: RollingUpdate
  selector:
    matchLabels:
      app: splunk-otel-collector
      release: default
  template:
    metadata:
      labels:
        app: splunk-otel-collector
        release: default
      annotations:
        checksum/config: 6f79c8a23110b91d61a32b20c8c257104b7cd48e627fb31e9c942e6a1f96d789
    spec:
      hostNetwork: true
      dnsPolicy: ClusterFirstWithHostNet
      serviceAccountName: default-splunk-otel-collector
      tolerations:
        
        - effect: NoSchedule
          key: node-role.kubernetes.io/master
      containers:
      - name: fluentd
        image: splunk/fluentd-hec:1.2.4
        imagePullPolicy: IfNotPresent
        securityContext:
          
          runAsUser: 0
        env:
          - name: SPLUNK_MEMORY_TOTAL_MIB
            value: "500"
          - name: K8S_NODE_NAME
            valueFrom:
              fieldRef:
                fieldPath: spec.nodeName
          - name: MY_NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace
          - name: MY_POD_NAME
            valueFrom:
              fieldRef:
                fieldPath: metadata.name
          - name: SPLUNK_HEC_TOKEN
            valueFrom:
              secretKeyRef:
                name: splunk-otel-collector
                key: splunk_hec_token
        resources:
          limits:
            cpu: 500m
            memory: 500Mi
          requests:
            cpu: 100m
            memory: 200Mi
        volumeMounts:
        - name: varlog
          mountPath: /var/log
        - name: varlogdest
          mountPath: /var/lib/docker/containers
          readOnly: true
        - name: journallogpath
          mountPath: "/run/log/journal"
          readOnly: true
        - name: fluentd-configmap
          mountPath: /fluentd/etc
        - name: secrets
          mountPath: /fluentd/etc/splunk
          readOnly: true
      - name: otel-collector
        command:
        - /otelcol
        - --config=/conf/relay.yaml
        - --metrics-addr=0.0.0.0:8888
        ports:
        - name: fluentforward
          containerPort: 8006
          hostPort: 8006
          protocol: TCP
        - name: jaeger-grpc
          containerPort: 14250
          hostPort: 14250
          protocol: TCP
        - name: jaeger-thrift
          containerPort: 14268
          hostPort: 14268
          protocol: TCP
        - name: otlp
          containerPort: 4317
          hostPort: 4317
          protocol: TCP
        - name: sfx-forwarder
          containerPort: 9080
          hostPort: 9080
          protocol: TCP
        - name: zipkin
          containerPort: 9411
          hostPort: 9411
          protocol: TCP
        image: quay.io/signalfx/splunk-otel-collector:0.24.3
        imagePullPolicy: IfNotPresent
        env:
          - name: K8S_NODE_NAME
            valueFrom:
              fieldRef:
                fieldPath: spec.nodeName
          - name: K8S_NODE_IP
            valueFrom:
              fieldRef:
                apiVersion: v1
                fieldPath: status.hostIP
          - name: K8S_POD_IP
            valueFrom:
              fieldRef:
                apiVersion: v1
                fieldPath: status.podIP
          - name: K8S_POD_NAME
            valueFrom:
              fieldRef:
                fieldPath: metadata.name
          - name: K8S_POD_UID
            valueFrom:
              fieldRef:
                fieldPath: metadata.uid
          - name: K8S_NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace
          - name: SPLUNK_ACCESS_TOKEN
            valueFrom:
              secretKeyRef:
                name: splunk-otel-collector
                key: splunk_access_token
          # Env variables for host metrics receiver
          - name: HOST_PROC
            value: /hostfs/proc
          - name: HOST_SYS
            value: /hostfs/sys
          - name: HOST_ETC
            value: /hostfs/etc
          - name: HOST_VAR
            value: /hostfs/var
          - name: HOST_RUN
            value: /hostfs/run
          - name: HOST_DEV
            value: /hostfs/dev
        readinessProbe:
          httpGet:
            path: /
            port: 13133
        livenessProbe:
          httpGet:
            path: /
            port: 13133
        resources:
          limits:
            cpu: 200m
            memory: 500Mi
        volumeMounts:
        - mountPath: /conf
          name: otel-configmap
        - mountPath: /hostfs
          name: hostfs
          readOnly: true
          mountPropagation: HostToContainer
      terminationGracePeriodSeconds: 600
      volumes:
      - name: varlog
        hostPath:
          path: /var/log
      - name: varlogdest
        hostPath:
          path: /var/lib/docker/containers
      - name: journallogpath
        hostPath:
          path: "/run/log/journal"
      - name: secrets
        secret:
          secretName: splunk-otel-collector
      - name: fluentd-configmap
        configMap:
          name: default-splunk-otel-collector-fluentd
      - name: hostfs
        hostPath:
          path: /
      - name: otel-configmap
        configMap:
          name: default-splunk-otel-collector-otel-agent
          items:
            - key: relay
              path: relay.yaml
