Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

<cmd/kubeless/logs>: change some typo and judge all containers in pod #742

Merged
merged 1 commit into from
May 9, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion cmd/kubeless/function/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var logsCmd = &cobra.Command{
}
readyPod, err := utils.GetReadyPod(pods)
if err != nil {
logrus.Fatalf("Can't find the function pod: %v", err)
logrus.Fatalf("No function pod is running: %v", err)
}
podLog := &v1.PodLogOptions{
Container: funcName,
Expand Down
9 changes: 8 additions & 1 deletion pkg/utils/k8sutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,14 @@ func GetPodsByLabel(c kubernetes.Interface, ns, k, v string) (*v1.PodList, error
// GetReadyPod returns the first pod has passed the liveness probe check
func GetReadyPod(pods *v1.PodList) (v1.Pod, error) {
for _, pod := range pods.Items {
if pod.Status.ContainerStatuses[0].Ready {
isPodRunning := true
for _, containerStatus := range pod.Status.ContainerStatuses {
if !containerStatus.Ready {
isPodRunning = false
break
}
}
if isPodRunning {
return pod, nil
}
}
Expand Down