-
Notifications
You must be signed in to change notification settings - Fork 238
feat(capture download): Add ability to download capture files based on capture name #1564
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.
I miss some tests to make sure everything is working as expected
Signed-off-by: Kamil <kamil.prz@gmail.com>
Signed-off-by: Kamil <kamil.prz@gmail.com>
Signed-off-by: Kamil <kamil.prz@gmail.com>
Signed-off-by: Alex Castilio dos Santos <alexsantos@microsoft.com>
…eJobs; add retrier to verifyJobs Signed-off-by: Alex Castilio dos Santos <alexsantos@microsoft.com>
Signed-off-by: Alex Castilio dos Santos <alexsantos@microsoft.com>
Signed-off-by: Alex Castilio dos Santos <alexsantos@microsoft.com>
Signed-off-by: Alex Castilio dos Santos <alexsantos@microsoft.com>
Signed-off-by: Alex Castilio dos Santos <alexsantos@microsoft.com>
Signed-off-by: Alex Castilio dos Santos <alexsantos@microsoft.com>
Signed-off-by: Alex Castilio dos Santos <alexsantos@microsoft.com>
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
This PR adds support for downloading captures by name or blob URL, enhances capture metadata via pod annotations, and refactors timestamp handling to use metav1.Time
.
- Implement
kubectl retina capture download
command for cluster and blob-based downloads - Annotate capture pods with filename, timestamp, and host path
- Refactor timestamp APIs and update providers, tests, and CRD translation
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
test/e2e/scenarios/capture/scenarios.go | Add E2E scenario for capture create |
test/e2e/scenarios/capture/install-retina-plugin.go | Install kubectl-retina plugin for E2E tests |
test/e2e/retina_e2e_test.go | Invoke capture validation in the end-to-end test suite |
test/e2e/jobs/jobs.go | Register ValidateCapture job |
pkg/capture/utils/annotations.go | Add helper to extract pod annotations from Capture CR |
pkg/capture/provider/network_capture_win.go | Update StartTimestamp to use metav1.Time |
pkg/capture/provider/network_capture_unix.go | Update StartTimestamp to use metav1.Time |
pkg/capture/provider/network_capture_test.go | Adjust tests to new timestamp type |
pkg/capture/file/timestamp.go | Replace custom Timestamp with metav1.Time helpers |
pkg/capture/file/capture_filename.go | Use TimeToString for timestamp formatting |
pkg/capture/crd_to_job_test.go | Update test to call StringToTime |
pkg/capture/crd_to_job.go | Add pod annotations and wiring for capture filenames |
pkg/capture/constants/job_env.go | Add new environment keys for namespace, pod, container |
pkg/capture/constants/annotations.go | Define annotation keys for capture metadata |
pkg/capture/capture_manager_test.go | Update test to new timestamp type |
pkg/capture/capture_manager.go | Refactor captureStartTimestamp to use StringToTime |
docs/04-Captures/02-cli.md | Document capture download command |
cli/cmd/capture/table_util.go | Change capture list output to one job per line |
cli/cmd/capture/download.go | Implement download logic and flags |
cli/cmd/capture/create.go | Annotate new Capture CRD with StartTime status |
Comments suppressed due to low confidence (3)
cli/cmd/capture/download.go:75
- Add explicit validation to ensure at least one of
--name
or--blob-url
is provided, and return an error or usage message if both are empty.
RunE: func(*cobra.Command, []string) error {
cli/cmd/capture/download.go:384
- Reading the entire blob into memory can lead to high memory usage for large captures. Consider streaming directly to disk or using an
io.Copy
to write to a file.
blobData, err := io.ReadAll(readCloser)
pkg/capture/crd_to_job.go:394
- Remove these debug print statements from production code or guard them behind a verbose/log level flag to avoid cluttering output.
fmt.Println("#########################")
in the unhappy path, if a capture isn't started, or has problem, download fails silently, let's give some feedback
this also seems to be the case just calling
|
Signed-off-by: Alex Castilio dos Santos <alexsantos@microsoft.com>
Signed-off-by: Alex Castilio dos Santos <alexsantos@microsoft.com>
Signed-off-by: Alex Castilio dos Santos <alexsantos@microsoft.com>
Added validation of $ ./artifacts/kubectl-retina capture download
Error: either --name or --blob-url must be specified
Usage:
kubectl-retina capture download [flags]
Examples:
# List Retina capture jobs
kubectl retina capture list
# Download the capture file(s) created using the capture name
kubectl retina capture download --name <capture-name>
# Download the capture file(s) created using the capture name and define output location
kubectl retina capture download --name <capture-name> -o <output-location> |
Description
This PR introduces the ability to download captures via the Retina CLI.
It extends the
retina capture download
cmd to be able to download captures based on the capture name / blobURL.This enables the manual download of captures which occur after this PR.
Change list:
retina capture list
to be more readable.--blobUrl
rather than an ENV variable.retina capture download --name download-me -o /tmp/retina/
retina capture create
Related Issue
N/A
Checklist
git commit -S -s ...
). See this documentation on signing commits.Screenshots
Examples and flags documentation
k retina capture list
After

Before

Downloading a capture based on the capture name
E2E Retina Capture Create