From 0682d3af782cf262e40a864ad8274139ccb4569b Mon Sep 17 00:00:00 2001 From: Mark Mandel Date: Wed, 20 Sep 2023 16:34:18 -0700 Subject: [PATCH] Don't log when a pod can't be found on startup Sometimes pods can't be found yet - that's not a big deal, and shouldn't be logged. So we're not doing that now! Also found a superfluous creation of a LogEntry that wasn't doing anything so removed that too. --- pkg/gameservers/controller.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/gameservers/controller.go b/pkg/gameservers/controller.go index 3b4d48208c..2d83bcc15f 100644 --- a/pkg/gameservers/controller.go +++ b/pkg/gameservers/controller.go @@ -609,7 +609,6 @@ func (c *Controller) createGameServerPod(ctx context.Context, gs *agonesv1.GameS gs, err = c.moveToErrorState(ctx, gs, err.Error()) return gs, err default: - loggerForGameServer(gs, c.baseLogger).WithField("pod", pod).WithError(err) c.recorder.Eventf(gs, corev1.EventTypeWarning, string(gs.Status.State), "error creating Pod for GameServer %s", gs.Name) return gs, errors.Wrapf(err, "error creating Pod for GameServer %s", gs.Name) } @@ -787,6 +786,12 @@ func (c *Controller) syncGameServerStartingState(ctx context.Context, gs *agones // so if there is an error of any kind, then move this to queue backoff pod, err := c.gameServerPod(gs) if err != nil { + // expected to happen, so don't log it. + if k8serrors.IsNotFound(err) { + return nil, workerqueue.NewDebugError(err) + } + + // do log if it's something other than NotFound, since that's weird. return nil, err } if pod.Spec.NodeName == "" {