k3s/pkg/util
Kubernetes Submit Queue 009858f18d Merge pull request #48555 from redbaron/hostPath-and-subPath-symlink
Automatic merge from submit-queue

Fix subPath existence check to not follow symlink

**What this PR does / why we need it**:
Volume mounting logic introduced in #43775 and #45623 checks
for subPath existence before attempting to create a directory,
should subPath not be present.

This breaks if subPath is a dangling symlink, os.Stat returns
"do not exist" status, yet `os.MkdirAll` can't create directory
as symlink is present at the given path.

This patch makes existence check to use os.Lstat which works for
normal files/directories as well as doesn't not attempt to follow
symlink, therefore it's "do not exist" status is more reliable when
making a decision whether to create directory or not.

subPath symlinks can be dangling in situations where kubelet is
running in a container itself with access to docker socket, such
as CoreOS's kubelet-wrapper script

**Release note**:
```release-note
Fix pods failing to start when subPath is a dangling symlink from kubelet point of view, which can happen if it is running inside a container
```
2017-07-12 23:43:12 -07:00
..
async Make BoundedFrequencyRunner Run() really non-blocking 2017-05-25 16:12:16 +02:00
bandwidth IPv6 support for hexCIDR() 2017-05-17 20:35:37 +00:00
config
configz
dbus
ebtables Fix ebtables_test.go to actually get run, and to pass 2017-06-27 09:26:10 -04:00
env
exec Remove Save() from iptables interface 2017-05-22 13:23:49 +02:00
flock
goroutinemap
hash
i18n remove unused codes in loadSystemLanguage 2017-06-29 12:18:11 +08:00
initsystem
interrupt
io Fix lint errors 2017-06-26 16:05:35 +02:00
ipconfig
iptables expose lock release error from iptables util 2017-07-05 14:31:24 -07:00
keymutex
labels
limitwriter
logs
maps
metrics
mount Fixes bind-mount teardown failure with non-mount point Local volumes 2017-07-11 17:19:58 -04:00
net Fix lint errors of pkg/util/net/sets/ipnet.go 2017-07-04 12:04:24 +08:00
netsh
node Merge pull request #47242 from k82cn/make_golint_happy 2017-06-26 20:02:40 -07:00
oom
parsers
procfs Merge pull request #44024 from zhangxiaoyu-zidif/egnew 2017-05-05 23:41:33 -07:00
removeall Fixes bind-mount teardown failure with non-mount point Local volumes 2017-07-11 17:19:58 -04:00
resourcecontainer
rlimit
selinux
slice split util/slice 2017-06-30 23:04:18 -07:00
strings
sysctl Consolidate sysctl commands for kubelet 2017-05-02 12:15:01 -07:00
system run hack/update-all 2017-06-22 11:31:03 -07:00
tail
taints run hack/update-all 2017-06-22 11:31:03 -07:00
term fix cross build for windows 2017-07-05 12:42:41 -07:00
threading
tolerations
version
workqueue/prometheus
BUILD Merge pull request #48410 from xiangpengzhao/remove-empty-util-dir 2017-07-07 23:53:34 -07:00
doc.go
template.go
template_test.go
util.go Fix subPath existence check to not follow symlink 2017-07-07 11:52:16 +01:00
util_test.go