mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +00:00
rbd: add controller to main
initialize and start the rbd controller when we the driver type is controller. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
68bd44beba
commit
30af703a2f
@ -24,6 +24,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/ceph/ceph-csi/internal/cephfs"
|
||||
"github.com/ceph/ceph-csi/internal/controller"
|
||||
"github.com/ceph/ceph-csi/internal/controller/persistentvolume"
|
||||
"github.com/ceph/ceph-csi/internal/liveness"
|
||||
"github.com/ceph/ceph-csi/internal/rbd"
|
||||
"github.com/ceph/ceph-csi/internal/util"
|
||||
@ -35,6 +37,7 @@ const (
|
||||
rbdType = "rbd"
|
||||
cephfsType = "cephfs"
|
||||
livenessType = "liveness"
|
||||
controllerType = "controller"
|
||||
|
||||
rbdDefaultName = "rbd.csi.ceph.com"
|
||||
cephfsDefaultName = "cephfs.csi.ceph.com"
|
||||
@ -42,6 +45,9 @@ const (
|
||||
|
||||
pollTime = 60 // seconds
|
||||
probeTimeout = 3 // seconds
|
||||
|
||||
// use default namespace if namespace is not set
|
||||
defaultNS = "default"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -50,9 +56,10 @@ var (
|
||||
|
||||
func init() {
|
||||
// common flags
|
||||
flag.StringVar(&conf.Vtype, "type", "", "driver type [rbd|cephfs|liveness]")
|
||||
flag.StringVar(&conf.Vtype, "type", "", "driver type [rbd|cephfs|liveness|controller]")
|
||||
flag.StringVar(&conf.Endpoint, "endpoint", "unix://tmp/csi.sock", "CSI endpoint")
|
||||
flag.StringVar(&conf.DriverName, "drivername", "", "name of the driver")
|
||||
flag.StringVar(&conf.DriverNamespace, "drivernamespace", defaultNS, "namespace in which driver is deployed")
|
||||
flag.StringVar(&conf.NodeID, "nodeid", "", "node id")
|
||||
flag.StringVar(&conf.InstanceID, "instanceid", "", "Unique ID distinguishing this instance of Ceph CSI among other"+
|
||||
" instances, when sharing Ceph clusters across CSI instances for provisioning")
|
||||
@ -181,11 +188,29 @@ func main() {
|
||||
|
||||
case livenessType:
|
||||
liveness.Run(&conf)
|
||||
|
||||
case controllerType:
|
||||
cfg := controller.Config{
|
||||
DriverName: dname,
|
||||
Namespace: conf.DriverNamespace,
|
||||
}
|
||||
// initialize all controllers before starting.
|
||||
initControllers()
|
||||
err = controller.Start(cfg)
|
||||
if err != nil {
|
||||
logAndExit(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
// initControllers will initialize all the controllers.
|
||||
func initControllers() {
|
||||
// Add list of controller here.
|
||||
persistentvolume.Init()
|
||||
}
|
||||
|
||||
func validateCloneDepthFlag(conf *util.Config) {
|
||||
// keeping hardlimit to 14 as max to avoid max image depth
|
||||
if conf.RbdHardMaxCloneDepth == 0 || conf.RbdHardMaxCloneDepth > 14 {
|
||||
|
@ -68,9 +68,10 @@ var (
|
||||
|
||||
// Config holds the parameters list which can be configured.
|
||||
type Config struct {
|
||||
Vtype string // driver type [rbd|cephfs|liveness]
|
||||
Vtype string // driver type [rbd|cephfs|liveness|controller]
|
||||
Endpoint string // CSI endpoint
|
||||
DriverName string // name of the driver
|
||||
DriverNamespace string // namespace in which driver is deployed
|
||||
NodeID string // node id
|
||||
InstanceID string // unique ID distinguishing this instance of Ceph CSI
|
||||
PluginPath string // location of cephcsi plugin
|
||||
|
Loading…
Reference in New Issue
Block a user