Do not skip /run when counting the size (#538)

This commit is contained in:
Itxaka 2024-09-13 17:31:40 +02:00 committed by GitHub
parent 7c6c195bd5
commit a6bf3541c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -826,12 +826,11 @@ func GetSourceSize(config *Config, source *v1.ImageSource) (int64, error) {
hostDir = "/host"
}
err = fsutils.WalkDirFs(config.Fs, source.Value(), func(path string, d fs.DirEntry, err error) error {
// If its empty we are just not setting it, so probably out of the k8s upgrade path
if hostDir != "" && strings.HasPrefix(path, hostDir) {
config.Logger.Logger.Debug().Str("path", path).Str("hostDir", hostDir).Msg("Skipping file as it is a host directory")
} else if strings.HasPrefix(path, "/proc") || strings.HasPrefix(path, "/dev") || strings.HasPrefix(path, "/run") {
config.Logger.Logger.Debug().Str("path", path).Str("hostDir", hostDir).Msg("Skipping dir as it is a system directory (/proc, /dev or /run)")
} else if strings.HasPrefix(path, "/proc") || strings.HasPrefix(path, "/dev") {
config.Logger.Logger.Debug().Str("path", path).Str("hostDir", hostDir).Msg("Skipping dir as it is a runtime directory (/proc or /dev)")
} else {
v := getSize(&size, filesVisited, path, d, err)
return v