feat(capture download): Add ability to download capture files based on capture name
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.
- This is because in order to make retrospective downloads possible, the download pods are now annotated with some metadata. Captures prior to this PR won't have this metadata, and it won't be possible to download them.
Change list:
- Update
retina capture listto be more readable. - Change BlobURL download to be a flag
--blobUrlrather than an ENV variable.- This makes it more consistent with the rest of the CLI.
- Add annotations to capture pods to store metadata about the capture.
- Download capture file from host node by passing name of capture which created the file.
- By default, creates a folder in the current directory based on the name of the capture, which will contain the tarball.
- Can set the output directory. (-o)
- Example:
retina capture download --name download-me -o /tmp/retina/
- Example:
Related Issue
N/A
Checklist
- [x] I have read the contributing documentation.
- [x] I signed and signed-off the commits (
git commit -S -s ...). See this documentation on signing commits. - [x] I have correctly attributed the author(s) of the code.
- [x] I have tested the changes locally.
- [x] I have followed the project's style guidelines.
- [x] I have updated the documentation, if necessary.
- [x] I have added tests, if applicable.
Screenshots
Examples and flags documentation
k retina capture list
After
Before
Downloading a capture based on the capture name
Decided in the end to leave extract functionality out of this PR and focus solely on getting the download operation to work consistently and reliably. Will add it back in another PR later down the line.
in the unhappy path, if a capture isn't started, or has problem, download fails silently, let's give some feedback
$ ./bin/kubectl-retina capture list
NAMESPACE CAPTURE NAME JOB COMPLETIONS AGE
default retina-capture retina-capture-8dl8v 0/1
$ ./bin/kubectl-retina capture download retina-capture
this also seems to be the case just calling
$ ./bin/kubectl-retina capture download
in the unhappy path, if a capture isn't started, or has problem, download fails silently, let's give some feedback
$ ./bin/kubectl-retina capture list NAMESPACE CAPTURE NAME JOB COMPLETIONS AGE default retina-capture retina-capture-8dl8v 0/1 $ ./bin/kubectl-retina capture download retina-capturethis also seems to be the case just calling
$ ./bin/kubectl-retina capture download
Added validation of --name or --blob-url as one of them is required:
$ ./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>