-
Notifications
You must be signed in to change notification settings - Fork 905
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
Allow specifying explicit kernel release and version for falco-driver-loader
#2728
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
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.
Wouldn't it be better to use
KERNEL_RELEASE
here?I mean, i think we should use
KERNEL_RELEASE
andKERNEL_VERSION
everywhere, not theirDRIVER_
counterparts.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.
Good catch!
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.
The places where I used e.g.
DRIVER_KERNEL_RELEASE
are places where there was an explicit call touname -r
. Note that the values ofKERNEL_RELEASE
andKERNEL_VERSION
change throughout the script, which can be tricky to follow as there is lots of distro-specific logic and special cases.In this case, for example,
KERNEL_RELEASE
may not hold the same value asuname -r
at this point in the execution, because we do various assignments to this variable earlier:falco/scripts/falco-driver-loader
Line 168 in b2ad928
falco/scripts/falco-driver-loader
Line 196 in b2ad928
This fact is likely the reason
uname -r
was called here instead of reusingKERNEL_RELEASE
.My idea was to keep existing functionality as is by storing the result of
uname -r
anduname -v
once at the start of the execution (inDRIVER_KERNEL_RELEASE
andDRIVER_KERNEL_VERSION
, respectively), then reuse these values. This allows specifying explicit release and version values as arguments without altering the entire script.Does that make sense? Did I miss anything?
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.
FWIW, I think we can make the script easier to maintain by making it more "functional" (as in functional programming) by passing explicit values to functions rather than relying on global variables.
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.
Oh, I see. It makes sense to me now.
This also adheres to our implicit convention that the
DRIVER_
prefix represents input values (those that may be set using env vars), whereas other vars likeKERNEL_RELEASE
are just for internal use.👍
Thank you!
N.B.: I've checked the whole PR. Just giving my 2 cents (specifically related to the above comment).
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 see! Thank you for the explanation. I think you are right!
Also, i share the same though about making the script more functional. At the same time, we don't probably want to spend much time on this since sooner or later we are going to revamp the script porting it to eg: a go tool (perhaps inside
falcoctl
?)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.
Yes, that makes sense to me.