@@ -23,12 +23,15 @@ import (
23
23
"github.com/openshift/origin/pkg/cmd/templates"
24
24
"github.com/openshift/origin/pkg/cmd/util"
25
25
"github.com/openshift/origin/pkg/cmd/util/clientcmd"
26
+ projectinternalclientset "github.com/openshift/origin/pkg/project/generated/internalclientset"
27
+ routeinternalclientset "github.com/openshift/origin/pkg/route/generated/internalclientset"
26
28
"github.com/openshift/origin/pkg/router"
27
29
"github.com/openshift/origin/pkg/router/controller"
28
30
"github.com/openshift/origin/pkg/router/metrics"
29
31
"github.com/openshift/origin/pkg/router/metrics/haproxy"
30
32
templateplugin "github.com/openshift/origin/pkg/router/template"
31
33
"github.com/openshift/origin/pkg/util/proc"
34
+ "github.com/openshift/origin/pkg/version"
32
35
)
33
36
34
37
// defaultReloadInterval is how often to do reloads in seconds.
@@ -240,8 +243,9 @@ func (o *TemplateRouterOptions) Validate() error {
240
243
241
244
// Run launches a template router using the provided options. It never exits.
242
245
func (o * TemplateRouterOptions ) Run () error {
243
- statsPort := o . StatsPort
246
+ glog . Infof ( "Starting template router (%s)" , version . Get ())
244
247
248
+ statsPort := o .StatsPort
245
249
switch {
246
250
case o .MetricsType == "haproxy" :
247
251
if len (o .StatsUsername ) == 0 || len (o .StatsPassword ) == 0 {
@@ -336,7 +340,15 @@ func (o *TemplateRouterOptions) Run() error {
336
340
StrictSNI : o .StrictSNI ,
337
341
}
338
342
339
- oc , kc , err := o .Config .Clients ()
343
+ _ , kc , err := o .Config .Clients ()
344
+ if err != nil {
345
+ return err
346
+ }
347
+ routeclient , err := routeinternalclientset .NewForConfig (o .Config .OpenShiftConfig ())
348
+ if err != nil {
349
+ return err
350
+ }
351
+ projectclient , err := projectinternalclientset .NewForConfig (o .Config .OpenShiftConfig ())
340
352
if err != nil {
341
353
return err
342
354
}
@@ -347,15 +359,15 @@ func (o *TemplateRouterOptions) Run() error {
347
359
return err
348
360
}
349
361
350
- statusPlugin := controller .NewStatusAdmitter (templatePlugin , oc , o .RouterName , o .RouterCanonicalHostname )
362
+ statusPlugin := controller .NewStatusAdmitter (templatePlugin , routeclient , o .RouterName , o .RouterCanonicalHostname )
351
363
var nextPlugin router.Plugin = statusPlugin
352
364
if o .ExtendedValidation {
353
365
nextPlugin = controller .NewExtendedValidator (nextPlugin , controller .RejectionRecorder (statusPlugin ))
354
366
}
355
367
uniqueHostPlugin := controller .NewUniqueHost (nextPlugin , o .RouteSelectionFunc (), o .RouterSelection .DisableNamespaceOwnershipCheck , controller .RejectionRecorder (statusPlugin ))
356
368
plugin := controller .NewHostAdmitter (uniqueHostPlugin , o .RouteAdmissionFunc (), o .AllowWildcardRoutes , o .RouterSelection .DisableNamespaceOwnershipCheck , controller .RejectionRecorder (statusPlugin ))
357
369
358
- factory := o .RouterSelection .NewFactory (oc , kc )
370
+ factory := o .RouterSelection .NewFactory (routeclient , projectclient . Projects () , kc )
359
371
controller := factory .Create (plugin , false , o .EnableIngress )
360
372
controller .Run ()
361
373
0 commit comments