File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -100,9 +100,7 @@ func NewCommand(ctx context.Context) *cobra.Command {
100100 return fmt .Errorf ("unable to create controller manager: %w" , err )
101101 }
102102
103- if err := mgr .Add (manager .RunnableFunc (func (ctx context.Context ) error {
104- return certificateSource .Run (ctx )
105- })); err != nil {
103+ if err := mgr .Add (& dynamicCertRunnable {source : certificateSource }); err != nil {
106104 return err
107105 }
108106
@@ -143,3 +141,19 @@ func NewCommand(ctx context.Context) *cobra.Command {
143141
144142 return cmd
145143}
144+
145+ type dynamicCertRunnable struct {
146+ source * servertls.DynamicSource
147+ }
148+
149+ func (c * dynamicCertRunnable ) Start (ctx context.Context ) error {
150+ return c .source .Run (ctx )
151+ }
152+
153+ func (c * dynamicCertRunnable ) NeedLeaderElection () bool {
154+ // By default, a runnable in c/r is leader election aware.
155+ // Since we need certs for all replicas, this runnable must NOT be leader election aware.
156+ return false
157+ }
158+
159+ var _ manager.LeaderElectionRunnable = & dynamicCertRunnable {}
You can’t perform that action at this time.
0 commit comments