[
https://issues.apache.org/jira/browse/FELIX-6229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17345037#comment-17345037
]
Raymond Augé commented on FELIX-6229:
-------------------------------------
So, there is a clear limitation to the inotify based approach when it comes to
externally mounted file systems.
Here's a detailed explanation of the issue
https://blog.arkey.fr/2019/09/13/watchservice-and-bind-mount/
However, there is one benefit that we can extract from our existing
implementation which I believe helps to provide a suitable workaround. That is
that the watcher is at least aware that something _did_ happen. We simply
cannot tell what it was.
However, taking advantage of the poll loop, if we see that something did in
fact happen AND we have no clearly affected files we simply re-validate any
known files against their checksums. If any don't match we know they were
modified so we add them to the modified set.
> Not compatible with the symlinks Kubernetes uses to mount ConfigMaps
> --------------------------------------------------------------------
>
> Key: FELIX-6229
> URL: https://issues.apache.org/jira/browse/FELIX-6229
> Project: Felix
> Issue Type: Bug
> Components: File Install
> Affects Versions: fileinstall-3.6.4
> Environment: linux
> Reporter: Lars Benedetto
> Assignee: Raymond Augé
> Priority: Major
> Fix For: fileinstall-3.7.0
>
>
> I am trying to deploy xml blueprint files in Karaf by using Kubernetes to
> mount a ConfigMap as a file inside Karafs deploy folder. Unfortunately, K8s
> doesn't just put the file in the deploy folder.
>
> {code:java}
> root@/apache-karaf/deploy# ls -al
> total 0
> drwxrwxrwx 3 root root 151 Feb 26 04:20 .
> drwxr-xr-x 1 root root 64 Feb 25 05:49 ..
> drwxr-xr-x 2 root root 98 Feb 26 04:20 ..2020_02_26_04_20_14.044787912
> lrwxrwxrwx 1 root root 31 Feb 26 04:20 ..data ->
> ..2020_02_26_04_20_14.044787912
> lrwxrwxrwx 1 root root 45 Feb 26 04:13 route.xml -> ..data/route.xml{code}
> K8s creates a chain of symlinks. This works at first, because Felix detects
> the creation of the symlink from route.xml -> data/route.xml, and follows the
> symlinks through to get to the actual file.
> But when K8s comes in to update with a new version of the route, it creates a
> new timestamped directory, and then updates the intermediate symlink from
> data -> timestamp.
>
> Felix detects this as well, but only partially. It deploys the new timestamp
> dir with {{wrap:jardir:}} and the new symlink to the timestamp dir as
> {{wrap:jardir:}} as well. But it does not reload the route.
>
> Steps to reproduce:
> In this variant, intermediate and final are detected and deployed as
> \{{wrap:jardir: }}and the route is detected and deployed correctly, but
> subsequent changes to the route are not.
>
> {code:java}
> mkdir final1
> cp /routev1.xml /apache-karaf/deploy/final1/route.xml
> ln -s final1 intermediate
> ln -s intermediate/route.xml route.xml
> # And then to mimic k8s switching to the new file
> mkdir final2
> cp /routev2.xml /apache-karaf/deploy/final2/route.xml
> rm intermediate
> ln -s final2 intermediate
> {code}
> In this variant, the route is never detected. But intermediate and final are
> both detected and deployed as {{wrap:jardir:}}
>
> {code:java}
> mkdir final1
> cp /routev1.xml /apache-karaf/deploy/final1/route.xml
> ln -s intermediate/route.xml route.xml
> ln -s final1 intermediate{code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)