-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Elastic Agent] Support the install, control, and uninstall of Endpoint #19248
[Elastic Agent] Support the install, control, and uninstall of Endpoint #19248
Conversation
…fferent app types.
Pinging @elastic/ingest-management (Team:Ingest Management) |
@@ -175,6 +179,7 @@ func (o *Operator) start(p Descriptor, cfg map[string]interface{}) (err error) { | |||
func (o *Operator) stop(p Descriptor) (err error) { | |||
flow := []operation{ | |||
newOperationStop(o.logger, o.config), | |||
newOperationUninstall(o.logger, p, o.uninstaller), |
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.
what in case of multiple outputs running, you have metricbeat A and B A is stopped and uninstalled? it is the same binary as metricbeat for output B
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.
Is that even the case today? When looping with detectPrograms
it only loops through the Supported programs once, creating an array. So only 1 metricbeat will be running.
The only case where that is not true with the sidecars for metrics and logs of the running metricbeat and filebeat.
At the moment uninstall doesn't do anything, other than call the pre_uninstall
hooks. So this will not cause an issues currently.
x-pack/elastic-agent/pkg/artifact/install/hooks/hooks_installer.go
Outdated
Show resolved
Hide resolved
can you provide a guide for testing this? |
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 makes sense to me, code looks good, but i havent tested it locally
@@ -21,13 +21,13 @@ import ( | |||
|
|||
// defaultAgentConfigFile is a name of file used to store agent information | |||
const defaultAgentConfigFile = "fleet.yml" | |||
const agentInfoKey = "agent_info" | |||
const agentInfoKey = "agent" |
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.
note: this is breaking between 7.8 and 7.9 so maybe we should put a note that agent might change ID in between versions when updating from 7.8
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.
should we just handle it? support reading it with either agent_info
or agent
?
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.
Lets document it, breaking changes are ok from 7.8->7.9
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.
Created #19488 that handles it transparently, or we can just document. I prefer to just handle it, but okay with breaking.
} | ||
|
||
// timeout defaults to 60 seconds | ||
if r.Timeout == 0 { |
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 take that to a 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.
comment where?
Went ahead and merged this, wanting to get it into 7.x ASAP so we can get some real testing from the snapshot builds, which should allow Agent to download Endpoint directly from the artifact store. Working on a follow up for the |
…nt (elastic#19248) * Initial spec parsing for endpoint. * Update comment. * Fix spec test. * Update code so it copies the entire input. * Fix ast test. * Merge agent-improve-restart-loop * Merge agent-endpoint-spec * Refactor core/plugin/app into mostly core/ and use core/plugin for different app types. * Work on endpoint service application. * More fixes. * Fix format and tests. * Fix some imports. * More cleanups. * Fix export comment. * Pass the program.Spec into the descriptor. * Run endpoint verify, install, and uninstall when endpoint should be running. * Fix install and uninstall of Endpoint * Fix some small issues with service app. * Add changelog entry. * Fix lint and tests. * Fix lint. * Remove the code no longer needed because of newer config format. * Fix rules and review. * Update to Endpoint Security. * Fix issues so endpoint security runs. * Add comments. * Update docstring. * Some more fixes. * Delete the extra endpoint testdata files. * Add timeout to exec_file step. * Fix supported map. * Fix getting support programs by cmd. * Improve app started checks. * Fix buildspec. (cherry picked from commit 0fe1554)
…nt (#19248) (#19497) * Initial spec parsing for endpoint. * Update comment. * Fix spec test. * Update code so it copies the entire input. * Fix ast test. * Merge agent-improve-restart-loop * Merge agent-endpoint-spec * Refactor core/plugin/app into mostly core/ and use core/plugin for different app types. * Work on endpoint service application. * More fixes. * Fix format and tests. * Fix some imports. * More cleanups. * Fix export comment. * Pass the program.Spec into the descriptor. * Run endpoint verify, install, and uninstall when endpoint should be running. * Fix install and uninstall of Endpoint * Fix some small issues with service app. * Add changelog entry. * Fix lint and tests. * Fix lint. * Remove the code no longer needed because of newer config format. * Fix rules and review. * Update to Endpoint Security. * Fix issues so endpoint security runs. * Add comments. * Update docstring. * Some more fixes. * Delete the extra endpoint testdata files. * Add timeout to exec_file step. * Fix supported map. * Fix getting support programs by cmd. * Improve app started checks. * Fix buildspec. (cherry picked from commit 0fe1554)
…ne-beats * upstream/master: (105 commits) ci: enable packaging job (elastic#19536) ci: disable upstream trigger on PRs for the packaging job (elastic#19490) Implement memlog on-disk handling (elastic#19408) fix go.mod for PR elastic#19423 (elastic#19521) [MetricBeat] add param `aws_partition` to support aws-cn, aws-us-gov regions (elastic#19423) Input v2 stateless manager (elastic#19406) Input v2 compatibility layer (elastic#19401) [Elastic Agent] Fix artifact downloading to allow endpoint-security to be downloaded (elastic#19503) fix: ignore target changes on scans (elastic#19510) Add more helpers to pipeline/testing package (elastic#19405) Report dependencies in CSV format (elastic#19506) [Filebeat] Fix reference leak in TCP and Unix socket inputs (elastic#19459) Cursor input skeleton (elastic#19378) Add changelog. (elastic#19495) [DOC] Typo in Kerberos (elastic#19265) Remove accidentally commited unused NOTICE template (elastic#19485) [Elastic Agent] Support the install, control, and uninstall of Endpoint (elastic#19248) [Filebeat][httpjson] Add split_events_by config setting (elastic#19246) ci: disabling packaging job until we fix it (elastic#19481) Fix golang.org/x/tools to release1.13 (elastic#19478) ...
…nt (elastic#19248) * Initial spec parsing for endpoint. * Update comment. * Fix spec test. * Update code so it copies the entire input. * Fix ast test. * Merge agent-improve-restart-loop * Merge agent-endpoint-spec * Refactor core/plugin/app into mostly core/ and use core/plugin for different app types. * Work on endpoint service application. * More fixes. * Fix format and tests. * Fix some imports. * More cleanups. * Fix export comment. * Pass the program.Spec into the descriptor. * Run endpoint verify, install, and uninstall when endpoint should be running. * Fix install and uninstall of Endpoint * Fix some small issues with service app. * Add changelog entry. * Fix lint and tests. * Fix lint. * Remove the code no longer needed because of newer config format. * Fix rules and review. * Update to Endpoint Security. * Fix issues so endpoint security runs. * Add comments. * Update docstring. * Some more fixes. * Delete the extra endpoint testdata files. * Add timeout to exec_file step. * Fix supported map. * Fix getting support programs by cmd. * Improve app started checks. * Fix buildspec.
What does this PR do?
Adds the ability to install and uninstall Endpoint.
Adds new
exec_file
to thetranspiler.StepList
so file execution can be defined in a spec file. This allows theendpoint.spec
file to encode all the actions required to install, check if installed, and uninstall Endpoint.pre_uninstall
steps added to the spec file and newuninstall-operation
was added to perform uninstallation of applications.check_install
steps added to the spec file along with a newInstallerChecker
that handles checking if the installation steps need to be ran.Breakdown of the installation:
data/downloads
, in a custom format until the required changes are released on Endpoint side)data/install
exists, if it does call./endpoint-security verify
which will verify if its installed. If it returns 0 then it will skip install, as its already installed. (Currently this command doesn't exist, so it will always return non-zero, so installation is always performed. Once added it will just work!)data/install
, then exec./endpoint-security install --upgrade --resources endpoint-security-resources.zip
Breakdown of the uninstallation:
./endpoint-security uninstall
command from thePreUninstallSteps
.Why is it important?
To support Endpoint.
Checklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.