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.
This commit is contained in:
parent
fab8b5623e
commit
b8e203661b
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue