mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
deploy: support for read affinity options per cluster
Implemented the capability to include read affinity options for individual clusters within the ceph-csi-config ConfigMap. This allows users to configure the crush location for each cluster separately. The read affinity options specified in the ConfigMap will supersede those provided via command line arguments. Signed-off-by: Praveen M <m.praveen@ibm.com>
This commit is contained in:
@ -62,6 +62,11 @@ type ClusterInfo struct {
|
||||
// symlink filepath for the network namespace where we need to execute commands.
|
||||
NetNamespaceFilePath string `json:"netNamespaceFilePath"`
|
||||
} `json:"nfs"`
|
||||
// Read affinity map options
|
||||
ReadAffinity struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
CrushLocationLabels []string `json:"crushLocationLabels"`
|
||||
} `json:"readAffinity"`
|
||||
}
|
||||
|
||||
// Expected JSON structure in the passed in config file is,
|
||||
@ -203,3 +208,21 @@ func GetNFSNetNamespaceFilePath(pathToConfig, clusterID string) (string, error)
|
||||
|
||||
return cluster.NFS.NetNamespaceFilePath, nil
|
||||
}
|
||||
|
||||
// GetCrushLocationLabels returns the `readAffinity.enabled` and `readAffinity.crushLocationLabels`
|
||||
// values from the CSI config for the given `clusterID`. If `readAffinity.enabled` is set to true
|
||||
// it returns `true` and `crushLocationLabels`, else returns `false` and an empty string.
|
||||
func GetCrushLocationLabels(pathToConfig, clusterID string) (bool, string, error) {
|
||||
cluster, err := readClusterInfo(pathToConfig, clusterID)
|
||||
if err != nil {
|
||||
return false, "", err
|
||||
}
|
||||
|
||||
if !cluster.ReadAffinity.Enabled {
|
||||
return false, "", nil
|
||||
}
|
||||
|
||||
crushLocationLabels := strings.Join(cluster.ReadAffinity.CrushLocationLabels, ",")
|
||||
|
||||
return true, crushLocationLabels, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user