// Get the configurator based on the ipfailover type. func getPlugin(name string, f *clientcmd.Factory, options *ipfailover.IPFailoverConfigCmdOptions) (ipfailover.IPFailoverConfiguratorPlugin, error) { if options.Type == ipfailover.DefaultType { plugin, err := keepalived.NewIPFailoverConfiguratorPlugin(name, f, options) if err != nil { return nil, fmt.Errorf("IPFailoverConfigurator %q plugin error: %v", options.Type, err) } return plugin, nil } return nil, fmt.Errorf("No plugins available to handle type %q", options.Type) }
// Get the configurator based on the ipfailover type. func getPlugin(name string, f *clientcmd.Factory, options *ipfailover.IPFailoverConfigCmdOptions) (ipfailover.IPFailoverConfiguratorPlugin, error) { // Currently, the only supported plugin is keepalived (default). plugin, err := keepalived.NewIPFailoverConfiguratorPlugin(name, f, options) switch options.Type { case ipfailover.DefaultType: // Default. // case <new-type>: plugin, err = makeNewTypePlugin() default: return nil, fmt.Errorf("No plugins available to handle type %q", options.Type) } if err != nil { return nil, fmt.Errorf("IPFailoverConfigurator %q plugin error: %v", options.Type, err) } return plugin, nil }