-
Notifications
You must be signed in to change notification settings - Fork 60
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
new: driver command #343
new: driver command #343
Conversation
About
(ok this is a super stupid example btw!) |
4bc454c
to
8503a93
Compare
Example output:
|
8b8730b
to
fceb81a
Compare
Makefile
Outdated
@@ -56,7 +56,7 @@ fmt: gci addlicense | |||
go mod tidy | |||
go fmt ./... | |||
find . -type f -name '*.go' -a -exec $(GCI) write -s standard -s default -s "prefix(github.com/falcosecurity/falcoctl)" {} \; | |||
find . -type f -name '*.go' -exec $(ADDLICENSE) -l apache -c "The Falco Authors" -y "$(shell date +%Y)" {} \; | |||
find . -type f -name '*.go' -exec $(ADDLICENSE) -l apache -s -c "The Falco Authors" -y "$(shell date +%Y)" {} \; |
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.
-s Include SPDX identifier in license header. Set -s=only to only include SPDX identifier.
) | ||
|
||
// NewDriverCmd returns the driver command. | ||
func NewDriverCmd(ctx context.Context, opt *commonoptions.Common) *cobra.Command { |
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.
driver
subcmd is only available on linux systems.
|
||
// NewDriverCmd returns an empty driver command since it is not supported on non linuxes | ||
func NewDriverCmd(ctx context.Context, opt *commonoptions.Common) *cobra.Command { | ||
return &cobra.Command{} |
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.
By returning an empty command, cobra will skip it.
cmd/driver/prepare/prepare.go
Outdated
|
||
d, err := driverdistro.DiscoverDistro(o.Printer, o.HostRoot) | ||
if err != nil { | ||
if errors.Is(err, driverdistro.ErrUnsupported) && o.Build { |
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.
errUnsupported
returns a generic distro, to attempt a build.
What is implemented so far:
What we miss:
Open points:
|
/hold |
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 the PR, left some comments.
d831e84
to
cc6443f
Compare
I consider this PR ready! |
c45fcb7
to
25aeda1
Compare
Squashed to a single commit :) @alacuku is now happy 😃 |
25aeda1
to
faefd7d
Compare
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
It exposes 4 subcmds: * `install` to install (ie: either download or build) kmod or eBPF probe * `cleanup` to cleanup a driver * `printenv` to print environment variables about driver-loader * `config` to configure the driver-loader feature Signed-off-by: Federico Di Pierro <[email protected]>
faefd7d
to
1c40175
Compare
/unhold |
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alacuku, FedeDP, maxgio92 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Great job @FedeDP! 👏🏻 ❤️ |
Signed-off-by: Federico Di Pierro <[email protected]>
Signed-off-by: Federico Di Pierro <[email protected]>
Signed-off-by: Federico Di Pierro <[email protected]>
Signed-off-by: Federico Di Pierro <[email protected]>
Signed-off-by: Federico Di Pierro <[email protected]>
What type of PR is this?
/kind feature
Any specific area of the project related to this PR?
/area library
/area cli
What this PR does / why we need it:
First draft at implementing
falcoctl driver
command, see #327Which issue(s) this PR fixes:
Eventually #327 will get fixed, but i don't think a single PR will make it :)
Fixes #
Special notes for your reviewer:
What we need:
select
subcmd with possibility for an "autoselection" smart logic in place; this is not required by Falco but might be useful for other consumers of the falcoctl libraries and for us in the futureselect
stores the currently selected driver in the falcoctl configselect
must be able to communicate to Falco the driver it must use (we need a patch to allow Falco config to specify a driver to be used) -> new: driver selection in falco.yaml falco#2413 -> this is implemented in falcoctl, even if will need some more fixesselect
testsprepare
skeleton (this will be the step where we either download or build the drivers)autoload of targetRetired with new: driver command #343 (comment)driverversion
from running Falco process, if anyprepare
downloadprepare
buildget_target_id
falco-driver-loader function)prepare
testsecho " DRIVER_INSECURE_DOWNLOAD whether you want to allow insecure downloads or not"
-> DEPRECATEDecho " DRIVER_CURL_OPTIONS specify additional options to be passed to curl command used to download Falco drivers"
echo " DRIVER_KERNEL_RELEASE specify the kernel release for which to download/build the driver in the same format used by 'uname -r' (e.g. '6.1.0-10-cloud-amd64')"
echo " DRIVER_KERNEL_VERSION specify the kernel version for which to download/build the driver in the same format used by 'uname -v' (e.g. '#1 SMP PREEMPT_DYNAMIC Debian 6.1.38-2 (2023-07-27)')"