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

Agent configuration overridden by default fleet config #29297

Merged
merged 4 commits into from
Dec 9, 2021

Conversation

narph
Copy link
Contributor

@narph narph commented Dec 6, 2021

What does this PR do?

Elastic agent configuration options were overwritten by fleet default configuration options, even in standalone mode.

Why is it important?

undesired behavior.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Related issues

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Dec 6, 2021
@mergify
Copy link
Contributor

mergify bot commented Dec 6, 2021

This pull request does not have a backport label. Could you fix it @narph? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 7./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@narph narph self-assigned this Dec 6, 2021
@mergify mergify bot added the backport-skip Skip notification from the automated backport with mergify label Dec 6, 2021
@elasticmachine
Copy link
Collaborator

elasticmachine commented Dec 6, 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 preview

Expand to view the summary

Build stats

  • Start Time: 2021-12-06T20:37:01.007+0000

  • Duration: 109 min 28 sec

  • Commit: a4a7be3

Test stats 🧪

Test Results
Failed 0
Passed 7136
Skipped 16
Total 7152

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@@ -39,10 +39,11 @@ type upgraderControl interface {
}

// New creates a new Agent and bootstrap the required subsystem.
func New(log *logger.Logger, pathConfigFile string, reexec reexecManager, statusCtrl status.Controller, uc upgraderControl, agentInfo *info.AgentInfo) (Application, error) {
func New(log *logger.Logger, reexec reexecManager, statusCtrl status.Controller, uc upgraderControl, agentInfo *info.AgentInfo) (Application, error) {
// Load configuration from disk to understand in which mode of operation
// we must start the elastic-agent, the mode of operation cannot be changed without restarting the
// elastic-agent.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@michalpristas , based on the comments, it looks like it's expecting the elastic-agent.yml config instead of what is sent (fleet.yml). Replacing it made sure the standalone version gets the right config, also that mergeFleetConfig can merge the 2 configs

@narph narph requested a review from michalpristas December 6, 2021 17:01
@narph narph added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Dec 6, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Dec 6, 2021
@narph narph requested a review from ruflin December 7, 2021 12:21
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.

Looks good to me.

Seems like the change was really paths.AgentConfigFile() to paths.ConfigFile()

@ruflin
Copy link
Contributor

ruflin commented Dec 7, 2021

What exactly is the fleet default configuration options? fleet.yml? Or you mean internal defaults?

@narph
Copy link
Contributor Author

narph commented Dec 9, 2021

What exactly is the fleet default configuration options? fleet.yml? Or you mean internal defaults?

Sorry for the confusion here, the agent reads both elastic-agent.yml and fleet.yml configuration options but fails to merge the 2 together . So even if the user has set agent.grpc.port inside elastic-agent.yml, the agent will fail to pick it up and use the default value or the value configured in fleet.yml. This would have been fine for fleet managed elastic agent but not for the standalone setup.

@ruflin
Copy link
Contributor

ruflin commented Dec 9, 2021

Got it. Based on our offline discussion I'm trying to get my head around why standalone elastic agent reads the fleet.yml in the first place. I'm good with getting the change in but lets make sure we come up with a proper "plan" on how it should work in the future afterwards.

@narph narph added backport-v8.1.0 Automated backport with mergify and removed backport-skip Skip notification from the automated backport with mergify labels Dec 9, 2021
@narph narph merged commit 70ac1b0 into elastic:master Dec 9, 2021
@narph narph deleted the fix-config branch December 9, 2021 16:08
mergify bot pushed a commit that referenced this pull request Dec 9, 2021
* replace config

* changelog

* add test on merge

* fmt

(cherry picked from commit 70ac1b0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.1.0 Automated backport with mergify Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Elastic agent doesn't respect config file parameters
4 participants