Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement health and logs commands #16
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
base: main
Are you sure you want to change the base?
Implement health and logs commands #16
Changes from all commits
cf1fd8bFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Silent catch swallows Docker errors without logging.
The empty catch block means Docker client initialization errors, network issues, or permission problems are silently ignored. Users won't know why Docker logs failed before falling back to Kubernetes.
🔍 Add minimal logging for Docker fallback
📝 Committable suggestion
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: KDM-cli/kdm-cli
Length of output: 782
🏁 Script executed:
Repository: KDM-cli/kdm-cli
Length of output: 41
🏁 Script executed:
# Check the full context of the logs.ts file to understand the api object head -80 src/commands/logs.tsRepository: KDM-cli/kdm-cli
Length of output: 2175
🏁 Script executed:
Repository: KDM-cli/kdm-cli
Length of output: 41
🏁 Script executed:
# Find the getK8sApi implementation cat -n src/kubernetes/client.tsRepository: KDM-cli/kdm-cli
Length of output: 1315
🏁 Script executed:
Repository: KDM-cli/kdm-cli
Length of output: 308
🌐 Web query:
@kubernetes/client-node readNamespacedPodLog method signature parameters options object💡 Result:
In
@kubernetes/client-node(TypeScript/JavaScript), CoreV1Api.readNamespacedPodLog is generated and can be called in either a positional-arguments form or (more reliably) an options-object form. 1) Options-object form (recommended) Signature shape (from usage): readNamespacedPodLog({ name, namespace, container,...otherQueryParams }) [1] Example that works: await k8sApi.readNamespacedPodLog({ name: 'nginx', namespace: 'default', container: 'nginx' }) [1] 2) Positional-arguments form (what the generated client expects) People call it with multiple positional parameters (name, namespace, container, follow,...), e.g. the reported call looks like: readNamespacedPodLog('ben', 'default', 'node-red', true, false, undefined, "true", false, undefined, 50, true) [2] Because the repository’s auto-generated docs have been noted as occasionally out-of-date/broken, the most dependable way to get the exact parameter order in your installed version is to inspect the generated code or your IDE IntelliSense (the maintainers explicitly recommend this when docs don’t match) [1]. 3) “options” object parameter You’ll also see a trailing “options” object in other API methods; for readNamespacedPodLog specifically, the GitHub issue on follow=true explains that the generated client’s typing/docs around streaming/follow behavior may not match the underlying REST semantics, and points to custom log handling instead of relying on the generated method for streaming/tailing [2]. 4) Important behavioral note: follow=true doesn’t work as expected with the generated method When follow=true is used, readNamespacedPodLog can “hang” (never resolve its promise), because follow causes the server-side HTTP connection to stay open and the OpenAPI-generated client expects the call to terminate [2]. The follow=true behavior is therefore client-library-specific and may require custom handling (the maintainer points to a custom log implementation in the repo) [2]. If you tell me your exact@kubernetes/client-nodeversion (and whether you want CoreV1Api vs another API), I can extract the exact readNamespacedPodLog TypeScript signature (parameter names and order) for that version from the generated coreV1Api.ts source in that release.Citations:
🌐 Web query:
@kubernetes/client-node CoreV1Api readNamespacedPodLog API documentation💡 Result:
@kubernetes/client-nodeCoreV1Api readNamespacedPodLog (JavaScript/TypeScript) documentation summary (as of today, 2026-05-14): 1) What it does / endpoint - The CoreV1Api method ReadNamespacedPodLog maps to the Kubernetes REST endpoint: GET /api/v1/namespaces/{namespace}/pods/{name}/log [1]. 2) How to call it in@kubernetes/client-node- You create the API client via makeApiClient(CoreV1Api) and then call readNamespacedPodLog [2]. - Example (from the@kubernetes/client-nodepython example for the analogous CoreV1Api method): v1.read_namespaced_pod_log(name=pod_name, namespace=namespace, container=container_name, tail_lines=5) [3]. - Example (JavaScript client usage; minimal parameters): k8sApi.readNamespacedPodLog(name, namespace) and the response body contains the logs [3]. 3) Parameters you typically care about (and why docs may be confusing) - The method signature includes required pod name and namespace (and an optional container), plus common log query options like follow, previous, sinceSeconds, tailLines, limitBytes, etc. The exact signature is auto-generated and should be treated as the source of truth for your installed client version. - There have been issues where the auto-generated docs/signatures were incorrect or misleading for readNamespacedPodLog (for example, required arguments not matching, or docs being out of date). In one report, the fix was to consult the generated code / correct signature, because the published docs were out of date [4]. 4) follow=true behavior (important edge case) - With follow enabled, log streaming behavior may cause the client promise to not resolve as expected (because the HTTP connection is kept open). This is discussed in the kubernetes-client/javascript issue tracker; follow=true “never closes the TCP stream” / the generated client only understands RESTful semantics that assume termination [5]. 5) Getting the most authoritative, up-to-date “documentation” for your installed version -@kubernetes/client-nodemaintainers point out that “the Kubernetes API Reference is the source-of-truth” for the generated clients and that TypeDoc-generated docs exist and can be built locally [2]. Practical guidance: - Prefer building/inspecting the TypeDoc or generated source for your exact installed@kubernetes/client-nodeversion if you need the exact readNamespacedPodLog parameter order/types (since there have been historical doc/sig mismatches) [2][4]. - If you use follow=true, don’t await completion expecting a finite result; instead treat it as a stream and handle it accordingly [5].Citations:
🏁 Script executed:
Repository: KDM-cli/kdm-cli
Length of output: 41
🏁 Script executed:
Repository: KDM-cli/kdm-cli
Length of output: 412
Use the options object pattern for
readNamespacedPodLoginstead of positional arguments.Passing 10
undefinedvalues to reach thetailLinesparameter is fragile and unmaintainable. The@kubernetes/client-nodelibrary supports an options-object form that is both clearer and more resistant to future breaking changes:🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.