Skip to content

Commit b64ecdb

Browse files
committed
plumb root context through restart polling logic
1 parent 21b06c5 commit b64ecdb

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pkg/controllers/kube-apiserver.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ func (s *KubeAPIServer) Run(ctx context.Context, ready chan<- struct{}, stopped
440440
panic(perr)
441441
case <-rbacDeadlockDetected:
442442
klog.Error("RBAC bootstrap hook deadlock detected - restarting microshift-etcd.scope to recover")
443-
if err := restartMicroshiftEtcdScope(); err != nil {
443+
if err := restartMicroshiftEtcdScope(ctx); err != nil {
444444
klog.Errorf("Failed to restart microshift-etcd.scope: %v", err)
445445
}
446446
return fmt.Errorf("RBAC bootstrap hook deadlock detected after %d seconds", rbacHookDeadlockTimeout)
@@ -583,11 +583,11 @@ func isEtcdHealthy(ctx context.Context) (bool, error) {
583583

584584
// restartMicroshiftEtcdScope restarts the microshift-etcd.scope to recover from deadlock.
585585
// This forces a clean restart of etcd which can help break the circular dependency.
586-
func restartMicroshiftEtcdScope() error {
586+
func restartMicroshiftEtcdScope(ctx context.Context) error {
587587
klog.Info("Stopping microshift-etcd.scope for recovery")
588588

589589
// Set a timeout in case systemd or DBus stalls and the fail-fast recovery path hangs and Run never returns
590-
cmdCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
590+
cmdCtx, cancel := context.WithTimeout(ctx, 5*time.Second)
591591
defer cancel()
592592

593593
stopCmd := exec.CommandContext(cmdCtx, "systemctl", "stop", "microshift-etcd.scope")

0 commit comments

Comments
 (0)