Merge pull request #460 from Madhu-1/fix-pluginapath

Fix pluginpath for cephfs
This commit is contained in:
Humble Devassy Chirammal
2019-07-29 14:02:18 +05:30
committed by GitHub
6 changed files with 39 additions and 49 deletions

View File

@ -38,7 +38,7 @@ const (
)
// PluginFolder defines the location of ceph plugin
var PluginFolder = "/var/lib/kubelet/plugins/"
var PluginFolder = ""
// Driver contains the default identity,node and controller struct
type Driver struct {
@ -91,9 +91,10 @@ func NewNodeServer(d *csicommon.CSIDriver) *NodeServer {
// Run start a non-blocking grpc controller,node and identityserver for
// ceph CSI driver which can serve multiple parallel requests
func (fs *Driver) Run(driverName, nodeID, endpoint, volumeMounter, mountCacheDir, instanceID string, cachePersister util.CachePersister) {
func (fs *Driver) Run(driverName, nodeID, endpoint, volumeMounter, mountCacheDir, instanceID, pluginPath string, cachePersister util.CachePersister) {
// Configuration
PluginFolder = pluginPath
if err := loadAvailableMounters(); err != nil {
klog.Fatalf("cephfs: failed to load ceph mounters: %v", err)

View File

@ -47,9 +47,6 @@ type Driver struct {
var (
// PluginFolder defines the location of ceph plugin
PluginFolder = "/var/lib/kubelet/plugins/"
// CSIInstanceID is the instance ID that is unique to an instance of CSI, used when sharing
// ceph clusters across CSI instances, to differentiate omap names per CSI instance
CSIInstanceID = "default"

View File

@ -22,11 +22,6 @@ import (
"k8s.io/klog"
)
const (
// PluginFolder defines location of plugins
PluginFolder = "/var/lib/kubelet/plugins"
)
// ForAllFunc is a unary predicate for visiting all cache entries
// matching the `pattern' in CachePersister's ForAll function.
type ForAllFunc func(identifier string) error
@ -45,7 +40,7 @@ type CachePersister interface {
}
// NewCachePersister returns CachePersister based on store
func NewCachePersister(metadataStore, driverName string) (CachePersister, error) {
func NewCachePersister(metadataStore, pluginPath string) (CachePersister, error) {
if metadataStore == "k8s_configmap" {
klog.Infof("cache-perister: using kubernetes configmap as metadata cache persister")
k8scm := &K8sCMCache{}
@ -55,7 +50,7 @@ func NewCachePersister(metadataStore, driverName string) (CachePersister, error)
} else if metadataStore == "node" {
klog.Infof("cache-persister: using node as metadata cache persister")
nc := &NodeCache{}
nc.BasePath = PluginFolder + "/" + driverName
nc.BasePath = pluginPath
nc.CacheDir = "controller"
return nc, nil
}

View File

@ -59,7 +59,7 @@ func roundUpSize(volumeSizeBytes, allocationUnitBytes int64) int64 {
}
// CreatePersistanceStorage creates storage path and initializes new cache
func CreatePersistanceStorage(sPath, metaDataStore, driverName string) (CachePersister, error) {
func CreatePersistanceStorage(sPath, metaDataStore, pluginPath string) (CachePersister, error) {
var err error
if err = CreateMountPoint(path.Join(sPath, "controller")); err != nil {
klog.Errorf("failed to create persistent storage for controller: %v", err)
@ -71,7 +71,7 @@ func CreatePersistanceStorage(sPath, metaDataStore, driverName string) (CachePer
return nil, err
}
cp, err := NewCachePersister(metaDataStore, driverName)
cp, err := NewCachePersister(metaDataStore, pluginPath)
if err != nil {
klog.Errorf("failed to define cache persistence method: %v", err)
return nil, err