-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
createCluster requires a partial elasticsearch config #40405
createCluster requires a partial elasticsearch config #40405
Conversation
💔 Build Failed |
900f666
to
b2c378a
Compare
b2c378a
to
6ea0cb7
Compare
@@ -28,7 +28,7 @@ import { Logger } from '../logging'; | |||
import { ElasticsearchConfig } from './elasticsearch_config'; | |||
|
|||
/** | |||
* @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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't find @internalremarks
in spec https://github.com/microsoft/tsdoc/blob/master/tsdoc/src/details/StandardTags.ts
* 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add validation eventually
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
💚 Build Succeeded |
Pinging @elastic/kibana-platform |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* createCluster created with partial config * add tests * re-genereate docs
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