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

idxmgmt: fix config merging #4950

Merged
merged 5 commits into from Mar 16, 2021
Merged

Conversation

axw
Copy link
Member

@axw axw commented Mar 11, 2021

Motivation/summary

Fix a bug related to merging user-defined and default setup.template config.

We were merging onto a new config, which meant root config attributes like path.config were no longer accessible. The fix is to merge defaults over the root config to ensure the root config attributes are still accessible, and then merge the root config back over that to ensure user-defined config takes precedence.

Checklist

How to test these changes

See #4949

Related issues

Fixes #4949

@axw axw force-pushed the fix-template-config-merge branch from 01ac31c to aa573e3 Compare March 11, 2021 04:16
@axw axw marked this pull request as ready for review March 11, 2021 04:16
@axw axw requested a review from a team March 11, 2021 04:17
@apmmachine
Copy link
Collaborator

apmmachine commented Mar 11, 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 #4950 updated

  • Start Time: 2021-03-16T07:23:56.265+0000

  • Duration: 41 min 39 sec

  • Commit: 581e307

Test stats 🧪

Test Results
Failed 0
Passed 4785
Skipped 117
Total 4902

Trends 🧪

Image of Build Times

Image of Tests

@axw
Copy link
Member Author

axw commented Mar 11, 2021

jenkins run the tests please

// resolved using the root of the left-most config in the merge.
// We merge the user-defined config back over the defaults to
// ensure they take precedence.
return common.MergeConfigs(configRoot, defaultConfig, configRoot)
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks complicated - looking at the common.MergeConfigs code I couldn't figure out why we need the extra configRoot.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed, hence the NOTE :)
Is the comment unclear?

Copy link
Member Author

Choose a reason for hiding this comment

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

I tweaked the comment slightly, hopefully it's a bit clearer now.

@axw
Copy link
Member Author

axw commented Mar 11, 2021

Just found a bug, moving back into draft while I fx.

@axw axw marked this pull request as draft March 11, 2021 08:48
axw added 2 commits March 11, 2021 17:06
Check before we merge, and use config.Has
rather than unpacking twice.
@axw axw marked this pull request as ready for review March 11, 2021 09:24
@axw axw merged commit cc2afff into elastic:master Mar 16, 2021
@axw axw deleted the fix-template-config-merge branch March 16, 2021 08:51
axw added a commit to axw/apm-server that referenced this pull request Mar 16, 2021
* idxmgmt: fix config merging

* Fix how we determine setup.template specified

Check before we merge, and use config.Has
rather than unpacking twice.

* systemtest: improve logging for assertion
# Conflicts:
#	changelogs/head.asciidoc
axw added a commit to axw/apm-server that referenced this pull request Mar 16, 2021
* idxmgmt: fix config merging

* Fix how we determine setup.template specified

Check before we merge, and use config.Has
rather than unpacking twice.

* systemtest: improve logging for assertion
# Conflicts:
#	changelogs/head.asciidoc
axw added a commit to axw/apm-server that referenced this pull request Mar 16, 2021
* idxmgmt: fix config merging

* Fix how we determine setup.template specified

Check before we merge, and use config.Has
rather than unpacking twice.

* systemtest: improve logging for assertion
# Conflicts:
#	changelogs/head.asciidoc
axw added a commit that referenced this pull request Mar 16, 2021
* idxmgmt: fix config merging

* Fix how we determine setup.template specified

Check before we merge, and use config.Has
rather than unpacking twice.

* systemtest: improve logging for assertion
# Conflicts:
#	changelogs/head.asciidoc
axw added a commit that referenced this pull request Mar 16, 2021
* idxmgmt: fix config merging

* Fix how we determine setup.template specified

Check before we merge, and use config.Has
rather than unpacking twice.

* systemtest: improve logging for assertion
# Conflicts:
#	changelogs/head.asciidoc
axw added a commit that referenced this pull request Mar 16, 2021
* idxmgmt: fix config merging

* Fix how we determine setup.template specified

Check before we merge, and use config.Has
rather than unpacking twice.

* systemtest: improve logging for assertion
# Conflicts:
#	changelogs/head.asciidoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

APM Server fails to resolve config variables when loading template setup config
3 participants