Skip to content

Commit

Permalink
fix if restart pod sanbox container, sanbox /etc/resolv.conf will be …
Browse files Browse the repository at this point in the history
…restore to host /etc/resolv.conf.
  • Loading branch information
“donghong” authored and Novicei committed Jul 22, 2022
1 parent 17f559f commit 1f791a6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cri/v1alpha2/cri.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,13 @@ func (c *CriManager) StartPodSandbox(ctx context.Context, r *runtime.StartPodSan
}
}

// Setup sandbox file /etc/resolv.conf again to ensure resolv.conf is right
sandboxRootDir := path.Join(c.SandboxBaseDir, sandbox.ID)
err = setupSandboxFiles(sandboxRootDir, sandboxMeta.Config)
if err != nil {
return nil, fmt.Errorf("failed to setup sandbox files: %v", err)
}

metrics.PodSuccessActionsCounter.WithLabelValues(label).Inc()

return &runtime.StartPodSandboxResponse{}, nil
Expand Down

0 comments on commit 1f791a6

Please sign in to comment.