-
Notifications
You must be signed in to change notification settings - Fork 73
[Feature] Previous Pod Logs in DebugPackage #1899
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
Conversation
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.
Pull Request Overview
Adds support for fetching and including previous container logs when pods have restarted.
- Insert
kubernetesPreviousCorePodLogsExtract
calls alongside existing log extraction. - Implement new
kubernetesPreviousCorePodLogsExtract
helper function. - Update CHANGELOG to record the new feature.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
pkg/debug_package/generators/kubernetes/kubernetes_core_pods.go | Added conditional calls for previous logs and implemented extractor function |
CHANGELOG.md | Added entry for "Previous Pod Logs in DebugPackage" |
Comments suppressed due to low confidence (2)
pkg/debug_package/generators/kubernetes/kubernetes_core_pods.go:86
- New logic for fetching previous pod logs lacks test coverage; consider adding unit or integration tests to validate both successful log retrieval and error conditions.
func kubernetesPreviousCorePodLogsExtract(ctx context.Context, client kclient.Client, item *core.Pod, container string) shared.File {
CHANGELOG.md:15
- [nitpick] Align the indentation of this entry with existing list items (e.g., prefix with two spaces) to maintain consistent formatting in the CHANGELOG.
- (Feature) Previous Pod Logs in DebugPackage
@@ -45,6 +45,10 @@ func kubernetesCorePodLogs(ctx context.Context, logger zerolog.Logger, client kc | |||
} | |||
|
|||
files <- kubernetesCorePodLogsExtract(ctx, client, item, s[id].Name) | |||
|
|||
if s[id].RestartCount > 0 { |
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.
This conditional block to fetch previous pod logs is repeated multiple times; consider refactoring into a shared helper or loop to reduce duplication and improve maintainability.
Copilot uses AI. Check for mistakes.
} | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func kubernetesPreviousCorePodLogsExtract(ctx context.Context, client kclient.Client, item *core.Pod, container string) shared.File { |
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.
Add a doc comment for kubernetesPreviousCorePodLogsExtract
explaining its purpose, parameters, and return value to match the style of other extractor functions.
Copilot uses AI. Check for mistakes.
No description provided.