in pkg/ndbconfig/config_summary.go [77:118]
func NewConfigSummary(configMapData map[string]string) (*ConfigSummary, error) {
config, err := configparser.ParseString(configMapData[constants.ConfigIniKey])
if err != nil {
// Should never happen as the operator generated the config.ini
return nil, debug.InternalError(err)
}
cs := &ConfigSummary{
NdbClusterGeneration: int64(parseInt32(configMapData[constants.NdbClusterGeneration])),
MySQLClusterConfigVersion: parseInt32(
config.GetValueFromSection("system", "ConfigGenerationNumber")),
NumOfManagementNodes: int32(config.GetNumberOfSections("ndb_mgmd")),
NumOfDataNodes: int32(config.GetNumberOfSections("ndbd")),
NumOfMySQLServers: parseInt32(configMapData[constants.NumOfMySQLServers]),
NumOfMySQLServerSlots: int32(config.GetNumberOfSections("mysqld")),
NumOfFreeApiSlots: int32(config.GetNumberOfSections("api")),
RedundancyLevel: parseInt32(
config.GetValueFromSection("ndbd default", "NoOfReplicas")),
MySQLLoadBalancer: parseBool(configMapData[constants.MySQLLoadBalancer]),
ManagementLoadBalancer: parseBool(configMapData[constants.ManagementLoadBalancer]),
defaultNdbdSection: config.GetSection("ndbd default"),
defaultMgmdSection: config.GetSection("mgmd default"),
MySQLRootHost: configMapData[constants.MySQLRootHost],
TDEPasswordSecretName: configMapData[constants.TDEPasswordSecretName],
DataNodeInitialRestart: parseBool(configMapData[constants.DataNodeInitialRestart]),
}
// Update MySQL Config details if it exists
mysqlConfigString := configMapData[constants.MySQLConfigKey]
if mysqlConfigString != "" {
cs.myCnfConfig, err = configparser.ParseString(mysqlConfigString)
if err != nil {
// Should never happen as the operator generated the my.cnf
return nil, debug.InternalError(err)
}
cs.MySQLServerConfigVersion = parseInt32(
cs.myCnfConfig.GetValueFromSection("header", "ConfigVersion"))
}
return cs, nil
}