提交 f64234b1 编写于 作者: Y yuvipanda 提交者: dlorenc

Set umask to 0 before creating hostpath volumes

上级 023aea13
......@@ -20,6 +20,7 @@ import (
"fmt"
"os"
"path"
"syscall"
"time"
"github.com/golang/glog"
......@@ -69,6 +70,10 @@ var _ controller.Provisioner = &hostPathProvisioner{}
func (p *hostPathProvisioner) Provision(options controller.VolumeOptions) (*v1.PersistentVolume, error) {
path := path.Join(p.pvDir, options.PVName)
// Drop our umask to 0 temporarily, so we can actually create the hostpath directory as 0777
// Otherwise it just gets created as 0755, since default umask is 022
oldMask := syscall.Umask(0)
defer syscall.Umask(oldMask)
if err := os.MkdirAll(path, 0777); err != nil {
return nil, err
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册