Closed mateusz-kolecki-modivo closed 6 months ago
It looks like it was a problem with my setup. The modification time for the symlink is not changing but the function stat.ModTime()
seems to look at the symlink target and not the symlink itself. Closing.
Describe the bug When using
-varnish-vcl-template-poll=true
and the VCL template is mounted from aConfigMap
thenmtime
of the mounted file does not change after saving new content to theConfigMap
.I'm not sure if this is a Kubernetes distro-specific problem but I can reproduce this reliably on my local
k3d
setup withv1.27.4+k3s1
.It seems to be related to the issue described in 2016 in the Kubernetes issue tracker https://github.com/kubernetes/kubernetes/issues/24215 but it was closed without fixing. The fact that the problem was raised in the Kubernetes repo suggests it is a global issue and not distro-specific.
To Reproduce
k3d
managed cluster and use VCL polling (use-varnish-vcl-template-poll=true
)Expected behavior Template should be rendered and Varnish should be reloaded with a new VCL after 15s (at most).
Environment:
k3d
withv1.27.4+k3s1
v0.8.1
Configuration Any valid VCL
Additional context
pkg/watcher/template_watch_poll.go
will launch a new gorutine with an infinite loop. On each tick, the loop is usingos.Stat()
to getstat.ModTime()
. The path given to theos.Stat()
is actually a symlink to another symlink to the actual file. When theConfigMap
is saved then, themtime
of the file at the end of the symlink chain is updated but the first symlinkmtime
does not change.