• Kubernetes Submit Queue's avatar
    Merge pull request #48555 from redbaron/hostPath-and-subPath-symlink · 009858f1
    Kubernetes Submit Queue authored
    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
    ```
    009858f1
Name
Last commit
Last update
..
async Loading commit data...
bandwidth Loading commit data...
config Loading commit data...
configz Loading commit data...
dbus Loading commit data...
ebtables Loading commit data...
env Loading commit data...
exec Loading commit data...
flock Loading commit data...
goroutinemap Loading commit data...
hash Loading commit data...
i18n Loading commit data...
initsystem Loading commit data...
interrupt Loading commit data...
io Loading commit data...
ipconfig Loading commit data...
iptables Loading commit data...
keymutex Loading commit data...
labels Loading commit data...
limitwriter Loading commit data...
logs Loading commit data...
maps Loading commit data...
metrics Loading commit data...
mount Loading commit data...
net Loading commit data...
netsh Loading commit data...
node Loading commit data...
oom Loading commit data...
parsers Loading commit data...
procfs Loading commit data...
removeall Loading commit data...
resourcecontainer Loading commit data...
rlimit Loading commit data...
selinux Loading commit data...
slice Loading commit data...
strings Loading commit data...
sysctl Loading commit data...
system Loading commit data...
tail Loading commit data...
taints Loading commit data...
term Loading commit data...
threading Loading commit data...
tolerations Loading commit data...
version Loading commit data...
workqueue/prometheus Loading commit data...
BUILD Loading commit data...
doc.go Loading commit data...
template.go Loading commit data...
template_test.go Loading commit data...
util.go Loading commit data...
util_test.go Loading commit data...