-
Notifications
You must be signed in to change notification settings - Fork 148
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
Fix and refactor the state store #4441
Merged
Merged
Changes from 66 commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
db6c7a6
Fix action store -> state store migration tests (#4235)
AndersonQ 19c8fd0
update action model to match fleet-server schema (#4240)
AndersonQ a7b7bca
refactor state store (#4253)
AndersonQ 9f7ccc2
add migrations for action and state stores (#4305)
AndersonQ 1af2c59
merge 'upstream/main' into bugfix/3912-borken-stat-store
AndersonQ 1c3dfe0
fix stores conflicts
AndersonQ f61bbdf
adjust actions in protection package and diagnostics action
AndersonQ ac8591e
Merge branch 'main' into bugfix/3912-borken-stat-store
AndersonQ 9589a5d
fix action diagnostics handler
AndersonQ 4032005
it should not be there
AndersonQ bd1f715
use .json instead of .yml/.yaml
AndersonQ 27920c3
fix more tests
AndersonQ cc4d6b4
split actionDiagnosticsData into its own type and fix another test
AndersonQ 85324a5
add changelog
AndersonQ 27a235e
fix signed action data schema
AndersonQ 7fd93e9
making the linter happy
AndersonQ 85ac7b3
PR review changes
AndersonQ 4c8dfe7
move migration tests to its own file and add more tests
AndersonQ 22bbe6e
Merge branch 'main' into bugfix/3912-borken-stat-store
AndersonQ 6cdad71
use unprivileged vault
AndersonQ b4e4077
Merge remote-tracking branch 'upstream/main' into bugfix/3912-borken-…
AndersonQ ff3d90e
Merge branch 'bugfix/3912-borken-stat-store' of github.com:elastic/el…
AndersonQ f89a3ab
another mac fix
AndersonQ ce05de0
remove debug log
AndersonQ 177693d
fix typo and comment
AndersonQ 9c07d92
Merge branch 'main' into bugfix/3912-borken-stat-store
AndersonQ 4f05e97
add notice
AndersonQ 0862675
Merge branch 'bugfix/3912-borken-stat-store' of github.com:elastic/el…
AndersonQ 3820c15
Merge branch 'main' into bugfix/3912-borken-stat-store
AndersonQ dde9111
Merge branch 'main' into bugfix/3912-borken-stat-store
AndersonQ c215ade
fix and add test for JSON nested map marshalling
AndersonQ f5a0438
Merge branch 'main' into bugfix/3912-borken-stat-store
AndersonQ f3b8373
Merge branch 'main' into bugfix/3912-borken-stat-store
AndersonQ d022fa9
Merge branch 'bugfix/3912-borken-stat-store' of github.com:AndersonQ/…
AndersonQ b1c6863
Merge branch 'main' of github.com:elastic/elastic-agent into bugfix/3…
AndersonQ 469c793
fix after merging main
AndersonQ b3afffe
Merge remote-tracking branch 'upstream/main' into bugfix/3912-borken-…
AndersonQ 03116c0
fix after merge
AndersonQ ec9874f
fix after merge
AndersonQ 9447e07
Merge branch 'main' into bugfix/3912-borken-stat-store
AndersonQ 97093aa
adjust changelog
AndersonQ cad7c9e
remove unnecessary empty line
AndersonQ 57538a1
Merge branch 'bugfix/3912-borken-stat-store' of github.com:elastic/el…
AndersonQ f0ac632
Merge branch 'main' into bugfix/3912-borken-stat-store
AndersonQ 806865b
Merge branch 'main' into bugfix/3912-borken-stat-store
AndersonQ f987143
Merge branch 'main' into bugfix/3912-borken-stat-store
jlind23 1c3fc9a
fix after merge
AndersonQ f71f7df
Merge branch 'main' into bugfix/3912-borken-stat-store
AndersonQ 5221ad4
Merge branch 'main' into bugfix/3912-borken-stat-store
AndersonQ c84451a
fix another merge issue
AndersonQ 4d76b70
Merge branch 'bugfix/3912-borken-stat-store' of github.com:elastic/el…
AndersonQ cb95c52
Merge branch 'main' into bugfix/3912-borken-stat-store
AndersonQ a9832f8
Merge branch 'main' into bugfix/3912-borken-stat-store
AndersonQ a305fd4
improve docs/comments
AndersonQ e949aa1
fix store dirty state being cleaned on failed save and add tests
AndersonQ 057fc26
fix docs and remove TODO
AndersonQ 100375f
add tests to load store
AndersonQ 785372b
WIP
AndersonQ bb44a11
Merge branch 'bugfix/3912-borken-stat-store' of github.com:elastic/el…
AndersonQ a1ae941
migration: add tests for empty and unknown actions
AndersonQ 113bf22
Merge branch 'main' into bugfix/3912-borken-stat-store
AndersonQ eba70e6
always return the reader.Close error
AndersonQ f450435
Merge branch 'bugfix/3912-borken-stat-store' of github.com:elastic/el…
AndersonQ d2b9fda
Merge branch 'main' into bugfix/3912-borken-stat-store
AndersonQ 987c9f6
do not log errors
AndersonQ 57dfe49
Merge branch 'bugfix/3912-borken-stat-store' of github.com:elastic/el…
AndersonQ e61cf6d
add debug log when dropping actions on SetAction
AndersonQ 57dec1e
fix typos/better logs
AndersonQ 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Kind can be one of: | ||
# - breaking-change: a change to previously-documented behavior | ||
# - deprecation: functionality that is being removed in a later release | ||
# - bug-fix: fixes a problem in a previous version | ||
# - enhancement: extends functionality but does not break or fix existing behavior | ||
# - feature: new functionality | ||
# - known-issue: problems that we are aware of in a given version | ||
# - security: impacts on the security of a product or a user’s deployment. | ||
# - upgrade: important information for someone upgrading from a prior version | ||
# - other: does not fit into any of the other categories | ||
kind: bug-fix | ||
|
||
# Change summary; a 80ish characters long description of the change. | ||
summary: Fix the Elastic Agent state store | ||
|
||
# Long description; in case the summary is not enough to describe the change | ||
# this field accommodate a description without length limits. | ||
# NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment. | ||
description: | | ||
This change fixes issues when loading data from the Agent's internal state store. | ||
Which include the error `error parsing version ""` the Agent would present after | ||
trying to execute a scheduled upgrade after a restart. | ||
|
||
# Affected component; a word indicating the component this changeset affects. | ||
component: | ||
|
||
# PR URL; optional; the PR number that added the changeset. | ||
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added. | ||
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number. | ||
# Please provide it if you are adding a fragment for a different PR. | ||
#pr: https://github.com/owner/repo/1234 | ||
|
||
# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of). | ||
# If not present is automatically filled by the tooling with the issue linked to the PR number. | ||
issue: https://github.com/elastic/elastic-agent/issues/3912 |
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
I don't think we have an integration test for the diagnostics action yet. Now would be a good time to add one, breaking that unintentionally would be Very Bad.
Related: #4384
I'd suggest implementing it separately on main and then updating this PR to include it, since it should pass in both cases. I would not add it to this already large PR.
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.
ok, so just to confirm, #4384 is already the ticket for this test, right?
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.
It could be if you meet the criteria it proposes. I am mostly interested in ensuring that we can collect diagnostics and send them to fleet here, not verifying the structure of the diagnostics. Re-reading it that issue considers the Fleet diagnostics part optional, I found it via key word search. You can create a new issue with reduced scope if you want.
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.
As author of #4384 , the main idea behind it is that we don't trigger diagnostic on a real agent with real components. The Fleet part was marked as optional as I didn't see that part of the code exercised anywhere yet in the integration tests.
For reference, all we have for diagnostics in integration tests is triggered with an
elastic-agent diagnostics
command, see:https://github.com/elastic/elastic-agent/blob/main/testing/integration/diagnostics_test.go
elastic-agent/testing/integration/endpoint_security_test.go
Line 742 in 8a30900
Feel free to keep the issue and make the Fleet part mandatory if you want or create a new one with reduced scope as @cmacknz suggested
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.
Regardless the approach to further test the diagnostics, the state store is not part of the diagnostics. And we already have a test for the diagnostics, therefore I think this minor change on the diagnostics code is covered by tests, also it's just a model change, the compiler also should prevent an error here.