diff --git a/lib/autoupdate/rollout/controller.go b/lib/autoupdate/rollout/controller.go index 9dc986f559c60..667a2c557ca32 100644 --- a/lib/autoupdate/rollout/controller.go +++ b/lib/autoupdate/rollout/controller.go @@ -61,8 +61,8 @@ func NewController(client Client, log *slog.Logger, clock clockwork.Clock) (*Con clock: clock, log: log, reconciler: reconciler{ - clt: client, - log: log, + clt: client, + log: log, rolloutStrategies: []rolloutStrategy{ // TODO(hugoShaka): add the strategies here as we implement them }, diff --git a/lib/autoupdate/rollout/reconciler.go b/lib/autoupdate/rollout/reconciler.go index dd9d9a040d4cc..80848dfd920b4 100644 --- a/lib/autoupdate/rollout/reconciler.go +++ b/lib/autoupdate/rollout/reconciler.go @@ -42,10 +42,6 @@ const ( defaultGroupName = "default" defaultStartHour = 12 - - // Common reasons - updateReasonCreated = "created" - updateReasonReconcilerError = "reconciler_error" ) var ( diff --git a/lib/autoupdate/rollout/strategy.go b/lib/autoupdate/rollout/strategy.go index ee3c1aa9b4ea0..339789c4e3028 100644 --- a/lib/autoupdate/rollout/strategy.go +++ b/lib/autoupdate/rollout/strategy.go @@ -1,3 +1,21 @@ +/* + * Teleport + * Copyright (C) 2024 Gravitational, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + package rollout import ( @@ -11,6 +29,12 @@ import ( "github.com/gravitational/teleport/api/types" ) +const ( + // Common update reasons + updateReasonCreated = "created" + updateReasonReconcilerError = "reconciler_error" +) + // rolloutStrategy is responsible for rolling out the update across groups. // This interface allows us to inject dummy strategies for simpler testing. type rolloutStrategy interface { diff --git a/lib/autoupdate/rollout/strategy_test.go b/lib/autoupdate/rollout/strategy_test.go index b395bbe2d2b3d..1792178a76cb6 100644 --- a/lib/autoupdate/rollout/strategy_test.go +++ b/lib/autoupdate/rollout/strategy_test.go @@ -1,3 +1,21 @@ +/* + * Teleport + * Copyright (C) 2024 Gravitational, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + package rollout import ( @@ -136,6 +154,10 @@ func Test_inWindow(t *testing.T) { func Test_setGroupState(t *testing.T) { groupName := "test-group" + // TODO(hugoShaka) remove those two variables once the strategies are merged and the constants are defined. + updateReasonCanStart := "can_start" + updateReasonCannotStart := "cannot_start" + clock := clockwork.NewFakeClock() // oldUpdateTime is 5 minutes in the past oldUpdateTime := clock.Now()