-
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
Allow installing a second agent on the same machine for development #4822
Conversation
This pull request does not have a backport label. Could you fix it @cmacknz? 🙏
NOTE: |
Auto-detect when we were installed in development mode at runtime.
This pull request is now in conflicts. Could you fix it? 🙏
|
This reverts commit 8d36a0a.
This pull request is now in conflicts. Could you fix it? 🙏
|
Quality Gate failedFailed conditions |
that would be great, as this is something that would be helpful with the work I am doing. Having the ability to just download an elastic-agent and just run it locally without installing it. |
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.
Looks good thanks for the fixes and the exposing of --namespace
optional as a command line option.
I am going to force merge past this, most of the uncovered code is from the conversion of variables into functions and the uncovered code is tested in integration tests. |
Allows installing or running a second Elastic Agent on the same machine for development using the
--develop
argument. The core problem this PR aims to solve is allowing agent developers to install a second agent on their machines when there is also an InfoSec managed agent installed. Once installed, the second agent is available with theelastic-development-agent
command. I putdevelopment
in the middle instead of at the end because it makes tab based autocompletion in the shell easier.I have manually tested that the development agent can enroll with Fleet and upgrade. The changes needed for a second agent are isolated to install time and interacting with the daemon. Features like upgrades and enrolling in Fleet require no changes because they are contained into the agent's installation directory. For this reason I have only added integration tests to ensure installing a second agent alongside an existing one works. We shouldn't need to test anything else as there are no features that reach outside the agent installation directory.
I sanity checked what happens if you install Defend a second time on the same machine to make sure nothing explodes, and it fails immediately in a nice place before the second install is even attempted:
Reproducing the added README section for instructions on how to install and test:
Development Installations
If you are an Elastic employee, you already have an Information Security managed Elastic Agent installed on your machine for endpoint protection. This prevents you from installing the Elastic Agent a second time for development without using a VM or Docker container. To eliminate this point of friction, Elastic Agent has a development mode that permits installing the Elastic Agent on your machine a second time:
Using the
--develop
option will install the agent in an isolatedAgent-Development
agent directory in the chosen base path.Development agents enrolled in Fleet will have the
Development
tag added automatically. Using the default base path on MacOS you will see:The
elastic-agent
command in the shell is replaced withelastic-development-agent
to interact with the development agent:The primary restriction of
--develop
installations is that you cannot run Elastic Defend a second time on the same machine. Attempting toinstall Defend twice will fail with resource conflicts. All other integrations should be usable provided conflicting configurations are changed ahead of time. For example two agents cannot bind to the sameagent.monitoring.http.port
to expose their monitoring servers