func updateManagementConfig()

in pkg/resources/configmap.go [27:63]


func updateManagementConfig(
	ndb *v1.NdbCluster, data map[string]string, oldConfigSummary *ndbconfig.ConfigSummary) error {

	// Update management if required
	if oldConfigSummary == nil || oldConfigSummary.MySQLClusterConfigNeedsUpdate(ndb) {
		// get the updated config string
		if oldConfigSummary != nil {
			klog.Infof("MySQL Cluster config for NdbCluster resource %q needs to be updated", ndb.Name)
		}
		configString, err := ndbconfig.GetConfigString(ndb, oldConfigSummary)
		if err != nil {
			klog.Errorf("Failed to get the config string : %v", err)
			return err
		}

		// add/update that to the data map
		data[constants.ConfigIniKey] = configString
	}

	if oldConfigSummary != nil && oldConfigSummary.TDEPasswordSecretName != ndb.Spec.TDESecretName {
		// TDE password is changed, All data nodes need to perform initial node restart to adopt
		// to this change
		data[constants.DataNodeInitialRestart] = "true"
	}

	// add/update the API slot information
	data[constants.NumOfMySQLServers] = fmt.Sprintf("%d", ndb.GetMySQLServerNodeCount())

	// add/update service type info for management nodes
	data[constants.ManagementLoadBalancer] = fmt.Sprintf("%v",
		ndb.Spec.ManagementNode != nil && ndb.Spec.ManagementNode.EnableLoadBalancer)

	// add/update the TDE password secret name
	data[constants.TDEPasswordSecretName] = ndb.Spec.TDESecretName

	return nil
}