Skip to content

Commit 15c0986

Browse files
authored
chore(k8s): debug level on pod phase mapping
1 parent 605717e commit 15c0986

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

internal/adapters/runtime/kubernetes/game_room_convert.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -300,14 +300,14 @@ func convertPodStatus(pod *v1.Pod) game_room.InstanceStatus {
300300
switch pod.Status.Phase {
301301
case v1.PodSucceeded:
302302
// Completed pods should not be considered available; treat as terminating
303-
zap.L().Info("pod phase -> instance status mapping", zap.String("pod", pod.Namespace+"/"+pod.Name), zap.String("phase", string(pod.Status.Phase)), zap.String("mappedTo", game_room.InstanceTerminating.String()))
303+
zap.L().Debug("pod phase -> instance status mapping", zap.String("pod", pod.Namespace+"/"+pod.Name), zap.String("phase", string(pod.Status.Phase)), zap.String("mappedTo", game_room.InstanceTerminating.String()))
304304
return game_room.InstanceStatus{Type: game_room.InstanceTerminating, Description: "PodSucceeded"}
305305
case v1.PodFailed:
306-
zap.L().Info("pod phase -> instance status mapping", zap.String("pod", pod.Namespace+"/"+pod.Name), zap.String("phase", string(pod.Status.Phase)), zap.String("mappedTo", game_room.InstanceError.String()))
306+
zap.L().Debug("pod phase -> instance status mapping", zap.String("pod", pod.Namespace+"/"+pod.Name), zap.String("phase", string(pod.Status.Phase)), zap.String("mappedTo", game_room.InstanceError.String()))
307307
return game_room.InstanceStatus{Type: game_room.InstanceError, Description: "PodFailed"}
308308
case v1.PodUnknown:
309309
// Unknown pods should not be treated as available
310-
zap.L().Warn("pod phase unknown; mapping to error", zap.String("pod", pod.Namespace+"/"+pod.Name), zap.String("phase", string(pod.Status.Phase)), zap.String("mappedTo", game_room.InstanceError.String()))
310+
zap.L().Debug("pod phase unknown; mapping to error", zap.String("pod", pod.Namespace+"/"+pod.Name), zap.String("phase", string(pod.Status.Phase)), zap.String("mappedTo", game_room.InstanceError.String()))
311311
return game_room.InstanceStatus{Type: game_room.InstanceError, Description: "PodUnknown"}
312312
}
313313

@@ -316,7 +316,7 @@ func convertPodStatus(pod *v1.Pod) game_room.InstanceStatus {
316316
if state.Waiting != nil {
317317
for _, invalidState := range invalidPodWaitingStates {
318318
if state.Waiting.Reason == invalidState {
319-
zap.L().Warn(
319+
zap.L().Debug(
320320
"container waiting in invalid state; mapping to error",
321321
zap.String("pod", pod.Namespace+"/"+pod.Name),
322322
zap.String("container", containerStatus.Name),
@@ -335,7 +335,7 @@ func convertPodStatus(pod *v1.Pod) game_room.InstanceStatus {
335335
// If container is terminated, classify based on the termination reason
336336
if state.Terminated != nil {
337337
if state.Terminated.Reason == "Completed" || state.Terminated.ExitCode == 0 {
338-
zap.L().Info(
338+
zap.L().Debug(
339339
"container terminated successfully; mapping to terminating",
340340
zap.String("pod", pod.Namespace+"/"+pod.Name),
341341
zap.String("container", containerStatus.Name),
@@ -348,7 +348,7 @@ func convertPodStatus(pod *v1.Pod) game_room.InstanceStatus {
348348
Description: state.Terminated.Reason,
349349
}
350350
}
351-
zap.L().Warn(
351+
zap.L().Debug(
352352
"container terminated with error; mapping to error",
353353
zap.String("pod", pod.Namespace+"/"+pod.Name),
354354
zap.String("container", containerStatus.Name),
@@ -385,14 +385,14 @@ func convertPodStatus(pod *v1.Pod) game_room.InstanceStatus {
385385
// This allows us to catch container-level errors even for Running/Pending pods
386386
switch pod.Status.Phase {
387387
case v1.PodPending:
388-
zap.L().Info("pod phase -> instance status mapping", zap.String("pod", pod.Namespace+"/"+pod.Name), zap.String("phase", string(pod.Status.Phase)), zap.String("mappedTo", game_room.InstancePending.String()))
388+
zap.L().Debug("pod phase -> instance status mapping", zap.String("pod", pod.Namespace+"/"+pod.Name), zap.String("phase", string(pod.Status.Phase)), zap.String("mappedTo", game_room.InstancePending.String()))
389389
return game_room.InstanceStatus{Type: game_room.InstancePending, Description: ""}
390390
case v1.PodRunning:
391-
zap.L().Info("pod phase -> instance status mapping", zap.String("pod", pod.Namespace+"/"+pod.Name), zap.String("phase", string(pod.Status.Phase)), zap.String("mappedTo", game_room.InstanceReady.String()))
391+
zap.L().Debug("pod phase -> instance status mapping", zap.String("pod", pod.Namespace+"/"+pod.Name), zap.String("phase", string(pod.Status.Phase)), zap.String("mappedTo", game_room.InstanceReady.String()))
392392
return game_room.InstanceStatus{Type: game_room.InstanceReady, Description: ""}
393393
default:
394394
// Handle any future pod phases that might be added to Kubernetes
395-
zap.L().Warn("unexpected pod phase; mapping to error", zap.String("pod", pod.Namespace+"/"+pod.Name), zap.String("phase", string(pod.Status.Phase)), zap.String("mappedTo", game_room.InstanceError.String()))
395+
zap.L().Debug("unexpected pod phase; mapping to error", zap.String("pod", pod.Namespace+"/"+pod.Name), zap.String("phase", string(pod.Status.Phase)), zap.String("mappedTo", game_room.InstanceError.String()))
396396
return game_room.InstanceStatus{Type: game_room.InstanceError, Description: fmt.Sprintf("UnexpectedPodPhase: %s", pod.Status.Phase)}
397397
}
398398
}

0 commit comments

Comments
 (0)