This is a workaround for kubernetes/kubernetes#52172. This code was copied from kubernetes/kubernetes#52172 (comment) and written originally by Chris Jones (@cjyar).
This script sets up symlinks from files in containers to host node files correctly in case kubelet does not create them successfully, which seems to happen when containers take a long time to start up due to heavy initial I/O load (see https://github.com/sourcegraph/infrastructure/pull/415). This has been observed to affect some Sourcegraph Data Center instances where the persistent volumes are large (100s of GB). The underlying issue may be fixed in Kubernetes at some point, at which point this script will become unnecessary.
Usage: kubectl apply daemonset.yaml