Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

feat: support installing the agent with TAR installer and the install subcommand #378

Merged
merged 43 commits into from
Oct 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9d5c040
first version of feature file
EricDavisX Sep 24, 2020
54d8832
fix: typos
mdelapenya Oct 5, 2020
dca3adc
fix: proper BDD sequencing
mdelapenya Oct 5, 2020
2bcb84d
chore: remove non-gherkin line
mdelapenya Oct 5, 2020
8aef6d6
chore: refine gherkin tags
mdelapenya Oct 5, 2020
373cd0b
chore: reuse existing step for uninstalling/restarting the agent
mdelapenya Oct 5, 2020
ec571ab
chore: export kibana base URL from client
mdelapenya Oct 5, 2020
c5a6084
feat: add support for centos/debian with TAR.GZ installer
mdelapenya Oct 6, 2020
2cd7708
chore: rename variable
mdelapenya Oct 6, 2020
335e366
feat: support for a TAR installer
mdelapenya Oct 6, 2020
3f6deea
feat: create a local cache for downloaded binaries
mdelapenya Oct 6, 2020
9c49d7c
fixup. new tar installer
mdelapenya Oct 16, 2020
beed3b6
feat: support mulltiple installer types at feature level
mdelapenya Oct 16, 2020
047a170
chore: create token before running the agent
mdelapenya Oct 16, 2020
d8ac985
chore: move enroll method to the installer
mdelapenya Oct 16, 2020
92e751a
chore: move installFn to preInstalllFn
mdelapenya Oct 16, 2020
46697e4
chore: proper life cycle for install and enroll
mdelapenya Oct 16, 2020
244b08d
chore: add missing examples in feature file
mdelapenya Oct 16, 2020
c8ceab2
chore: enroll ooutside of the install life cycle
mdelapenya Oct 16, 2020
2770c59
chore: use existing step
mdelapenya Oct 20, 2020
31536ad
chore: match existing scenario for installing an agent
mdelapenya Oct 20, 2020
9297068
chore: move to fleet feature file as an example
mdelapenya Oct 20, 2020
9fc751f
chore: move stop scenario to fleet feature file as an example
mdelapenya Oct 20, 2020
0a9bcb0
chore: move restart scenario as a Fleet example
mdelapenya Oct 20, 2020
62f0bbb
chore: move unenroll scenario as a Fleet example
mdelapenya Oct 20, 2020
0ee3527
chore: move reenroll scenario as Fleet example
mdelapenya Oct 20, 2020
2d8dfcd
fix: use proper log path for TAR installer
mdelapenya Oct 20, 2020
ce47ad9
fix: create the tokens in the Default policy
mdelapenya Oct 20, 2020
2b41b13
fix: remove the proper service name
mdelapenya Oct 20, 2020
ba9b905
chore: use tar installer in endpoint feature
mdelapenya Oct 20, 2020
74ad2ba
fix: update Elastic Endpoint integration title
mdelapenya Oct 21, 2020
3031d0e
feat: implement the step for the empty working dir folder
mdelapenya Oct 21, 2020
cda63b2
fix: proper container name
mdelapenya Oct 21, 2020
a2014eb
chore: capture specific error for installing agent with revoked token
mdelapenya Oct 21, 2020
825fe8f
chore: use tar installer for fleet
mdelapenya Oct 21, 2020
8781522
chore: join process steps
mdelapenya Oct 21, 2020
7179054
chore: support for restarting the agent
mdelapenya Oct 21, 2020
b9c65a3
chore: move subcommand scenarios to fleet ones
mdelapenya Oct 21, 2020
8208b56
chore: simplify getting aggent hash and logs
mdelapenya Oct 21, 2020
017e4d0
fix: agents are offline after uninstall
mdelapenya Oct 21, 2020
399cb7c
fix: update desired status too
mdelapenya Oct 21, 2020
45c7b1d
fix: include inactive status in check
mdelapenya Oct 21, 2020
3562b42
chore: increase timeout for agent status checks
mdelapenya Oct 21, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cli/services/kibana.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ func (k *KibanaClient) DeleteIntegrationFromPolicy(packageConfigID string) (stri
return body, err
}

// GetBaseURL retrieves the base URl where Kibana is listening
func (k *KibanaClient) GetBaseURL() string {
return k.baseURL
}

