diff --git a/internal/cephfs/driver.go b/internal/cephfs/driver.go index bb8120455..3e6d56ad1 100644 --- a/internal/cephfs/driver.go +++ b/internal/cephfs/driver.go @@ -30,9 +30,6 @@ const ( // volIDVersion is the version number of volume ID encoding scheme volIDVersion uint16 = 1 - // csiConfigFile is the location of the CSI config file - csiConfigFile = "/etc/ceph-csi-config/config.json" - // RADOS namespace to store CSI specific objects and keys radosNamespace = "csi" ) diff --git a/internal/cephfs/util.go b/internal/cephfs/util.go index c6039b44f..7db083f8f 100644 --- a/internal/cephfs/util.go +++ b/internal/cephfs/util.go @@ -153,7 +153,7 @@ func getMonsAndClusterID(ctx context.Context, options map[string]string) (monito return } - if monitors, err = util.Mons(csiConfigFile, clusterID); err != nil { + if monitors, err = util.Mons(util.CsiConfigFile, clusterID); err != nil { klog.Errorf(util.Log(ctx, "failed getting mons (%s)"), err) err = fmt.Errorf("failed to fetch monitor list using clusterID (%s): %w", clusterID, err) return diff --git a/internal/cephfs/volumeoptions.go b/internal/cephfs/volumeoptions.go index 9bd4fa7ed..6bf63856b 100644 --- a/internal/cephfs/volumeoptions.go +++ b/internal/cephfs/volumeoptions.go @@ -122,13 +122,13 @@ func getClusterInformation(options map[string]string) (*util.ClusterInfo, error) return nil, err } - monitors, err := util.Mons(csiConfigFile, clusterID) + monitors, err := util.Mons(util.CsiConfigFile, clusterID) if err != nil { err = fmt.Errorf("failed to fetch monitor list using clusterID (%s): %w", clusterID, err) return nil, err } - subvolumeGroup, err := util.CephFSSubvolumeGroup(csiConfigFile, clusterID) + subvolumeGroup, err := util.CephFSSubvolumeGroup(util.CsiConfigFile, clusterID) if err != nil { err = fmt.Errorf("failed to fetch subvolumegroup using clusterID (%s): %w", clusterID, err) return nil, err @@ -237,11 +237,11 @@ func newVolumeOptionsFromVolID(ctx context.Context, volID string, volOpt, secret vid.VolumeID = volID volOptions.FscID = vi.LocationID - if volOptions.Monitors, err = util.Mons(csiConfigFile, vi.ClusterID); err != nil { + if volOptions.Monitors, err = util.Mons(util.CsiConfigFile, vi.ClusterID); err != nil { return nil, nil, fmt.Errorf("failed to fetch monitor list using clusterID (%s): %w", vi.ClusterID, err) } - if volOptions.SubvolumeGroup, err = util.CephFSSubvolumeGroup(csiConfigFile, vi.ClusterID); err != nil { + if volOptions.SubvolumeGroup, err = util.CephFSSubvolumeGroup(util.CsiConfigFile, vi.ClusterID); err != nil { return nil, nil, fmt.Errorf("failed to fetch subvolumegroup list using clusterID (%s): %w", vi.ClusterID, err) } @@ -430,11 +430,11 @@ func newSnapshotOptionsFromID(ctx context.Context, snapID string, cr *util.Crede sid.SnapshotID = snapID volOptions.FscID = vi.LocationID - if volOptions.Monitors, err = util.Mons(csiConfigFile, vi.ClusterID); err != nil { + if volOptions.Monitors, err = util.Mons(util.CsiConfigFile, vi.ClusterID); err != nil { return &volOptions, nil, &sid, fmt.Errorf("failed to fetch monitor list using clusterID (%s): %w", vi.ClusterID, err) } - if volOptions.SubvolumeGroup, err = util.CephFSSubvolumeGroup(csiConfigFile, vi.ClusterID); err != nil { + if volOptions.SubvolumeGroup, err = util.CephFSSubvolumeGroup(util.CsiConfigFile, vi.ClusterID); err != nil { return &volOptions, nil, &sid, fmt.Errorf("failed to fetch subvolumegroup list using clusterID (%s): %w", vi.ClusterID, err) } diff --git a/internal/rbd/driver.go b/internal/rbd/driver.go index 0767f7acc..7d873ac16 100644 --- a/internal/rbd/driver.go +++ b/internal/rbd/driver.go @@ -29,9 +29,6 @@ import ( const ( // volIDVersion is the version number of volume ID encoding scheme volIDVersion uint16 = 1 - - // csiConfigFile is the location of the CSI config file - csiConfigFile = "/etc/ceph-csi-config/config.json" ) // Driver contains the default identity,node and controller struct. diff --git a/internal/rbd/rbd_util.go b/internal/rbd/rbd_util.go index f4ccb7d53..d06681b8e 100644 --- a/internal/rbd/rbd_util.go +++ b/internal/rbd/rbd_util.go @@ -671,7 +671,7 @@ func getMonsAndClusterID(ctx context.Context, options map[string]string) (monito return } - if monitors, err = util.Mons(csiConfigFile, clusterID); err != nil { + if monitors, err = util.Mons(util.CsiConfigFile, clusterID); err != nil { klog.Errorf(util.Log(ctx, "failed getting mons (%s)"), err) err = fmt.Errorf("failed to fetch monitor list using clusterID (%s): %w", clusterID, err) return diff --git a/internal/util/csiconfig.go b/internal/util/csiconfig.go index 3f2b2b496..d4cfec608 100644 --- a/internal/util/csiconfig.go +++ b/internal/util/csiconfig.go @@ -27,6 +27,9 @@ const ( // defaultCsiSubvolumeGroup defines the default name for the CephFS CSI subvolumegroup. // This was hardcoded once and defaults to the old value to keep backward compatibility. defaultCsiSubvolumeGroup = "csi" + + // CsiConfigFile is the location of the CSI config file + CsiConfigFile = "/etc/ceph-csi-config/config.json" ) // ClusterInfo strongly typed JSON spec for the below JSON structure.