Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
fileinstall-3.6.4
-
None
-
linux
Description
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.
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
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.
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
In this variant, the route is never detected. But intermediate and final are both detected and deployed as wrap:jardir:
mkdir final1 cp /routev1.xml /apache-karaf/deploy/final1/route.xml ln -s intermediate/route.xml route.xml ln -s final1 intermediate