func migrateToTenantBasedConfig()

in alertmanager/migration/migration.go [64:79]


func migrateToTenantBasedConfig(conf *config.Config) {
	for _, route := range conf.Route.Routes {
		matched, _ := regexp.MatchString(fmt.Sprintf(".*_%s", deprecatedTenancyPostfix), route.Receiver)
		if matched {
			migratedName := strings.Replace(route.Receiver, deprecatedTenancyPostfix, config.TenantBaseRoutePostfix, 1)
			route.Receiver = migratedName
		}
	}
	for _, receiver := range conf.Receivers {
		matched, _ := regexp.MatchString(fmt.Sprintf(".*_%s", deprecatedTenancyPostfix), receiver.Name)
		if matched {
			migratedName := strings.Replace(receiver.Name, deprecatedTenancyPostfix, config.TenantBaseRoutePostfix, 1)
			receiver.Name = migratedName
		}
	}
}