-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Ingest Manager] Use cloudId for ES & Kibana URLs if available. #65366
[Ingest Manager] Use cloudId for ES & Kibana URLs if available. #65366
Conversation
Pinging @elastic/ingest-management (Team:Ingest Management) |
x-pack/plugins/ingest_manager/common/services/decode_cloud_id.ts
Outdated
Show resolved
Hide resolved
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.
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}`); |
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.
missing a return here no?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it be flagsUrl || cloudUrl || defaultUrl
? (prefer flagsUrl over everything else including cloudUrl)
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
@@ -53,7 +58,7 @@ export async function setupIngestManager( | |||
return settingsService.saveSettings(soClient, { | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment here wrt ordering
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
…tic#65366) * Use cloudId for ES & Kibana URLs if available. * Add tests and a missing return * Use console.debug for consistency
…) (#65393) * Use cloudId for ES & Kibana URLs if available. * Add tests and a missing return * Use console.debug for consistency
Summary
closes #64513
decodeCloudId
function 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)