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,9 +104,11 @@ func (p *nfsProvisioner) Provision(ctx context.Context, options controller.Provi
pathPattern, exists := options.StorageClass.Parameters["pathPattern"]
if exists {
customPath := metadata.stringParser(pathPattern)
if customPath != "" {
path = filepath.Join(p.path, customPath)
fullPath = filepath.Join(mountPath, customPath)
}
}
glog.V(4).Infof("creating path %s", fullPath)
if err := os.MkdirAll(fullPath, 0777); err != nil {