From bbbc12bb4f8725d190c0376b99afd761dd8c7295 Mon Sep 17 00:00:00 2001 From: Vince Prignano Date: Sat, 30 Nov 2024 07:09:43 -0800 Subject: [PATCH] :bug: Fix RenewDeadline typo in leader election Signed-off-by: Vince Prignano --- pkg/leaderelection/leader_election.go | 6 +++--- pkg/manager/manager.go | 2 +- pkg/manager/manager_test.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/leaderelection/leader_election.go b/pkg/leaderelection/leader_election.go index 5a41f5c747..69daf94e48 100644 --- a/pkg/leaderelection/leader_election.go +++ b/pkg/leaderelection/leader_election.go @@ -49,8 +49,8 @@ type Options struct { // will use for holding the leader lock. LeaderElectionID string - // RewnewDeadline is the renew deadline for this leader election client - RewnewDeadline time.Duration + // RenewDeadline is the renew deadline for this leader election client + RenewDeadline time.Duration } // NewResourceLock creates a new resource lock for use in a leader election loop. @@ -99,7 +99,7 @@ func NewResourceLock(config *rest.Config, recorderProvider recorder.Provider, op EventRecorder: recorderProvider.GetEventRecorderFor(id), }, config, - options.RewnewDeadline, + options.RenewDeadline, ) } diff --git a/pkg/manager/manager.go b/pkg/manager/manager.go index 8e5d3bc8a7..92906fe6ca 100644 --- a/pkg/manager/manager.go +++ b/pkg/manager/manager.go @@ -389,7 +389,7 @@ func New(config *rest.Config, options Options) (Manager, error) { LeaderElectionResourceLock: options.LeaderElectionResourceLock, LeaderElectionID: options.LeaderElectionID, LeaderElectionNamespace: options.LeaderElectionNamespace, - RewnewDeadline: *options.RenewDeadline, + RenewDeadline: *options.RenewDeadline, }) if err != nil { return nil, err diff --git a/pkg/manager/manager_test.go b/pkg/manager/manager_test.go index 792bc4f967..6e5353e345 100644 --- a/pkg/manager/manager_test.go +++ b/pkg/manager/manager_test.go @@ -324,8 +324,8 @@ var _ = Describe("manger.Manager", func() { LeaderElectionNamespace: "default", LeaderElectionID: "test-leader-election-id", newResourceLock: func(config *rest.Config, recorderProvider recorder.Provider, options leaderelection.Options) (resourcelock.Interface, error) { - if options.RewnewDeadline != 10*time.Second { - return nil, fmt.Errorf("expected RenewDeadline to be 10s, got %v", options.RewnewDeadline) + if options.RenewDeadline != 10*time.Second { + return nil, fmt.Errorf("expected RenewDeadline to be 10s, got %v", options.RenewDeadline) } var err error rl, err = leaderelection.NewResourceLock(config, recorderProvider, options)