MCPcopy
hub / github.com/kubernetes/client-go / Run

Method Run

tools/leaderelection/leaderelection.go:190–202  ·  view source on GitHub ↗

Run starts the leader election loop

(ctx context.Context)

Source from the content-addressed store, hash-verified

188
189// Run starts the leader election loop
190func (le *LeaderElector) Run(ctx context.Context) {
191 defer func() {
192 runtime.HandleCrash()
193 le.config.Callbacks.OnStoppedLeading()
194 }()
195 if !le.acquire(ctx) {
196 return // ctx signalled done
197 }
198 ctx, cancel := context.WithCancel(ctx)
199 defer cancel()
200 go le.config.Callbacks.OnStartedLeading(ctx)
201 le.renew(ctx)
202}
203
204// RunOrDie starts a client with the provided config or panics if the config
205// fails to validate.

Callers 1

RunOrDieFunction · 0.95

Calls 2

acquireMethod · 0.95
renewMethod · 0.95

Tested by

no test coverage detected