Skip to content

Commit

Permalink
Create and use the Reconciler constructor for the service controller (#…
Browse files Browse the repository at this point in the history
…14623)

* Create and use the Reconciler constructor for the service controller

* Change the format
  • Loading branch information
houshengbo committed Nov 16, 2023
1 parent ae91326 commit 7561386
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/reconciler/service/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ func NewController(
configStore := cfgmap.NewStore(logger.Named("config-store"))
configStore.WatchConfigs(cmw)

c := &Reconciler{
client: servingclient.Get(ctx),
configurationLister: configurationInformer.Lister(),
revisionLister: revisionInformer.Lister(),
routeLister: routeInformer.Lister(),
}
c := NewReconciler(
servingclient.Get(ctx),
configurationInformer.Lister(),
revisionInformer.Lister(),
routeInformer.Lister(),
)
opts := func(*controller.Impl) controller.Options {
return controller.Options{ConfigStore: configStore}
}
Expand Down
12 changes: 12 additions & 0 deletions pkg/reconciler/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ type Reconciler struct {
routeLister listers.RouteLister
}

// NewReconciler creates the reference to the Reconciler based on clientset.Interface, listers.ConfigurationLister,
// listers.RevisionLister and listers.RouteLister.
func NewReconciler(client clientset.Interface, configurationLister listers.ConfigurationLister,
revisionLister listers.RevisionLister, routeLister listers.RouteLister) *Reconciler {
return &Reconciler{
client: client,
configurationLister: configurationLister,
revisionLister: revisionLister,
routeLister: routeLister,
}
}

// Check that our Reconciler implements ksvcreconciler.Interface
var _ ksvcreconciler.Interface = (*Reconciler)(nil)

Expand Down

0 comments on commit 7561386

Please sign in to comment.