Skip to content

Commit

Permalink
address tim's feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoShaka committed Nov 27, 2024
1 parent cf7678e commit a451250
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
13 changes: 11 additions & 2 deletions lib/autoupdate/rollout/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,24 @@ type Controller struct {
}

// NewController creates a new Controller for the autoupdate_agent_rollout kind.
func NewController(client Client, log *slog.Logger, clock clockwork.Clock) *Controller {
func NewController(client Client, log *slog.Logger, clock clockwork.Clock) (*Controller, error) {
if client == nil {
return nil, trace.BadParameter("missing client")
}
if log == nil {
return nil, trace.BadParameter("missing log")
}
if clock == nil {
return nil, trace.BadParameter("missing clock")
}
return &Controller{
clock: clock,
log: log,
reconciler: reconciler{
clt: client,
log: log,
},
}
}, nil
}

// Run the autoupdate_agent_rollout controller. This function returns only when its context is canceled.
Expand Down
5 changes: 4 additions & 1 deletion lib/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -2431,7 +2431,10 @@ func (process *TeleportProcess) initAuthService() error {
return trace.Wrap(spiffeFedSyncer.Run(process.GracefulExitContext()), "running SPIFFEFederation Syncer")
})

agentRolloutController := rollout.NewController(authServer, logger, process.Clock)
agentRolloutController, err := rollout.NewController(authServer, logger, process.Clock)
if err != nil {
return trace.Wrap(err, "creating the rollout controller")
}
process.RegisterFunc("auth.autoupdate_agent_rollout_controller", func() error {
return trace.Wrap(agentRolloutController.Run(process.GracefulExitContext()), "running autoupdate_agent_rollout controller")
})
Expand Down

0 comments on commit a451250

Please sign in to comment.