nfs: enable NFS-provisioner with --type=nfs

Deployments can use --type=nfs to deploy the NFS Controller Server
(provisioner).

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2022-03-17 10:26:17 +01:00 committed by mergify[bot]
parent 6d83df9cc9
commit 3d0c4e0659

View File

@ -27,6 +27,7 @@ import (
"github.com/ceph/ceph-csi/internal/controller" "github.com/ceph/ceph-csi/internal/controller"
"github.com/ceph/ceph-csi/internal/controller/persistentvolume" "github.com/ceph/ceph-csi/internal/controller/persistentvolume"
"github.com/ceph/ceph-csi/internal/liveness" "github.com/ceph/ceph-csi/internal/liveness"
nfsdriver "github.com/ceph/ceph-csi/internal/nfs/driver"
rbddriver "github.com/ceph/ceph-csi/internal/rbd/driver" rbddriver "github.com/ceph/ceph-csi/internal/rbd/driver"
"github.com/ceph/ceph-csi/internal/util" "github.com/ceph/ceph-csi/internal/util"
"github.com/ceph/ceph-csi/internal/util/log" "github.com/ceph/ceph-csi/internal/util/log"
@ -37,11 +38,13 @@ import (
const ( const (
rbdType = "rbd" rbdType = "rbd"
cephFSType = "cephfs" cephFSType = "cephfs"
nfsType = "nfs"
livenessType = "liveness" livenessType = "liveness"
controllerType = "controller" controllerType = "controller"
rbdDefaultName = "rbd.csi.ceph.com" rbdDefaultName = "rbd.csi.ceph.com"
cephFSDefaultName = "cephfs.csi.ceph.com" cephFSDefaultName = "cephfs.csi.ceph.com"
nfsDefaultName = "nfs.csi.ceph.com"
livenessDefaultName = "liveness.csi.ceph.com" livenessDefaultName = "liveness.csi.ceph.com"
pollTime = 60 // seconds pollTime = 60 // seconds
@ -58,7 +61,7 @@ var conf util.Config
func init() { func init() {
// common flags // common flags
flag.StringVar(&conf.Vtype, "type", "", "driver type [rbd|cephfs|liveness|controller]") flag.StringVar(&conf.Vtype, "type", "", "driver type [rbd|cephfs|nfs|liveness|controller]")
flag.StringVar(&conf.Endpoint, "endpoint", "unix:///tmp/csi.sock", "CSI endpoint") flag.StringVar(&conf.Endpoint, "endpoint", "unix:///tmp/csi.sock", "CSI endpoint")
flag.StringVar(&conf.DriverName, "drivername", "", "name of the driver") flag.StringVar(&conf.DriverName, "drivername", "", "name of the driver")
flag.StringVar(&conf.DriverNamespace, "drivernamespace", defaultNS, "namespace in which driver is deployed") flag.StringVar(&conf.DriverNamespace, "drivernamespace", defaultNS, "namespace in which driver is deployed")
@ -149,6 +152,8 @@ func getDriverName() string {
return rbdDefaultName return rbdDefaultName
case cephFSType: case cephFSType:
return cephFSDefaultName return cephFSDefaultName
case nfsType:
return nfsDefaultName
case livenessType: case livenessType:
return livenessDefaultName return livenessDefaultName
default: default:
@ -233,6 +238,10 @@ func main() {
driver := cephfs.NewDriver() driver := cephfs.NewDriver()
driver.Run(&conf) driver.Run(&conf)
case nfsType:
driver := nfsdriver.NewDriver()
driver.Run(&conf)
case livenessType: case livenessType:
liveness.Run(&conf) liveness.Run(&conf)