Skip to content

Commit d7bb7b9

Browse files
kylos101roboquat
authored andcommitted
[ws-manager] log errors as warnings during exponential backoff
If we still have an error afterwards, then log it
1 parent 48aff21 commit d7bb7b9

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

components/ws-manager/pkg/manager/manager.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,11 @@ func (m *Manager) StartWorkspace(ctx context.Context, req *api.StartWorkspaceReq
310310
safePod, _ := log.RedactJSON(m)
311311

312312
if k8serr.IsAlreadyExists(err) {
313-
clog.WithError(err).WithField("req", req).WithField("pod", safePod).Warn("was unable to start workspace which already exists")
313+
clog.WithError(err).WithField("req", req).WithField("pod", string(safePod)).Warn("was unable to start workspace which already exists")
314314
return false, status.Error(codes.AlreadyExists, "workspace instance already exists")
315315
}
316316

317-
clog.WithError(err).WithField("req", req).WithField("pod", safePod).Error("was unable to start workspace")
317+
clog.WithError(err).WithField("req", req).WithField("pod", string(safePod)).Warn("was unable to start workspace")
318318
return false, err
319319
}
320320

@@ -340,7 +340,7 @@ func (m *Manager) StartWorkspace(ctx context.Context, req *api.StartWorkspaceReq
340340
if err != nil {
341341
jsonPod, _ := json.Marshal(pod)
342342
safePod, _ := log.RedactJSON(jsonPod)
343-
clog.WithError(err).WithField("req", req).WithField("pod", string(safePod)).Error("was unable to reach ready state")
343+
clog.WithError(err).WithField("req", req).WithField("pod", string(safePod)).Warn("was unable to reach ready state")
344344
retryErr = err
345345

346346
var tempPod corev1.Pod
@@ -357,7 +357,7 @@ func (m *Manager) StartWorkspace(ctx context.Context, req *api.StartWorkspaceReq
357357
// pod doesn't exist, so we are safe to proceed with retry
358358
return false, nil
359359
}
360-
clog.WithError(getErr).WithField("pod.Namespace", pod.Namespace).WithField("pod.Name", pod.Name).Error("was unable to get pod")
360+
clog.WithError(getErr).WithField("pod.Namespace", pod.Namespace).WithField("pod.Name", pod.Name).Warn("was unable to get pod")
361361
// pod get call failed so we error out
362362
return false, retryErr
363363
}
@@ -369,7 +369,7 @@ func (m *Manager) StartWorkspace(ctx context.Context, req *api.StartWorkspaceReq
369369
// pod doesn't exist, so we are safe to proceed with retry
370370
return false, nil
371371
}
372-
clog.WithError(updateErr).WithField("pod.Namespace", pod.Namespace).WithField("pod.Name", pod.Name).Error("was unable to remove finalizer")
372+
clog.WithError(updateErr).WithField("pod.Namespace", pod.Namespace).WithField("pod.Name", pod.Name).Warn("was unable to remove finalizer")
373373
continue
374374
}
375375
finalizerRemoved = true
@@ -381,7 +381,7 @@ func (m *Manager) StartWorkspace(ctx context.Context, req *api.StartWorkspaceReq
381381

382382
deleteErr := m.Clientset.Delete(rmCtx, &tempPod)
383383
if deleteErr != nil && !k8serr.IsNotFound(deleteErr) {
384-
clog.WithError(deleteErr).WithField("pod.Namespace", pod.Namespace).WithField("pod.Name", pod.Name).Error("was unable to delete pod")
384+
clog.WithError(deleteErr).WithField("pod.Namespace", pod.Namespace).WithField("pod.Name", pod.Name).Warn("was unable to delete pod")
385385
// failed to delete pod, so not going to be able to create a new pod, so bail out
386386
return false, retryErr
387387
}
@@ -397,6 +397,7 @@ func (m *Manager) StartWorkspace(ctx context.Context, req *api.StartWorkspaceReq
397397
}
398398

399399
if err != nil {
400+
clog.WithError(err).WithField("pod.Namespace", pod.Namespace).WithField("pod.Name", pod.Name).Error("was unable to start workspace after backoff")
400401
return nil, xerrors.Errorf("cannot create workspace pod: %w", err)
401402
}
402403

0 commit comments

Comments
 (0)