mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-14 02:10:21 +00:00
deprecate containerized flag and remove nsenter
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
(cherry picked from commit d2fd76a9a5
)
This commit is contained in:
parent
64fd06825a
commit
74852cf230
@ -59,7 +59,7 @@ func init() {
|
|||||||
flag.BoolVar(&conf.IsNodeServer, "nodeserver", false, "start cephcsi node server")
|
flag.BoolVar(&conf.IsNodeServer, "nodeserver", false, "start cephcsi node server")
|
||||||
|
|
||||||
// rbd related flags
|
// 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
|
// cephfs related flags
|
||||||
flag.StringVar(&conf.MountCacheDir, "mountcachedir", "", "mount info cache save dir")
|
flag.StringVar(&conf.MountCacheDir, "mountcachedir", "", "mount info cache save dir")
|
||||||
@ -159,6 +159,9 @@ func main() {
|
|||||||
switch conf.Vtype {
|
switch conf.Vtype {
|
||||||
case rbdType:
|
case rbdType:
|
||||||
driver := rbd.NewDriver()
|
driver := rbd.NewDriver()
|
||||||
|
if conf.Containerized {
|
||||||
|
klog.Warning("containerized flag is deprecated and will be removed")
|
||||||
|
}
|
||||||
driver.Run(&conf, cp)
|
driver.Run(&conf, cp)
|
||||||
|
|
||||||
case cephfsType:
|
case cephfsType:
|
||||||
|
@ -23,9 +23,6 @@ import (
|
|||||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
"k8s.io/kubernetes/pkg/util/mount"
|
"k8s.io/kubernetes/pkg/util/mount"
|
||||||
nsutil "k8s.io/kubernetes/pkg/volume/util/nsenter"
|
|
||||||
"k8s.io/utils/exec"
|
|
||||||
"k8s.io/utils/nsenter"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -80,15 +77,8 @@ func NewControllerServer(d *csicommon.CSIDriver, cachePersister util.CachePersis
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewNodeServer initialize a node server for rbd CSI driver.
|
// 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("")
|
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{
|
return &NodeServer{
|
||||||
DefaultNodeServer: csicommon.NewDefaultNodeServer(d, t),
|
DefaultNodeServer: csicommon.NewDefaultNodeServer(d, t),
|
||||||
mounter: mounter,
|
mounter: mounter,
|
||||||
@ -143,7 +133,7 @@ func (r *Driver) Run(conf *util.Config, cachePersister util.CachePersister) {
|
|||||||
r.ids = NewIdentityServer(r.cd)
|
r.ids = NewIdentityServer(r.cd)
|
||||||
|
|
||||||
if conf.IsNodeServer {
|
if conf.IsNodeServer {
|
||||||
r.ns, err = NewNodeServer(r.cd, conf.Containerized, conf.Vtype)
|
r.ns, err = NewNodeServer(r.cd, conf.Vtype)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Fatalf("failed to start node server, err %v\n", err)
|
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)
|
r.cs = NewControllerServer(r.cd, cachePersister)
|
||||||
}
|
}
|
||||||
if !conf.IsControllerServer && !conf.IsNodeServer {
|
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 {
|
if err != nil {
|
||||||
klog.Fatalf("failed to start node server, err %v\n", err)
|
klog.Fatalf("failed to start node server, err %v\n", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user