Added logs command and integrated it into the CLI structure.#108
Merged
LorenzoTettamanti merged 1 commit intoCortexFlow:feature/clifrom Jun 21, 2025
PranavVerma-droid:feature/cli
Merged
Added logs command and integrated it into the CLI structure.#108LorenzoTettamanti merged 1 commit intoCortexFlow:feature/clifrom PranavVerma-droid:feature/cli
logs command and integrated it into the CLI structure.#108LorenzoTettamanti merged 1 commit intoCortexFlow:feature/clifrom
PranavVerma-droid:feature/cli
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces a new logs feature into the CLI tool, enabling users to retrieve logs from Kubernetes pods filtered by service or component. Key changes include:
- Adding the new logs module and integrating it into the CLI command parser.
- Implementing helper functions to validate namespaces, list pods by service/component, and fetch pod logs.
- Creating a new Component enum to distinguish between control-plane and data-plane components.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cli/src/mod.rs | Added logs module registration. |
| cli/src/main.rs | Registered logs command and defined LogsArgs for argument parsing. |
| cli/src/logs.rs | Implemented the logs_command function and supporting helper functions to retrieve and display Kubernetes logs. |
Comment on lines
+139
to
+142
|
|
||
| // intersection | ||
| service_pods.into_iter() | ||
| .filter(|pod| component_pods.contains(pod)) |
There was a problem hiding this comment.
Consider optimizing the intersection of pods by converting one of the pod lists (e.g., component_pods) into a HashSet to reduce the time complexity from O(n²) to O(n).
Suggested change
| // intersection | |
| service_pods.into_iter() | |
| .filter(|pod| component_pods.contains(pod)) | |
| let component_pods_set: HashSet<_> = component_pods.into_iter().collect(); | |
| // intersection | |
| service_pods.into_iter() | |
| .filter(|pod| component_pods_set.contains(pod)) |
LorenzoTettamanti
approved these changes
Jun 21, 2025
Member
LorenzoTettamanti
left a comment
There was a problem hiding this comment.
Hi Pranav, great work so far. Merging the changes🚀
70ae38e
into
CortexFlow:feature/cli
3 of 7 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request adds a new
logsfeature to the CLI tool, allowing users to get logs for specific services, components, or all pods in a namespace. The updates involve adding logic to interact with Kubernetes usingkubectlcommands and incorporating the new feature into the CLI framework.New
logsfeature implementation:cli/src/logs.rs: A detailed implementation for thelogs_commandfunction was added, which retrieves logs throughkubectl. It features helper functions for validating namespaces, retrieving pods based on service or component labels, and fetching logs for individual pods. A newComponentenum was created to represent control-plane and data-plane components.Integration into CLI framework:
cli/src/main.rs:logsmodule and command were registered in the CLI structure.LogsArgsstruct was added to define arguments for thelogscommand, includingservice,component, andnamespace.logs_commandfunction was integrated into the CLI argument parser, allowing the execution of thelogscommand.logsmodule and its related command.These updates improve the functionality of the CLI tool by giving users the ability to retrieve detailed logs directly from their Kubernetes cluster.