Skip to content

Commit e636b53

Browse files
committed
Follow directory symlinks in auto deploying manifests (#9288)
Signed-off-by: Robert Rose <[email protected]>
1 parent 0981f00 commit e636b53

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pkg/deploy/controller.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,26 @@ func (w *watcher) listFilesIn(base string, force bool) error {
119119
if err != nil {
120120
return err
121121
}
122+
// Descend into symlinked directories, however, only top-level links are followed
123+
if info.Mode()&os.ModeSymlink != 0 {
124+
linkInfo, err := os.Stat(path)
125+
if err != nil {
126+
return err
127+
}
128+
if linkInfo.IsDir() {
129+
evalPath, err := filepath.EvalSymlinks(path)
130+
if err != nil {
131+
return err
132+
}
133+
filepath.Walk(evalPath, func(path string, info os.FileInfo, err error) error {
134+
if err != nil {
135+
return err
136+
}
137+
files[path] = info
138+
return nil
139+
})
140+
}
141+
}
122142
files[path] = info
123143
return nil
124144
}); err != nil {

0 commit comments

Comments
 (0)