Commit b8e20366 by zhoumiao

prevent mounting of root directory

If storageClass enable pathPattern like: `pathPattern: "${.PVC.annotations.nfs.io/storage-path}"` but pvc without annotation would make empty `customPath` and create a pv with nfs root path.
parent fab8b562
......@@ -104,8 +104,10 @@ func (p *nfsProvisioner) Provision(ctx context.Context, options controller.Provi
pathPattern, exists := options.StorageClass.Parameters["pathPattern"]
if exists {
customPath := metadata.stringParser(pathPattern)
path = filepath.Join(p.path, customPath)
fullPath = filepath.Join(mountPath, customPath)
if customPath != "" {
path = filepath.Join(p.path, customPath)
fullPath = filepath.Join(mountPath, customPath)
}
}
glog.V(4).Infof("creating path %s", fullPath)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment