feat: added a shared artifact state between install and follow to avoid redundant pull#870
Conversation
| return err | ||
| } | ||
|
|
||
| return os.WriteFile(path, b, filePerm) |
There was a problem hiding this comment.
Nit - very minor recommendation here.
os.WriteFile is not atomic (it truncates and writes using a buffer), so if multiple falcoctl processes read and write simultaneously to the same state file, a reader could see the state file in a corrupted state.
However, the read function (above) handles corrupted JSON gracefully, and since the "best-effort" nature of this "cache" mechanism, I don't see this as a blocker for this PR. We may improve it later.
|
LGTM label has been added. DetailsGit tree hash: 3f37b25b8a80399fc12299fcca60d755b5c5a3c3 |
Signed-off-by: c2ndev <cannarella.dev@gmail.com>
Signed-off-by: c2ndev <cannarella.dev@gmail.com>
… a watched folder of Falco, improve tests Signed-off-by: c2ndev <cannarella.dev@gmail.com>
Signed-off-by: cannarelladev <cannarella.dev@gmail.com>
ac57789 to
90ac983
Compare
|
LGTM label has been added. DetailsGit tree hash: 6b3630fb642cd9a446de6676b8d11aceb858d2eb |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: c2ndev, leogr The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
Any specific area of the project related to this PR?
/area cli
What this PR does / why we need it:
In a Kubernetes deployment, falcoctl is often used in two different phases:
install— running in an initContainerfollow— running in a sidecarCurrently, the first execution of the follower starts from a blank state, which causes artifacts that were already installed to be resolved and pulled again.
To avoid this behavior, this PR enforces a shared state within the artifact volumes, allowing the follower to be aware of previously installed artifacts. This reduces redundant pulls and the load on the container registry.
Which issue(s) this PR fixes:
Fixes #866
Special notes for your reviewer: