-
Notifications
You must be signed in to change notification settings - Fork 39
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
Reposupport #69
Reposupport #69
Conversation
models/l3afd.go
Outdated
MapArgs L3afDNFArgs `json:"map_args"` // Config BPF Map of arguments | ||
ConfigArgs L3afDNFArgs `json:"config_args"` // Map of arguments to config command | ||
MonitorMaps []L3afDNFMetricsMap `json:"monitor_maps"` // Metrics BPF maps | ||
DownloadUrl string `json:"ebpf_program_repo_name"` // Download url for Program |
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.
Can we rename the variable to something more related to eBPF Package repository, for ex. EPRUrl. Also, can we have the json tag as ebpf_package_repo_url
models/l3afd.go
Outdated
MapArgs L3afDNFArgs `json:"map_args"` // Config BPF Map of arguments | ||
ConfigArgs L3afDNFArgs `json:"config_args"` // Map of arguments to config command | ||
MonitorMaps []L3afDNFMetricsMap `json:"monitor_maps"` // Metrics BPF maps | ||
DownloadUrl string `json:"ebpf_program_repo_name"` // Download url for Program |
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.
Can we rename the variable to something more related to eBPF Package repository, for ex. EPRUrl. Also, can we have the json tag as ebpf_package_repo_url
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 have changed variables names
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.
Thanks for doing this! Changes look good so far.
https://github.com/l3af-project/l3afd/blob/main/docs/CONTRIBUTING.md#guidelines-for-pull-requests says:
Describe the tests that you ran to verify your changes and add/update test cases
Update relevant docs, especially if you've changed APIs
and also
PRs are expected to have 100% test coverage for added code. This can be verified with a coverage build. If your PR cannot have 100% coverage for some reason please clearly explain why when you open it.
What about documentation changes for this?
What about tests that verify that local files work? (PR #66 added some tests, but since this PR is separate I assume that PR doesn't cover tests for this PR)
kf/bpf.go
Outdated
// "file://" ---> has size 7 | ||
// "Http://" ---> has size 7 |
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.
// "file://" ---> has size 7 | |
// "Http://" ---> has size 7 | |
// "file://" ---> has size 7 | |
// "http://" ---> has size 7 |
@Atul-source Can you update api documentation https://github.com/l3af-project/l3afd/blob/main/docs/api/README.md |
docs/api/README.md
Outdated
@@ -15,6 +15,7 @@ The payload will look more like this standard JSON: | |||
"name": "ratelimiting", | |||
"seq_id": 1, | |||
"artifact": "l3af_ratelimiting.tar.gz", | |||
"ebpf_package_repo_url": "http://www.exampleebpf.com/l3af_ratelimiting.tar.gz" |
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.
Let's put example URL of domain we own, such as l3af.io and use https as an example
kf/bpf.go
Outdated
buf := &bytes.Buffer{} | ||
// "file://" ---> has size 7 | ||
// "http://" ---> has size 7 | ||
if len(b.Program.EPRUrl) >= 7 { |
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.
We should just use url.parse to determine the scheme (http, https, file, ...). File should have three slashes "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.
Left some comments for changes
kf/bpf.go
Outdated
} | ||
} | ||
} else { | ||
kfRepoURL, err := url.Parse(conf.KFRepoURL) |
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.
Future PR we should rename this to eBPFRepoURL
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 will do a separate PR for a change of KFRepoURL --> eBPFRepoURL
kf/bpf.go
Outdated
if strings.Contains(header.Name, "..") { | ||
return fmt.Errorf("zipped file contians filepath (%s) that includes (..)", header.Name) | ||
} | ||
if strings.Contains(header.Name, "..") { |
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.
Can we have a similar check as the zip filename check above with filepath.Clean() ? It probably also makes breaking out this code, so as we add support for new compression algorithms the filename checking logic remains the same and can be managed in single place.
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.
if we check for somewhere else using the helper function it is giving security issues.
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.
breaking out into a separate function vs. having similar code 2+ more times seems to make sense, not sure why this is alerting if we make this change. We can discuss more on call
…positories Signed-off-by: a0p0ie5 <[email protected]>
Signed-off-by: a0p0ie5 <[email protected]>
Signed-off-by: a0p0ie5 <[email protected]>
Signed-off-by: a0p0ie5 <[email protected]>
Signed-off-by: a0p0ie5 <[email protected]>
Signed-off-by: a0p0ie5 <[email protected]>
Signed-off-by: a0p0ie5 <[email protected]>
Signed-off-by: a0p0ie5 <[email protected]>
Signed-off-by: a0p0ie5 <[email protected]>
Co-authored-by: Dave Thaler <[email protected]> Signed-off-by: a0p0ie5 <[email protected]>
Co-authored-by: Dave Thaler <[email protected]> Signed-off-by: a0p0ie5 <[email protected]>
Co-authored-by: jniesz <[email protected]> Signed-off-by: a0p0ie5 <[email protected]>
Signed-off-by: a0p0ie5 <[email protected]>
Signed-off-by: a0p0ie5 <[email protected]>
Signed-off-by: a0p0ie5 <[email protected]>
Signed-off-by: a0p0ie5 <[email protected]>
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.
LGTM
Changes look good, but needs a test added per https://github.com/l3af-project/l3afd/blob/main/docs/CONTRIBUTING.md#guidelines-for-pull-requests which says:
and also
|
Signed-off-by: a0p0ie5 <[email protected]>
Signed-off-by: a0p0ie5 <[email protected]>
Signed-off-by: a0p0ie5 <[email protected]>
Signed-off-by: a0p0ie5 <[email protected]>
Signed-off-by: a0p0ie5 <[email protected]>
Signed-off-by: a0p0ie5 <[email protected]>
Signed-off-by: a0p0ie5 <[email protected]>
This PR is for issue #18
Before you could only have a single repository defined for all eBPF programs in the global config. This change enables the ability to define an eBPF repository per program.