[Ingest Manager] Use cloudId for ES & Kibana URLs if available.#65366
[Ingest Manager] Use cloudId for ES & Kibana URLs if available.#65366jfsiii merged 3 commits intoelastic:masterfrom jfsiii:64513-use-cloudid-for-hosts-if-possible
Conversation
|
Pinging @elastic/ingest-management (Team:Ingest Management) |
nchaulet
left a comment
There was a problem hiding this comment.
Nothing blocking it would be nice if we can have a logger un appContext instead of using console.log
| if (words.length < 3) { | ||
| // throw new Error(`Expected at least 3 parts in ${decoded}`); | ||
| // eslint-disable-next-line no-console | ||
| console.log(`Expected at least 3 parts in ${decoded}`); |
| const cloudUrl = cloudId && decodeCloudId(cloudId)?.elasticsearchUrl; | ||
| const flagsUrl = appContextService.getConfig()!.fleet.elasticsearch.host; | ||
| const defaultUrl = 'http://localhost:9200'; | ||
| const defaultOutputUrl = cloudUrl || flagsUrl || defaultUrl; |
There was a problem hiding this comment.
shouldn't it be flagsUrl || cloudUrl || defaultUrl? (prefer flagsUrl over everything else including cloudUrl)
There was a problem hiding this comment.
I think if we are in the context of cloud cloudUrl is probably the better bet also you should not be able to edit the flags as these flags are not whitelisted
There was a problem hiding this comment.
ok, I wasn't clear on where we were with having our settings whitelisted in cloud. if they are not going to end up whitelisted then my comment isn't relevant 😄
There was a problem hiding this comment.
@jen-huang The logic was initially discussed in Slack & #64513 (comment)
@nchaulet is correct that we cannot use these flags in Cloud. We should only have a cloudId if we're in cloud and, at least for now, if we're in Cloud we do not want users pointing to other instances.
| agent_auto_upgrade: true, | ||
| package_auto_upgrade: true, | ||
| kibana_url: appContextService.getConfig()?.fleet?.kibana?.host ?? defaultKibanaUrl, | ||
| kibana_url: cloudUrl || flagsUrl || defaultUrl, |
There was a problem hiding this comment.
same comment here wrt ordering
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
…) (#65393) * Use cloudId for ES & Kibana URLs if available. * Add tests and a missing return * Use console.debug for consistency
Summary
closes #64513
decodeCloudIdfunction based on code & tests in libbeat. Tests added in cf7b45aTest
This only takes effect when creating the default host, so start ES fresh to ensure a default output is created.
Cloud
Start kibana with cloud plugin & ID
See the values that corresponds to here or

Default output has the cloud value, even though a CLI flag was passed:

Kibana URL is Cloud URL not local

Local
Start Kibana without cloud & with one host via CLI
Default output has CLI value

Kibana URL is local (port 5603 + basepath in this example)
