Skip to content

Commit

Permalink
Some more debugging in skipUnhealthy.
Browse files Browse the repository at this point in the history
  • Loading branch information
markmandel committed Oct 31, 2021
1 parent bf43901 commit ea95f09
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/gameservers/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,17 +246,23 @@ func (hc *HealthController) skipUnhealthy(gs *agonesv1.GameServer) (bool, error)
for _, cs := range pod.Status.ContainerStatuses {
if cs.Name == gs.Spec.Container {
if cs.State.Terminated != nil {
hc.baseLogger.WithField("gs", gs.ObjectMeta.Name).WithField("podStatus", pod.Status).Debug("skipUnhealthy: Container is terminated, returning false")
return false, nil
}
if cs.LastTerminationState.Terminated != nil {
// if the current container is running, and is the ready container, then we know this is some
// other pod update, and we previously had a restart before we got to being Ready, and therefore
// shouldn't move to Unhealthy.
return cs.ContainerID == gs.Annotations[agonesv1.GameServerReadyContainerIDAnnotation], nil
check := cs.ContainerID == gs.Annotations[agonesv1.GameServerReadyContainerIDAnnotation]
if !check {
hc.baseLogger.WithField("gs", gs.ObjectMeta.Name).WithField("gsMeta", gs.ObjectMeta).WithField("podStatus", pod.Status).Debug("skipUnhealthy: Container crashed after Ready, returning false")
}
return check, nil
}
break
}
}

hc.baseLogger.WithField("gs", gs.ObjectMeta.Name).WithField("gsMeta", gs.ObjectMeta).WithField("podStatus", pod.Status).Debug("skipUnhealthy: Should not reach here")
return false, nil
}

0 comments on commit ea95f09

Please sign in to comment.