// GetIntegration sends a GET request to fetch an integration by name and version
func (k *KibanaClient) GetIntegration(packageName string, version string) (string, error) {
k.withURL(fmt.Sprintf(ingestManagerIntegrationURL, packageName, version))
Expand Down
7 changes: 7 additions & 0 deletions cli/services/kibana_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ import (
"github.com/stretchr/testify/assert"
)

func TestGetBaseURL(t *testing.T) {
client := NewKibanaClient()
assert.NotNil(t, client)

assert.Equal(t, "http://localhost:5601", client.GetBaseURL())
}

func TestNewClient(t *testing.T) {
client := NewKibanaClient()

Expand Down
16 changes: 8 additions & 8 deletions e2e/_suites/fleet/features/agent_endpoint_integration.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@ Feature: Agent Endpoint Integration

@deploy-endpoint-with-agent
Scenario: Adding the Endpoint Integration to an Agent makes the host to show in Security App
Given a "centos" agent is deployed to Fleet
Given a "centos" agent is deployed to Fleet with "tar" installer
And the agent is listed in Fleet as "online"
When the "Elastic Endpoint Security" integration is "added" in the policy
Then the "Elastic Endpoint Security" datasource is shown in the policy as added
When the "Endpoint Security" integration is "added" in the policy
Then the "Endpoint Security" datasource is shown in the policy as added
And the host name is shown in the Administration view in the Security App as "online"

@endpoint-policy-check
Scenario: Deploying an Endpoint makes policies to appear in the Security App
When an Endpoint is successfully deployed with a "centos" Agent
When an Endpoint is successfully deployed with a "centos" Agent using "tar" installer
Then the policy response will be shown in the Security App

@set-policy-and-check-changes
Scenario: Changing an Agent policy is reflected in the Security App
Given an Endpoint is successfully deployed with a "centos" Agent
Given an Endpoint is successfully deployed with a "centos" Agent using "tar" installer
When the policy is updated to have "malware" in "detect" mode
Then the policy will reflect the change in the Security App

@deploy-endpoint-then-unenroll-agent
Scenario: Un-enrolling Elastic Agent stops Elastic Endpoint
Given an Endpoint is successfully deployed with a "centos" Agent
Given an Endpoint is successfully deployed with a "centos" Agent using "tar" installer
When the agent is un-enrolled
Then the agent is listed in Fleet as "inactive"
And the host name is not shown in the Administration view in the Security App
And the "elastic-endpoint" process is in the "stopped" state on the host

@deploy-endpoint-then-remove-it-from-policy
Scenario: Removing Endpoint from Agent policy stops the connected Endpoint
Given an Endpoint is successfully deployed with a "centos" Agent
When the "Elastic Endpoint Security" integration is "removed" in the policy
Given an Endpoint is successfully deployed with a "centos" Agent using "tar" installer
When the "Endpoint Security" integration is "removed" in the policy
Then the agent is listed in Fleet as "online"
But the host name is not shown in the Administration view in the Security App
And the "elastic-endpoint" process is in the "stopped" state on the host
76 changes: 52 additions & 24 deletions e2e/_suites/fleet/features/fleet_mode_agent.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,70 +4,98 @@ Feature: Fleet Mode Agent

@enroll
Scenario Outline: Deploying the <os> agent
When a "<os>" agent is deployed to Fleet
When a "<os>" agent is deployed to Fleet with "<installer>" installer
Then the "elastic-agent" process is in the "started" state on the host
And the "filebeat" process is in the "started" state on the host
And the "metricbeat" process is in the "started" state on the host
And the agent is listed in Fleet as "online"
And system package dashboards are listed in Fleet
Examples:
| os |
| centos |
| debian |
| os | installer |
| centos | tar |
| debian | tar |

@stop-agent
Scenario Outline: Stopping the <os> agent stops backend processes
Given a "<os>" agent is deployed to Fleet
Given a "<os>" agent is deployed to Fleet with "<installer>" installer
When the "elastic-agent" process is "stopped" on the host
Then the "filebeat" process is in the "stopped" state on the host
And the "metricbeat" process is in the "stopped" state on the host
Examples:
| os |
| centos |
| debian |
| os | installer |
| centos | tar |
| debian | tar |

@restart-agent
Scenario Outline: Restarting the installed <os> agent
Given a "<os>" agent is deployed to Fleet with "<installer>" installer
When the "elastic-agent" process is "restarted" on the host
And the "filebeat" process is in the "started" state on the host
And the "metricbeat" process is in the "started" state on the host
And the agent is listed in Fleet as "online"
Examples:
| os | installer |
| centos | tar |
| debian | tar |

@restart-host
Scenario Outline: Restarting the <os> host with persistent agent restarts backend processes
Given a "<os>" agent is deployed to Fleet
Given a "<os>" agent is deployed to Fleet with "<installer>" installer
When the host is restarted
Then the "elastic-agent" process is in the "started" state on the host
And the "filebeat" process is in the "started" state on the host
And the "metricbeat" process is in the "started" state on the host
Examples:
| os |
| centos |
| debian |
| os | installer |
| centos | tar |
| debian | tar |

@unenroll
Scenario Outline: Un-enrolling the <os> agent
Given a "<os>" agent is deployed to Fleet
Given a "<os>" agent is deployed to Fleet with "<installer>" installer
When the agent is un-enrolled
Then the "elastic-agent" process is in the "started" state on the host
And the agent is listed in Fleet as "inactive"
And the "filebeat" process is in the "stopped" state on the host
And the "metricbeat" process is in the "stopped" state on the host
Examples:
| os |
| centos |
| debian |
| os | installer |
| centos | tar |
| debian | tar |

@reenroll
Scenario Outline: Re-enrolling the <os> agent
Given a "<os>" agent is deployed to Fleet
Given a "<os>" agent is deployed to Fleet with "<installer>" installer
And the agent is un-enrolled
And the "elastic-agent" process is "stopped" on the host
When the agent is re-enrolled on the host
And the "elastic-agent" process is "started" on the host
Then the agent is listed in Fleet as "online"
Examples:
| os |
| centos |
| debian |
| os | installer |
| centos | tar |
| debian | tar |

@revoke-token
Scenario Outline: Revoking the enrollment token for the <os> agent
Given a "<os>" agent is deployed to Fleet
Given a "<os>" agent is deployed to Fleet with "<installer>" installer
When the enrollment token is revoked
Then an attempt to enroll a new agent fails
Examples:
| os |
| centos |
| debian |
| os | installer |
| centos | tar |
| debian | tar |

@uninstall-host
Scenario Outline: Un-installing the installed <os> agent
Given a "<os>" agent is deployed to Fleet with "<installer>" installer
When the "elastic-agent" process is "uninstalled" on the host
Then the "elastic-agent" process is in the "stopped" state on the host
And the "filebeat" process is in the "stopped" state on the host
And the "metricbeat" process is in the "stopped" state on the host
And the file system Agent folder is empty
And the agent is listed in Fleet as "offline"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It takes +2 minutes in reaching the offline status. Is that correct?

Examples:
| os | installer |
| centos | tar |
| debian | tar |
Loading