Пример #1
0
// Run launches an F5 route sync process using the provided options. It never exits.
func (o *F5RouterOptions) Run() error {
	cfg := f5plugin.F5PluginConfig{
		Host:         o.Host,
		Username:     o.Username,
		Password:     o.Password,
		HttpVserver:  o.HttpVserver,
		HttpsVserver: o.HttpsVserver,
		PrivateKey:   o.PrivateKey,
		Insecure:     o.Insecure,
	}
	f5Plugin, err := f5plugin.NewF5Plugin(cfg)
	if err != nil {
		return err
	}

	plugin := controller.NewUniqueHost(f5Plugin, controller.HostForRoute)

	oc, kc, err := o.Config.Clients()
	if err != nil {
		return err
	}

	factory := o.RouterSelection.NewFactory(oc, kc)
	controller := factory.Create(plugin)
	controller.Run()

	select {}
}
Пример #2
0
// Run launches an F5 route sync process using the provided options. It never exits.
func (o *F5RouterOptions) Run() error {
	cfg := f5plugin.F5PluginConfig{
		Host:          o.Host,
		Username:      o.Username,
		Password:      o.Password,
		HttpVserver:   o.HttpVserver,
		HttpsVserver:  o.HttpsVserver,
		PrivateKey:    o.PrivateKey,
		Insecure:      o.Insecure,
		PartitionPath: o.PartitionPath,
	}
	f5Plugin, err := f5plugin.NewF5Plugin(cfg)
	if err != nil {
		return err
	}

	oc, kc, err := o.Config.Clients()
	if err != nil {
		return err
	}

	statusPlugin := controller.NewStatusAdmitter(f5Plugin, oc, o.RouterName)
	plugin := controller.NewUniqueHost(statusPlugin, o.RouteSelectionFunc(), statusPlugin)

	factory := o.RouterSelection.NewFactory(oc, kc)
	controller := factory.Create(plugin)
	controller.Run()

	select {}
}