#cloud-config
#
# This cloud-init configuration file disables Docker live-restore.

runcmd:
  - cp /usr/lib/systemd/system/docker.service /etc/systemd/system/docker.service
  - sed -i '/^ExecStart=\/usr\/bin\/dockerd/ s/$/ --live-restore=false/' /etc/systemd/system/docker.service
  - systemctl daemon-reload
  - systemctl restart docker
  - mount /tmp /tmp -o remount,exec,suid
  - usermod -a -G docker jenkins
  - mkdir -p /var/lib/kubelet
  - mkdir -p /home/kubernetes/containerized_mounter/rootfs
  - mount --bind /home/kubernetes/containerized_mounter/ /home/kubernetes/containerized_mounter/
  - mount -o remount, exec /home/kubernetes/containerized_mounter/
  - wget https://dl.k8s.io/gci-mounter/mounter.tar -O /tmp/mounter.tar
  - tar xvf /tmp/mounter.tar -C /home/kubernetes/containerized_mounter/rootfs
  - mkdir -p /home/kubernetes/containerized_mounter/rootfs/var/lib/kubelet
  - mount --rbind /var/lib/kubelet /home/kubernetes/containerized_mounter/rootfs/var/lib/kubelet
  - mount --make-rshared /home/kubernetes/containerized_mounter/rootfs/var/lib/kubelet
  - mount --bind /proc /home/kubernetes/containerized_mounter/rootfs/proc
  - mount --bind /dev /home/kubernetes/containerized_mounter/rootfs/dev
  - rm /tmp/mounter.tar
