Skip to content
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] Fix picking correct policy id for fleet-server #25352

Merged
merged 7 commits into from
Apr 28, 2021

Conversation

ruflin
Copy link
Member

@ruflin ruflin commented Apr 27, 2021

When running the container command, the policy id configured in the fleet-setup.yml file was only picked up, when fleet-server was not enabled. If a fleet-server policy is set, this will be set as the default.

Later on this setup call should be improved that not both setups are possible. Currently it could be that the fleet enroll and fleet server setup policy are not identical.

To partially test this PR, I did run the elastic agent locally as following:

sudo STATE_PATH=${GOPATH}/src/github.com/elastic/beats/x-pack/elastic-agent/state ./elastic-agent container

Adjust the path to your needs. In addition, I put the currently checked in fleet-setup.yml file into state directory. In parallel, an elastic-stack setup was running.

When running the container command, the policy id configured in the fleet-setup.yml file was only picked up, when fleet-server was not enabled. If a fleet-server policy is set, this will be set as the default.

Later on this setup call should be improved that not both setups are possible. Currently it could be that the fleet enroll and fleet server setup policy are not identical.

To partially test this PR, I did run the elastic agent locally as following:

```
sudo STATE_PATH=${GOPATH}/src/github.com/elastic/beats/x-pack/elastic-agent/state ./elastic-agent container
```

Adjust the path to your needs. In addition, I put the currently checked in fleet-setup.yml file into state directory. In parallel, an elastic-stack setup was running.
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Apr 27, 2021
@ruflin ruflin added the Team:Elastic-Agent Label for the Agent team label Apr 27, 2021
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Apr 27, 2021
Copy link
Contributor

@blakerouse blakerouse left a comment

Choose a reason for hiding this comment

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

Change is correct, for this path.

@ruflin ruflin added backport-v7.13.0 Automated backport with mergify backport-v7.14.0 Automated backport with mergify labels Apr 27, 2021
@ruflin ruflin marked this pull request as ready for review April 27, 2021 19:38
@elasticmachine
Copy link
Collaborator

Pinging @elastic/agent (Team:Agent)

@elasticmachine
Copy link
Collaborator

elasticmachine commented Apr 27, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #25352 updated

  • Start Time: 2021-04-27T21:39:23.052+0000

  • Duration: 97 min 23 sec

  • Commit: 1d4f00c

Test stats 🧪

Test Results
Failed 0
Passed 6788
Skipped 16
Total 6804

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 6788
Skipped 16
Total 6804

@ruflin
Copy link
Member Author

ruflin commented Apr 27, 2021

With elastic/elastic-package#338 I managed to test this change and it seems to work as expected. I built the agent container locally and then used it in the environment:

DEV=true SNAPSHOT=true PLATFORMS=linux/amd64 TYPES=docker mage package

Currently it is required to do this on 7.13 as master does not have the most recent snapshot builds yet.

@ruflin ruflin merged commit 362d485 into elastic:master Apr 28, 2021
@ruflin ruflin deleted the fix-policy-id-pick branch April 28, 2021 05:58
mergify bot pushed a commit that referenced this pull request Apr 28, 2021
When running the container command, the policy id configured in the fleet-setup.yml file was only picked up, when fleet-server was not enabled. If a fleet-server policy is set, this will be set as the default.

Later on this setup call should be improved that not both setups are possible. Currently it could be that the fleet enroll and fleet server setup policy are not identical.

To partially test this PR, I did run the elastic agent locally as following:

```
sudo STATE_PATH=${GOPATH}/src/github.com/elastic/beats/x-pack/elastic-agent/state ./elastic-agent container
```

Adjust the path to your needs. In addition, I put the currently checked in fleet-setup.yml file into state directory. In parallel, an elastic-stack setup was running.

(cherry picked from commit 362d485)
mergify bot pushed a commit that referenced this pull request Apr 28, 2021
When running the container command, the policy id configured in the fleet-setup.yml file was only picked up, when fleet-server was not enabled. If a fleet-server policy is set, this will be set as the default.

Later on this setup call should be improved that not both setups are possible. Currently it could be that the fleet enroll and fleet server setup policy are not identical.

To partially test this PR, I did run the elastic agent locally as following:

```
sudo STATE_PATH=${GOPATH}/src/github.com/elastic/beats/x-pack/elastic-agent/state ./elastic-agent container
```

Adjust the path to your needs. In addition, I put the currently checked in fleet-setup.yml file into state directory. In parallel, an elastic-stack setup was running.

(cherry picked from commit 362d485)
ruflin added a commit that referenced this pull request Apr 28, 2021
… (#25363)

When running the container command, the policy id configured in the fleet-setup.yml file was only picked up, when fleet-server was not enabled. If a fleet-server policy is set, this will be set as the default.

Later on this setup call should be improved that not both setups are possible. Currently it could be that the fleet enroll and fleet server setup policy are not identical.

To partially test this PR, I did run the elastic agent locally as following:

```
sudo STATE_PATH=${GOPATH}/src/github.com/elastic/beats/x-pack/elastic-agent/state ./elastic-agent container
```

Adjust the path to your needs. In addition, I put the currently checked in fleet-setup.yml file into state directory. In parallel, an elastic-stack setup was running.

(cherry picked from commit 362d485)

Co-authored-by: Nicolas Ruflin <spam@ruflin.com>
ruflin added a commit that referenced this pull request Apr 28, 2021
… (#25362)

When running the container command, the policy id configured in the fleet-setup.yml file was only picked up, when fleet-server was not enabled. If a fleet-server policy is set, this will be set as the default.

Later on this setup call should be improved that not both setups are possible. Currently it could be that the fleet enroll and fleet server setup policy are not identical.

To partially test this PR, I did run the elastic agent locally as following:

```
sudo STATE_PATH=${GOPATH}/src/github.com/elastic/beats/x-pack/elastic-agent/state ./elastic-agent container
```

Adjust the path to your needs. In addition, I put the currently checked in fleet-setup.yml file into state directory. In parallel, an elastic-stack setup was running.

(cherry picked from commit 362d485)

Co-authored-by: Nicolas Ruflin <spam@ruflin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v7.13.0 Automated backport with mergify backport-v7.14.0 Automated backport with mergify Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants