Skip to content

Commit

Permalink
improvement(k8s): show more pod log lines by default
Browse files Browse the repository at this point in the history
  • Loading branch information
eysi09 authored and edvald committed Oct 14, 2020
1 parent 802f118 commit 91a6976
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions core/src/plugins/kubernetes/status/pod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ResourceStatus } from "./status"
import chalk from "chalk"
import { ServiceState, combineStates } from "../../../types/service"

export const podLogLines = 20
export const POD_LOG_LINES = 30

export function checkPodStatus(pod: KubernetesServerResource<V1Pod>): ServiceState {
const phase = pod.status!.phase
Expand Down Expand Up @@ -147,7 +147,7 @@ export async function getFormattedPodLogs(api: KubeApi, namespace: string, pods:
podName: pod.metadata.name,
// Putting 5000 bytes as a length limit in addition to the line limit, just as a precaution in case someone
// accidentally logs a binary file or something.
containers: await getPodLogs({ api, namespace, pod, byteLimit: 5000, lineLimit: podLogLines }),
containers: await getPodLogs({ api, namespace, pod, byteLimit: 5000, lineLimit: POD_LOG_LINES }),
}
})

Expand Down
6 changes: 4 additions & 2 deletions core/src/plugins/kubernetes/status/workload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
} from "@kubernetes/client-node"
import dedent = require("dedent")
import { getCurrentWorkloadPods } from "../util"
import { getFormattedPodLogs, podLogLines } from "./pod"
import { getFormattedPodLogs, POD_LOG_LINES } from "./pod"
import { ResourceStatus, StatusHandlerParams } from "./status"
import { getResourceEvents } from "./events"

Expand Down Expand Up @@ -89,7 +89,9 @@ export async function checkWorkloadStatus({ api, namespace, resource }: StatusHa
logs += chalk.white("\n\n━━━ Pod logs ━━━\n")
logs +=
chalk.gray(dedent`
<Showing last ${podLogLines} lines per pod in this ${workload.kind}. Run the following command for complete logs>
<Showing last ${POD_LOG_LINES} lines per pod in this ${
workload.kind
}. Run the following command for complete logs>
$ kubectl -n ${namespace} --context=${api.context} logs ${workload.kind.toLowerCase()}/${workload.metadata.name}
`) +
"\n" +
Expand Down

0 comments on commit 91a6976

Please sign in to comment.