createCluster requires a partial elasticsearch config#40405
Merged
mshustov merged 4 commits intoelastic:masterfrom Jul 9, 2019
Merged
createCluster requires a partial elasticsearch config#40405mshustov merged 4 commits intoelastic:masterfrom
mshustov merged 4 commits intoelastic:masterfrom
Conversation
Contributor
💔 Build Failed |
900f666 to
b2c378a
Compare
b2c378a to
6ea0cb7
Compare
mshustov
commented
Jul 8, 2019
|
|
||
| /** | ||
| * @internalremarks Config that consumers can pass to the Elasticsearch JS client is complex and includes | ||
| * @privateRemarks Config that consumers can pass to the Elasticsearch JS client is complex and includes |
Contributor
Author
There was a problem hiding this comment.
didn't find @internalremarks in spec https://github.com/microsoft/tsdoc/blob/master/tsdoc/src/details/StandardTags.ts
mshustov
commented
Jul 8, 2019
| * We fill all the missing properties in the `clientConfig` using the default | ||
| * Elasticsearch config so that we don't depend on default values set and | ||
| * controlled by underlying Elasticsearch JS client. | ||
| * We don't run validation against passed config expect it to be valid. |
Contributor
Author
There was a problem hiding this comment.
We should add validation eventually
mshustov
commented
Jul 8, 2019
| createClient: (type: string, clientConfig: ElasticsearchClientConfig) => { | ||
| return this.createClusterClient(type, clientConfig, deps.http.auth.getAuthHeaders); | ||
| createClient: (type: string, clientConfig: Partial<ElasticsearchClientConfig> = {}) => { | ||
| const finalConfig = merge({}, config, clientConfig); |
Contributor
Author
There was a problem hiding this comment.
it's not a full equivalent of
{
...esConfig,
...clientConfig
}but I'd expect that user may want to re-write only a part of complex ssl config instead of declaring the full version of it.
Contributor
💚 Build Succeeded |
10 tasks
Contributor
|
Pinging @elastic/kibana-platform |
mshustov
added a commit
to mshustov/kibana
that referenced
this pull request
Jul 9, 2019
* createCluster created with partial config * add tests * re-genereate docs
mshustov
added a commit
that referenced
this pull request
Jul 9, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CreateCluster interface requires passing the whole elasticsearch config as a parameter which leads to leaking elasticsearch config outside of the service. At the same time, the current implementation already relies on partial config:
https://github.com/restrry/kibana/blob/a22349a8bf320a88e19f861ccbf0fd3f30eddf68/src/legacy/core_plugins/elasticsearch/index.js#L83-L86
PR shouldn't change behavior, but make the function interface more convenient to use.
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.[ ] This was checked for cross-browser compatibility, including a check against IE11[ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support[ ] Documentation was added for features that require explanation or tutorials[ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers