本文整理汇总了Golang中github.com/openshift/origin/pkg/router/controller.NewStatusAdmitter函数的典型用法代码示例。如果您正苦于以下问题:Golang NewStatusAdmitter函数的具体用法?Golang NewStatusAdmitter怎么用?Golang NewStatusAdmitter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewStatusAdmitter函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Run
// 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 {}
}
示例2: launchRouter
// launchRouter launches a template router that communicates with the
// api via the provided clients.
func launchRouter(oc osclient.Interface, kc kclient.Interface, maxDelay int32, name string, reloadInterval int, reloadCounts map[string]int) (templatePlugin *templateplugin.TemplatePlugin) {
r := templateplugin.NewFakeTemplateRouter()
reloadCounts[name] = 0
r.EnableRateLimiter(reloadInterval, func() error {
reloadCounts[name]++
return nil
})
templatePlugin = &templateplugin.TemplatePlugin{Router: r}
statusPlugin := controller.NewStatusAdmitter(templatePlugin, oc, name)
validationPlugin := controller.NewExtendedValidator(statusPlugin, controller.RejectionRecorder(statusPlugin))
uniquePlugin := controller.NewUniqueHost(validationPlugin, controller.HostForRoute, controller.RejectionRecorder(statusPlugin))
var plugin router.Plugin = uniquePlugin
if maxDelay > 0 {
plugin = NewDelayPlugin(plugin, maxDelay)
}
factory := controllerfactory.NewDefaultRouterControllerFactory(oc, kc)
controller := factory.Create(plugin)
controller.Run()
return
}
示例3: Run
// 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,
InternalAddress: o.InternalAddress,
VxlanGateway: o.VxlanGateway,
}
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)
uniqueHostPlugin := controller.NewUniqueHost(statusPlugin, o.RouteSelectionFunc(), statusPlugin)
plugin := controller.NewHostAdmitter(uniqueHostPlugin, o.F5RouteAdmitterFunc(), false, statusPlugin)
factory := o.RouterSelection.NewFactory(oc, kc)
watchNodes := (len(o.InternalAddress) != 0 && len(o.VxlanGateway) != 0)
controller := factory.Create(plugin, watchNodes)
controller.Run()
select {}
}
示例4: Run
// Run launches a template router using the provided options. It never exits.
func (o *TemplateRouterOptions) Run() error {
pluginCfg := templateplugin.TemplatePluginConfig{
WorkingDir: o.WorkingDir,
TemplatePath: o.TemplateFile,
ReloadScriptPath: o.ReloadScript,
ReloadInterval: o.ReloadInterval,
DefaultCertificate: o.DefaultCertificate,
StatsPort: o.StatsPort,
StatsUsername: o.StatsUsername,
StatsPassword: o.StatsPassword,
PeerService: o.RouterService,
IncludeUDP: o.RouterSelection.IncludeUDP,
}
templatePlugin, err := templateplugin.NewTemplatePlugin(pluginCfg)
if err != nil {
return err
}
oc, kc, err := o.Config.Clients()
if err != nil {
return err
}
statusPlugin := controller.NewStatusAdmitter(templatePlugin, oc, o.RouterName)
plugin := controller.NewUniqueHost(statusPlugin, o.RouteSelectionFunc(), statusPlugin)
factory := o.RouterSelection.NewFactory(oc, kc)
controller := factory.Create(plugin)
controller.Run()
proc.StartReaper()
select {}
}
示例5: Run
// Run launches a template router using the provided options. It never exits.
func (o *TemplateRouterOptions) Run() error {
pluginCfg := templateplugin.TemplatePluginConfig{
WorkingDir: o.WorkingDir,
TemplatePath: o.TemplateFile,
ReloadScriptPath: o.ReloadScript,
ReloadInterval: o.ReloadInterval,
DefaultCertificate: o.DefaultCertificate,
DefaultCertificatePath: o.DefaultCertificatePath,
DefaultCertificateDir: o.DefaultCertificateDir,
StatsPort: o.StatsPort,
StatsUsername: o.StatsUsername,
StatsPassword: o.StatsPassword,
PeerService: o.RouterService,
BindPortsAfterSync: o.BindPortsAfterSync,
IncludeUDP: o.RouterSelection.IncludeUDP,
AllowWildcardRoutes: o.RouterSelection.AllowWildcardRoutes,
}
oc, kc, err := o.Config.Clients()
if err != nil {
return err
}
svcFetcher := templateplugin.NewListWatchServiceLookup(kc.Core(), 10*time.Minute)
templatePlugin, err := templateplugin.NewTemplatePlugin(pluginCfg, svcFetcher)
if err != nil {
return err
}
statusPlugin := controller.NewStatusAdmitter(templatePlugin, oc, o.RouterName)
var nextPlugin router.Plugin = statusPlugin
if o.ExtendedValidation {
nextPlugin = controller.NewExtendedValidator(nextPlugin, controller.RejectionRecorder(statusPlugin))
}
uniqueHostPlugin := controller.NewUniqueHost(nextPlugin, o.RouteSelectionFunc(), controller.RejectionRecorder(statusPlugin))
plugin := controller.NewHostAdmitter(uniqueHostPlugin, o.RouteAdmissionFunc(), o.RestrictSubdomainOwnership, controller.RejectionRecorder(statusPlugin))
factory := o.RouterSelection.NewFactory(oc, kc)
controller := factory.Create(plugin, false)
controller.Run()
proc.StartReaper()
select {}
}