// NewAROUpgrader creates a new instance of an aroUpgrader
NewAROUpgrader creates a new instance of an aroUpgrader
// NewAROUpgrader creates a new instance of an aroUpgrader
func NewAROUpgrader(c client.Client, cfm configmanager.ConfigManager, mc metrics.Metrics, notifier eventmanager.EventManager) (*aroUpgrader, error) {
	cfg := &upgraderConfig{}
	err := cfm.Into(cfg)
	if err != nil {
		return nil, err
	}
	m, err := maintenance.NewBuilder().NewClient(c)
	if err != nil {
		return nil, err
	}
	acs, err := ac.GetAvailabilityCheckers(&cfg.ExtDependencyAvailabilityCheck)
	if err != nil {
		return nil, err
	}
	au := aroUpgrader{
		clusterUpgrader: &clusterUpgrader{
			client:               c,
			metrics:              mc,
			cvClient:             cv.NewCVClient(c),
			notifier:             notifier,
			config:               cfg,
			scaler:               scaler.NewScaler(),
			drainstrategyBuilder: drain.NewBuilder(),
			maintenance:          m,
			machinery:            machinery.NewMachinery(),
			availabilityCheckers: acs,
		},
	}
	steps := []upgradesteps.UpgradeStep{
		upgradesteps.Action(string(upgradev1alpha1.SendStartedNotification), au.SendStartedNotification),
		upgradesteps.Action(string(upgradev1alpha1.UpgradePreHealthCheck), au.PreUpgradeHealthCheck),
		upgradesteps.Action(string(upgradev1alpha1.ExtDepAvailabilityCheck), au.ExternalDependencyAvailabilityCheck),
		upgradesteps.Action(string(upgradev1alpha1.UpgradeScaleUpExtraNodes), au.EnsureExtraUpgradeWorkers),
		upgradesteps.Action(string(upgradev1alpha1.ControlPlaneMaintWindow), au.CreateControlPlaneMaintWindow),
		upgradesteps.Action(string(upgradev1alpha1.CommenceUpgrade), au.CommenceUpgrade),
		upgradesteps.Action(string(upgradev1alpha1.ControlPlaneUpgraded), au.ControlPlaneUpgraded),
		upgradesteps.Action(string(upgradev1alpha1.RemoveControlPlaneMaintWindow), au.RemoveControlPlaneMaintWindow),
		upgradesteps.Action(string(upgradev1alpha1.WorkersMaintWindow), au.CreateWorkerMaintWindow),
		upgradesteps.Action(string(upgradev1alpha1.AllWorkerNodesUpgraded), au.AllWorkersUpgraded),
		upgradesteps.Action(string(upgradev1alpha1.RemoveExtraScaledNodes), au.RemoveExtraScaledNodes),
		upgradesteps.Action(string(upgradev1alpha1.RemoveMaintWindow), au.RemoveMaintWindow),
		upgradesteps.Action(string(upgradev1alpha1.PostClusterHealthCheck), au.PostUpgradeHealthCheck),
		upgradesteps.Action(string(upgradev1alpha1.SendCompletedNotification), au.SendCompletedNotification),
	}
	au.steps = steps
	return &au, nil
}
func NewAROUpgrader ( c client . Client , cfm configmanager . ConfigManager , mc metrics . Metrics , notifier eventmanager . EventManager ) ( * aroUpgrader , error ) { cfg := & upgraderConfig { } err := cfm . Into ( cfg ) if err != nil { return nil , err } m , err := maintenance . NewBuilder ( ) . NewClient ( c ) if err != nil { return nil , err } acs , err := ac . GetAvailabilityCheckers ( & cfg . ExtDependencyAvailabilityCheck ) if err != nil { return nil , err } au := aroUpgrader { clusterUpgrader : & clusterUpgrader { client : c , metrics : mc , cvClient : cv . NewCVClient ( c ) , notifier : notifier , config : cfg , scaler : scaler . NewScaler ( ) , drainstrategyBuilder : drain . NewBuilder ( ) , maintenance : m , machinery : machinery . NewMachinery ( ) , availabilityCheckers : acs , } , } steps := [ ] upgradesteps . UpgradeStep { upgradesteps . Action ( string ( upgradev1alpha1 . SendStartedNotification ) , au . SendStartedNotification ) , upgradesteps . Action ( string ( upgradev1alpha1 . UpgradePreHealthCheck ) , au . PreUpgradeHealthCheck ) , upgradesteps . Action ( string ( upgradev1alpha1 . ExtDepAvailabilityCheck ) , au . ExternalDependencyAvailabilityCheck ) , upgradesteps . Action ( string ( upgradev1alpha1 . UpgradeScaleUpExtraNodes ) , au . EnsureExtraUpgradeWorkers ) , upgradesteps . Action ( string ( upgradev1alpha1 . ControlPlaneMaintWindow ) , au . CreateControlPlaneMaintWindow ) , upgradesteps . Action ( string ( upgradev1alpha1 . CommenceUpgrade ) , au . CommenceUpgrade ) , upgradesteps . Action ( string ( upgradev1alpha1 . ControlPlaneUpgraded ) , au . ControlPlaneUpgraded ) , upgradesteps . Action ( string ( upgradev1alpha1 . RemoveControlPlaneMaintWindow ) , au . RemoveControlPlaneMaintWindow ) , upgradesteps . Action ( string ( upgradev1alpha1 . WorkersMaintWindow ) , au . CreateWorkerMaintWindow ) , upgradesteps . Action ( string ( upgradev1alpha1 . AllWorkerNodesUpgraded ) , au . AllWorkersUpgraded ) , upgradesteps . Action ( string ( upgradev1alpha1 . RemoveExtraScaledNodes ) , au . RemoveExtraScaledNodes ) , upgradesteps . Action ( string ( upgradev1alpha1 . RemoveMaintWindow ) , au . RemoveMaintWindow ) , upgradesteps . Action ( string ( upgradev1alpha1 . PostClusterHealthCheck ) , au . PostUpgradeHealthCheck ) , upgradesteps . Action ( string ( upgradev1alpha1 . SendCompletedNotification ) , au . SendCompletedNotification ) , } au . steps = steps return & au , nil }
NewAROUpgrader creates a new instance of an aroUpgrader
NewAROUpgrader creates a new instance of an aroUpgrader