Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When the pod phase is running, the status reason is also set to running #367

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions pkg/virtualkubelet/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ func handleContainersUpdate(ctx context.Context, podRemoteStatus types.PodStatus
podRunning = true
log.G(ctx).Debug("Pod " + podRemoteStatus.PodName + ": Service " + containerRemoteStatus.Name + " is running on Sidecar")
podRefInCluster.Status.ContainerStatuses[index].Ready = true
podRefInCluster.Status.ContainerStatuses[index].State.Running = containerRemoteStatus.State.Running
}
}
}
Expand Down Expand Up @@ -712,10 +713,16 @@ func checkPodsStatus(ctx context.Context, p *Provider, podsList []*v1.Pod, token
failedReason := ""
failedReasonInit := ""

nContainersInPod := len(podRemoteStatus.Containers)
nContainersInPod := 0
if podRemoteStatus.Containers != nil {
nContainersInPod = len(podRemoteStatus.Containers)
}
counterOfTerminatedContainers := 0

nInitContainersInPod := len(podRemoteStatus.InitContainers)
nInitContainersInPod := 0
if podRemoteStatus.InitContainers != nil {
nInitContainersInPod = len(podRemoteStatus.InitContainers)
}
counterOfTerminatedInitContainers := 0

log.G(ctx).Debug("Number of containers in POD: " + strconv.Itoa(nContainersInPod))
Expand Down Expand Up @@ -771,6 +778,7 @@ func checkPodsStatus(ctx context.Context, p *Provider, podsList []*v1.Pod, token
if podRunning && podRefInCluster.Status.Phase != v1.PodRunning { // do not update the status if it is already running
podRefInCluster.Status.Phase = v1.PodRunning
podRefInCluster.Status.Conditions = append(podRefInCluster.Status.Conditions, v1.PodCondition{Type: v1.PodReady, Status: v1.ConditionTrue})
podRefInCluster.Status.Reason = "Running"
}
}
} else {
Expand Down
Loading