---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: toy

spec:
  selector:
    matchLabels:
      aikido: toy
  template:
    metadata:
      labels:
        aikido: toy
    spec:
      tolerations:
        - key: node-role.kubernetes.io/master
          effect: NoSchedule
        - key: node-role.kubernetes.io/master
          operator: Equal
          value: "true"
          effect: NoSchedule

      initContainers:
        - name: init
          image: alpine
          command:
            - /bin/sh
            - -xc
            - |
              (echo -n "hi, my name is: "; hostname)> /host/etc/hi-from-the-pod \
              && echo done \
              && ls -l /host/etc/hi-from-the-pod \
              && cat /host/etc/hi-from-the-pod
          volumeMounts:
            - name: hostfs
              mountPath: /host

      containers:
        - name: sleep
          image: filefrog/k8s-hacks:pause

      volumes:
        - name: hostfs
          hostPath:
            path: /
