Merge pull request #83 from MiaoZhou/fixEmptyCustomPath

prevent mounting of root directory
This commit is contained in:
Kubernetes Prow Robot 2021-04-01 22:16:11 -07:00 committed by GitHub
commit eae7143d98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -104,8 +104,10 @@ func (p *nfsProvisioner) Provision(ctx context.Context, options controller.Provi
pathPattern, exists := options.StorageClass.Parameters["pathPattern"] pathPattern, exists := options.StorageClass.Parameters["pathPattern"]
if exists { if exists {
customPath := metadata.stringParser(pathPattern) customPath := metadata.stringParser(pathPattern)
path = filepath.Join(p.path, customPath) if customPath != "" {
fullPath = filepath.Join(mountPath, customPath) path = filepath.Join(p.path, customPath)
fullPath = filepath.Join(mountPath, customPath)
}
} }
glog.V(4).Infof("creating path %s", fullPath) glog.V(4).Infof("creating path %s", fullPath)