mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rbd: move radosNamespace to RBD section
As radosNamespace is more specific to
RBD not the general ceph configuration. Now
we introduced a new RBD section for RBD specific
options, Moving the radosNamespace to RBD section
and keeping the radosNamespace still under the
global ceph level configration for backward
compatibility.
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
(cherry picked from commit b4acbd08a5
)
This commit is contained in:
committed by
mergify[bot]
parent
76398d6887
commit
f8a19c8cbb
@ -41,7 +41,7 @@ type ClusterInfo struct {
|
||||
// ClusterID is used for unique identification
|
||||
ClusterID string `json:"clusterID"`
|
||||
// RadosNamespace is a rados namespace in the pool
|
||||
RadosNamespace string `json:"radosNamespace"`
|
||||
RadosNamespace string `json:"radosNamespace"` // For backward compatibility. TODO: Remove this in 3.7.0
|
||||
// Monitors is monitor list for corresponding cluster ID
|
||||
Monitors []string `json:"monitors"`
|
||||
// CephFS contains CephFS specific options
|
||||
@ -54,18 +54,22 @@ type ClusterInfo struct {
|
||||
RBD struct {
|
||||
// symlink filepath for the network namespace where we need to execute commands.
|
||||
NetNamespaceFilePath string `json:"netNamespaceFilePath"`
|
||||
// RadosNamespace is a rados namespace in the pool
|
||||
RadosNamespace string `json:"radosNamespace"`
|
||||
} `json:"rbd"`
|
||||
}
|
||||
|
||||
// Expected JSON structure in the passed in config file is,
|
||||
// [
|
||||
// {
|
||||
// "clusterID": "<cluster-id>",
|
||||
// "radosNamespace": "<rados-namespace>",
|
||||
// "monitors":
|
||||
// [
|
||||
// "<monitor-value>",
|
||||
// "<monitor-value>",
|
||||
// "clusterID": "<cluster-id>",
|
||||
// "rbd": {
|
||||
// "radosNamespace": "<rados-namespace>"
|
||||
// },
|
||||
// "monitors":
|
||||
// [
|
||||
// "<monitor-value>",
|
||||
// "<monitor-value>",
|
||||
// ...
|
||||
// ],
|
||||
// "cephFS": {
|
||||
@ -121,6 +125,10 @@ func GetRadosNamespace(pathToConfig, clusterID string) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if cluster.RBD.RadosNamespace != "" {
|
||||
return cluster.RBD.RadosNamespace, nil
|
||||
}
|
||||
|
||||
return cluster.RadosNamespace, nil
|
||||
}
|
||||
|
||||
|
@ -170,6 +170,7 @@ func TestGetRBDNetNamespaceFilePath(t *testing.T) {
|
||||
Monitors: []string{"ip-1", "ip-2"},
|
||||
RBD: struct {
|
||||
NetNamespaceFilePath string `json:"netNamespaceFilePath"`
|
||||
RadosNamespace string `json:"radosNamespace"`
|
||||
}{
|
||||
NetNamespaceFilePath: "/var/lib/kubelet/plugins/rbd.ceph.csi.com/cluster1-net",
|
||||
},
|
||||
@ -179,6 +180,7 @@ func TestGetRBDNetNamespaceFilePath(t *testing.T) {
|
||||
Monitors: []string{"ip-3", "ip-4"},
|
||||
RBD: struct {
|
||||
NetNamespaceFilePath string `json:"netNamespaceFilePath"`
|
||||
RadosNamespace string `json:"radosNamespace"`
|
||||
}{
|
||||
NetNamespaceFilePath: "/var/lib/kubelet/plugins/rbd.ceph.csi.com/cluster2-net",
|
||||
},
|
||||
|
Reference in New Issue
Block a user