MCPcopy Index your code
hub / github.com/devspace-sh/devspace / PrintPodError

Function PrintPodError

pkg/devspace/services/sync/controller.go:247–268  ·  view source on GitHub ↗
(ctx context.Context, kubeClient kubectl.Client, pod *v1.Pod, log logpkg.Logger)

Source from the content-addressed store, hash-verified

245}
246
247func PrintPodError(ctx context.Context, kubeClient kubectl.Client, pod *v1.Pod, log logpkg.Logger) bool {
248 // check if pod still exists
249 newPod, err := kubeClient.KubeClient().CoreV1().Pods(pod.Namespace).Get(ctx, pod.Name, metav1.GetOptions{})
250 if err != nil {
251 if kerrors.IsNotFound(err) {
252 log.Errorf("Restarted because old pod %s/%s seems to be erased", pod.Namespace, pod.Name)
253 return true
254 }
255
256 return false
257 }
258 if newPod.DeletionTimestamp != nil {
259 return true
260 }
261
262 podStatus := kubectl.GetPodStatus(newPod)
263 if podStatus != "Running" {
264 log.Errorf("Restarted because old pod %s/%s has status %s", pod.Namespace, pod.Name, podStatus)
265 }
266
267 return false
268}
269
270func (c *controller) startSync(ctx devspacecontext.Context, options *Options, onInitUploadDone chan struct{}, onInitDownloadDone chan struct{}, onDone chan struct{}, onError chan error) (*sync.Sync, *selector.SelectedPodContainer, error) {
271 syncConfig := options.SyncConfig

Callers 3

StartForwardingFunction · 0.92
startWithWaitMethod · 0.85

Calls 4

GetPodStatusFunction · 0.92
KubeClientMethod · 0.65
GetMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected