Skip to content

Commit

Permalink
Enable strategies in the autoupdate rollout controller
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoShaka committed Dec 30, 2024
1 parent 855fc07 commit cca0989
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
3 changes: 3 additions & 0 deletions constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ const (
// ComponentUpdater represents the teleport-update binary.
ComponentUpdater = "updater"

// ComponentRolloutController represents the autoupdate_agent_rollout controller.
ComponentRolloutController = "rollout-controller"

// VerboseLogsEnvVar forces all logs to be verbose (down to DEBUG level)
VerboseLogsEnvVar = "TELEPORT_DEBUG"

Expand Down
21 changes: 17 additions & 4 deletions lib/autoupdate/rollout/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/gravitational/trace"
"github.com/jonboulle/clockwork"

"github.com/gravitational/teleport"
"github.com/gravitational/teleport/api/utils/retryutils"
"github.com/gravitational/teleport/lib/utils/interval"
)
Expand Down Expand Up @@ -65,15 +66,27 @@ func NewController(client Client, log *slog.Logger, clock clockwork.Clock, perio
period = defaultReconcilerPeriod
}

log = log.With(teleport.ComponentLabel, teleport.ComponentRolloutController)

haltOnError, err := newHaltOnErrorStrategy(log)
if err != nil {
return nil, trace.Wrap(err, "failed to initialize halt-on-error strategy")
}
timeBased, err := newTimeBasedStrategy(log)
if err != nil {
return nil, trace.Wrap(err, "failed to initialize time-based strategy")
}

return &Controller{
clock: clock,
log: log,
reconciler: reconciler{
clt: client,
log: log,
clock: clock,
clt: client,
log: log,
clock: clock,
rolloutStrategies: []rolloutStrategy{
// TODO(hugoShaka): add the strategies here as we implement them
timeBased,
haltOnError,
},
},
period: period,
Expand Down

0 comments on commit cca0989

Please sign in to comment.