Commit fa5b3a0
committed
Add exponential backoff retry for default PtpOperatorConfig creation
The operator could fail to create the default PtpOperatorConfig on
startup due to a race condition: the local webhook server is ready
but the Kubernetes Service endpoints are not yet populated, causing
the API server's validating webhook call to fail with "no endpoints
available". Without retry, the default config is never created and
the linuxptp-daemon DaemonSet is never spawned.
Wrap createDefaultOperatorConfig in wait.ExponentialBackoff (10 steps,
1s-30s cap) so transient webhook connectivity failures are retried
gracefully. Use goroutine-local err variables to avoid a data race
with mgr.Start, reuse the existing restConfig rather than calling
ctrl.GetConfigOrDie() on each attempt, and check ctx.Done() so the
retry loop terminates cleanly on manager shutdown.
Generated-by: Cursor1 parent 158f56c commit fa5b3a0
1 file changed
+24
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
246 | 247 | | |
247 | 248 | | |
248 | 249 | | |
249 | | - | |
250 | 250 | | |
251 | | - | |
252 | | - | |
| 251 | + | |
253 | 252 | | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
259 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
260 | 276 | | |
261 | 277 | | |
262 | 278 | | |
| |||
0 commit comments