File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -191,6 +191,9 @@ func (m *Main) addToManager(r manager.Runnable) {
191191 if r , ok := r .(inject.Reader ); ok {
192192 r .InjectReader (m .Manager .GetAPIReader ())
193193 }
194+ if r , ok := r .(inject.Client ); ok {
195+ r .InjectClient (m .Manager .GetClient ())
196+ }
194197 if h , ok := r .(inject.Healthz ); ok {
195198 if hc := h .HealthzCheck (); hc != nil {
196199 if err := m .Manager .AddHealthzCheck (h .Name (), hc ); err != nil {
Original file line number Diff line number Diff line change @@ -45,9 +45,8 @@ func (j *cronJob) InjectController(c lifecycle.Controller) {
4545}
4646
4747// InjectClient inject the client
48- func (j * cronJob ) InjectClient (c client.Client ) error {
48+ func (j * cronJob ) InjectClient (c client.Client ) {
4949 j .client = c
50- return nil
5150}
5251
5352// NeedLeaderElection may only start if leader is elected
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ var _ = Describe("Cron", func() {
4949 cj = Job ().(* cronJob )
5050 cj .InjectController (mockController )
5151 cj .InjectConfig (cfg )
52- Ω ( cj .InjectClient (mockClient )). ShouldNot ( HaveOccurred () )
52+ cj .InjectClient (mockClient )
5353 })
5454 Context ("NeedLeaderElection" , func () {
5555 It ("should be true" , func () {
Original file line number Diff line number Diff line change @@ -25,6 +25,11 @@ type Reader interface {
2525 InjectReader (client.Reader )
2626}
2727
28+ // Client inject the api client
29+ type Client interface {
30+ InjectClient (client.Client )
31+ }
32+
2833// Config inject the config
2934type Config interface {
3035 InjectConfig (* config.Config )
You can’t perform that action at this time.
0 commit comments