apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: goldpinger-host
  namespace: default
spec:
  selector:
    matchLabels:
      app: goldpinger
      type: goldpinger-host
  template:
    metadata:
      labels:
        app: goldpinger
        type: goldpinger-host
    spec:
      tolerations:
        - effect: NoSchedule
          key: node-role.kubernetes.io/master
          operator: Exists
      hostNetwork: true
      serviceAccount: "goldpinger-serviceaccount"
      securityContext:
        runAsNonRoot: true
        runAsUser: 1000
        fsGroup: 2000
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 100
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: "app"
                  operator: In
                  values:
                  - goldpinger
              topologyKey: "kubernetes.io/hostname"
      containers:
        - name: goldpinger-vm
          env:
            - name: HOST
              value: "0.0.0.0"
            - name: PORT
              value: "8080"
            - name: HOSTNAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
#            - name: HOSTS_TO_RESOLVE
#              value: "1.1.1.1 8.8.8.8 www.bing.com"
          image: "docker.io/bloomberg/goldpinger:v3.3.0"
          securityContext:
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
          resources:
            limits:
              memory: 80Mi
            requests:
              cpu: 1m
              memory: 40Mi
          ports:
            - containerPort: 8080
              name: http
          readinessProbe:
            httpGet:
              path: /healthz
              port: 8080
            initialDelaySeconds: 5
            periodSeconds: 5
          livenessProbe:
            httpGet:
              path: /healthz
              port: 8080
            initialDelaySeconds: 5
            periodSeconds: 5
