deprecate containerized flag and remove nsenter

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2019-09-20 16:07:53 +05:30 committed by mergify[bot]
parent 69b7c4672f
commit 7002da1a6a
2 changed files with 7 additions and 14 deletions

View File

@ -59,7 +59,7 @@ func init() {
flag.BoolVar(&conf.IsNodeServer, "nodeserver", false, "start cephcsi node server")
// rbd related flags
flag.BoolVar(&conf.Containerized, "containerized", true, "whether run as containerized")
flag.BoolVar(&conf.Containerized, "containerized", false, "whether run as containerized")
// cephfs related flags
flag.StringVar(&conf.MountCacheDir, "mountcachedir", "", "mount info cache save dir")
@ -159,6 +159,9 @@ func main() {
switch conf.Vtype {
case rbdType:
driver := rbd.NewDriver()
if conf.Containerized {
klog.Warning("containerized flag is deprecated and will be removed")
}
driver.Run(&conf, cp)
case cephfsType:

View File

@ -23,9 +23,6 @@ import (
"github.com/container-storage-interface/spec/lib/go/csi"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/util/mount"
nsutil "k8s.io/kubernetes/pkg/volume/util/nsenter"
"k8s.io/utils/exec"
"k8s.io/utils/nsenter"
)
const (
@ -80,15 +77,8 @@ func NewControllerServer(d *csicommon.CSIDriver, cachePersister util.CachePersis
}
// NewNodeServer initialize a node server for rbd CSI driver.
func NewNodeServer(d *csicommon.CSIDriver, containerized bool, t string) (*NodeServer, error) {
func NewNodeServer(d *csicommon.CSIDriver, t string) (*NodeServer, error) {
mounter := mount.New("")
if containerized {
ne, err := nsenter.NewNsenter(nsenter.DefaultHostRootFsPath, exec.New())
if err != nil {
return nil, err
}
mounter = nsutil.NewMounter("", ne)
}
return &NodeServer{
DefaultNodeServer: csicommon.NewDefaultNodeServer(d, t),
mounter: mounter,
@ -143,7 +133,7 @@ func (r *Driver) Run(conf *util.Config, cachePersister util.CachePersister) {
r.ids = NewIdentityServer(r.cd)
if conf.IsNodeServer {
r.ns, err = NewNodeServer(r.cd, conf.Containerized, conf.Vtype)
r.ns, err = NewNodeServer(r.cd, conf.Vtype)
if err != nil {
klog.Fatalf("failed to start node server, err %v\n", err)
}
@ -153,7 +143,7 @@ func (r *Driver) Run(conf *util.Config, cachePersister util.CachePersister) {
r.cs = NewControllerServer(r.cd, cachePersister)
}
if !conf.IsControllerServer && !conf.IsNodeServer {
r.ns, err = NewNodeServer(r.cd, conf.Containerized, conf.Vtype)
r.ns, err = NewNodeServer(r.cd, conf.Vtype)
if err != nil {
klog.Fatalf("failed to start node server, err %v\n", err)
}