-
Notifications
You must be signed in to change notification settings - Fork 42
feat: implement the installation of the agent #149
Conversation
We are spinning up a Centos:7 box, and we are following the installation process from the guide: https://www.elastic.co/guide/en/ingest-management/7.8/elastic-agent-installation.html Once there, we had to create a symlink to enable "elastic-agent" in the PATH. As a side note, we are reusing the "waitForProcess" method to check that the installation commands finished, checking that they are not there when executing "ps" in the agent container
We want to be able to check the state of a process (started, stopped), but we also want to change the state of it (start/stop/restart)
💔 Tests FailedExpand to view the summary
Build stats
Test stats 🧪
Test errorsExpand to view the tests failures
Steps errorsExpand to view the steps failures
Log outputExpand to view the last 100 lines of log output
|
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.
LGTM
We are also updating the downloaded artefact to use 8.0.0-SNAPSHOT instead
We are going to initialise Fleet config right after Kibana starts, to avoid having to invoke the step on each scenario
We are going to pass the '-n -l' flags, which means: - n: return the newest process - l: show pid and process name
We are wrapping code into functions to support reusing them in different steps (i.e. start agent to reenroll it using same token). We're also checking process state using docker-compose instead of Docker engine
If we read it from the environment, then the CI will use default vaule, which is 7.7.0
ports: | ||
- "5601:5601" | ||
volumes: | ||
- ${kibanaConfigPath}:/usr/share/kibana/config/kibana.yml | ||
package-registry: | ||
image: docker.elastic.co/package-registry/package-registry:master | ||
image: docker.elastic.co/package-registry/package-registry:41c150c8020efc53ab16e3bba774c62a419b51ea |
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 get a comment as to how folks would know how and when to update this... I think some details will be here: elastic/package-storage#86
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.
We replaced master branch because there was a combination of errors:
- Kibana was unable to start
- the enrollment process of agents did not work because of different agent versions compared on Kibana
I noticed the team changed the version here: elastic/integrations@25a4bd4, and I shadowed it.
"url": r.URL, | ||
"error": err, | ||
"method": r.method, | ||
"escapedURL": escapedURL, |
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 recall discussing this, glad you got it sorted.
@@ -82,7 +83,7 @@ func (sats *StandAloneTestSuite) aStandaloneAgentIsDeployed() error { | |||
|
|||
func (sats *StandAloneTestSuite) thereIsNewDataInTheIndexFromAgent() error { | |||
maxTimeout := time.Duration(queryRetryTimeout) * time.Minute | |||
minimumHitsCount := 100 | |||
minimumHitsCount := 50 |
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 agree - I might even lower it more... but this is helpful and still keeps high value
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 takes 10 seconds to reach 50 hits
@@ -230,7 +237,7 @@ func searchAgentData(hostname string, startDate time.Time, minimumHitsCount int, | |||
}, | |||
} | |||
|
|||
indexName := "logs-agent-default" | |||
indexName := ".ds-logs-elastic.agent-default-000001" |
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.
we're not supposed to have to use the .ds in order to find things in a search. is this used only to assert that a new index is being accessed? I don't know the Data Streams feature well to be 100% sure of usage just confirming. How is it used? We can ask @michalpristas to look at the usage and help confirm...
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'd like to know if there is a way to define an alias. For metricbeat we do this:
"-E", "setup.ilm.rollover_alias=${indexName}", |
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 love this - lets merge it as soon as we can. we could wait for some product fixes... or not. maybe just push it in so its easier to prep coming down-stream prs. :)
The two existing failures are directly related to elastic/beats#20006 I'm gonna merge this to have the Fleet scenarios on CI. Thanks @EricDavisX for your review! |
What does this PR do?
We are adding implementation steps for the first scenario, which installs the agent and enrolls it in Kibana.
We are spinning up a Centos:7 box (which is kept alive using
tail -f /dev/null
as entrypoint), and we are following the installation process of the Elastic Agent from the guide: https://www.elastic.co/guide/en/ingest-management/7.8/elastic-agent-installation.html:To download the agent, we are inspecting the JSON response of querying Elastic's API for artifacts (https://artifacts-api.elastic.co), extracting the download URL for the current 8.0.0-SNAPSHOT version of the elastic-agent
We enroll the agent with a new token (we added support to create token when deploying a new agent, so it's possible to revoke the token without affecting other test scenarios), and run the agent, which is shown in Kibana as online. After a few seconds, around 20, datastreams will be present in Kibana.
As a side note, we are reusing the "waitForProcess" method to check that the installation commands finished, checking that they are not there when executing "pgrep -n -l PROCESS_NAME" in the agent container
For the stop scenario, we're killing the process with
pkill
, which comes bundled into the Centos box.Why is it important?
Making progress with Fleet mode
Related issues