Skip to content

Commit

Permalink
fix missing constants + add license
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoShaka committed Dec 5, 2024
1 parent 09b8f86 commit 06d909d
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/autoupdate/rollout/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
4 changes: 0 additions & 4 deletions lib/autoupdate/rollout/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ const (

defaultGroupName = "default"
defaultStartHour = 12

// Common reasons
updateReasonCreated = "created"
updateReasonReconcilerError = "reconciler_error"
)

var (
Expand Down
24 changes: 24 additions & 0 deletions lib/autoupdate/rollout/strategy.go
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

package rollout

import (
Expand All @@ -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 {
Expand Down
22 changes: 22 additions & 0 deletions lib/autoupdate/rollout/strategy_test.go
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

package rollout

import (
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 06d909d

Please sign in to comment.