Skip to content

Commit c1d8ea4

Browse files
committed
Sync controller EnableWarmup comments.
1 parent 79a7b95 commit c1d8ea4

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

pkg/config/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ type Controller struct {
6868
//
6969
// Setting EnableWarmup to true and NeedLeaderElection to true means the controller will start its
7070
// sources without waiting to become leader.
71-
// Setting EnableWarmup to true and NeedLeaderElection is false is a no-op as controllers without
71+
// Setting EnableWarmup to true and NeedLeaderElection to false is a no-op as controllers without
7272
// leader election do not wait on leader election to start their sources.
7373
// Defaults to false.
7474
EnableWarmup *bool

pkg/controller/controller.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ type TypedOptions[request comparable] struct {
100100
// improves leadership failover time, as the caches will be prepopulated before the controller
101101
// transitions to be leader.
102102
//
103-
// When set to true, the controller will start its sources without transitioning to be leader.
103+
// Setting EnableWarmup to true and NeedLeaderElection to true means the controller will start its
104+
// sources without waiting to become leader.
105+
// Setting EnableWarmup to true and NeedLeaderElection to false is a no-op as controllers without
106+
// leader election do not wait on leader election to start their sources.
104107
// Defaults to false.
105108
EnableWarmup *bool
106109
}

pkg/internal/controller/controller.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,17 @@ type Controller[request comparable] struct {
143143
// LeaderElected indicates whether the controller is leader elected or always running.
144144
LeaderElected *bool
145145

146-
// EnableWarmup specifies whether the controller should start its sources
147-
// when the manager is not the leader.
148-
// Defaults to false, which means that the controller will wait for leader election to start
149-
// before starting sources.
146+
// EnableWarmup specifies whether the controller should start its sources when the manager is not
147+
// the leader. This is useful for cases where sources take a long time to start, as it allows
148+
// for the controller to warm up its caches even before it is elected as the leader. This
149+
// improves leadership failover time, as the caches will be prepopulated before the controller
150+
// transitions to be leader.
151+
//
152+
// Setting EnableWarmup to true and NeedLeaderElection to true means the controller will start its
153+
// sources without waiting to become leader.
154+
// Setting EnableWarmup to true and NeedLeaderElection to false is a no-op as controllers without
155+
// leader election do not wait on leader election to start their sources.
156+
// Defaults to false.
150157
EnableWarmup *bool
151158
}
152159

0 commit comments

Comments
 (0)