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

Merge default values with custom API Key Elasticsearch settings #3342

Merged
merged 3 commits into from
Feb 18, 2020

Conversation

simitt
Copy link
Contributor

@simitt simitt commented Feb 17, 2020

Motivation/summary

When configuring an Elasticsearch instance for API Key usage, Elasticsearch default values should be merged with the custom configuration.

At the moment default values are not merged as soon as any of the apm-server.api_key.elasticsearch.* options is configured, which is unexpected behavior and not aligned with how other configuration options are merged with default values.

This PR changes the behavior to use default options where no dedicated configuration option is provided. This change also allows to add the required flag for the Elasticsearch host option again, as now the host is always set by default.

Checklist

- [ ] I have signed the Contributor License Agreement.

  • My code follows the style guidelines of this project (run make check-full for static code checks and linting)
  • I have rebased my changes on top of the latest master branch

- [ ] I have made corresponding changes to the documentation

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

How to test these changes

Configure some option of apm-server.api_key.elasticsearch.* and ensure default values are applied for missing configuration options.
Default values are hosts: []string{"localhost:9200"}, protocol: "http", timeout: 5s.

E.g. ensure to have a locally running Elasticsearch instance with security enabled and run ./apm-server apikey create -e -E apm-server.api_key.enabled=true -E apm-server.api_key.elasticsearch.username=foo -E apm-server.api_key.elasticsearch.password=bar
When providing proper username+password this should create an API Key, by using the default host configuration of localhost:9200.

Related issues

fixes #3341

When configuring an Elasticsearch instance for API Key usage,
Elasticsearch default values should be merged with the custom config,
to avoid having to configure all settings.

fixes elastic#3341
@simitt simitt added the bug label Feb 17, 2020
@simitt simitt requested a review from jalvz February 17, 2020 14:27
@simitt simitt merged commit e36b645 into elastic:master Feb 18, 2020
simitt added a commit to simitt/apm-server that referenced this pull request Feb 18, 2020
…tic#3342)

When configuring an Elasticsearch instance for API Key usage,
Elasticsearch default values should be merged with the custom config,
to avoid having to configure all settings.

fixes elastic#3341
simitt added a commit to simitt/apm-server that referenced this pull request Feb 18, 2020
…tic#3342)

When configuring an Elasticsearch instance for API Key usage,
Elasticsearch default values should be merged with the custom config,
to avoid having to configure all settings.

fixes elastic#3341
simitt added a commit that referenced this pull request Feb 21, 2020
… (#3354)

When configuring an Elasticsearch instance for API Key usage,
Elasticsearch default values should be merged with the custom config,
to avoid having to configure all settings.

fixes #3341
@simitt simitt deleted the fix-es-apikey-defaults branch February 21, 2020 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Respect default values for ES instance when configuring for API Keys
2 participants