Expose decoded cloudId components from the cloud plugin's contract#159442
Expose decoded cloudId components from the cloud plugin's contract#159442pgayvallet merged 18 commits intoelastic:mainfrom
Conversation
…-ref HEAD~1..HEAD --fix'
| kibanaUrl: string; | ||
| } | ||
| | undefined { | ||
| export function decodeCloudId(cid: string): DecodedCloudId | undefined { |
There was a problem hiding this comment.
Moved, pretty much without any modifications, to the cloud plugin. Tell me if you think anything within the method should be changed.
There was a problem hiding this comment.
Can't add a comment in that line. Should we use a different logger to replace all console.debug entries?
There was a problem hiding this comment.
Oh right, we have the client-side loggers now! will do.
| export interface CloudStart { | ||
| /** | ||
| * A React component that provides a pre-wired `React.Context` which connects components to Cloud services. | ||
| */ | ||
| CloudContextProvider: FC<{}>; |
There was a problem hiding this comment.
Took this opportunity to move the browser-side contracts to a dedicated file, given they started to become quite big.
| /** | ||
| * The full URL to the elasticsearch cluster. | ||
| */ | ||
| elasticsearchUrl?: string; | ||
| /** | ||
| * The full URL to the Kibana deployment. | ||
| */ | ||
| kibanaUrl?: string; | ||
| /** | ||
| * {host} from the deployment url https://<deploymentId>.<application>.<host><?:port> | ||
| */ | ||
| cloudHost?: string; | ||
| /** | ||
| * {port} from the deployment url https://<deploymentId>.<application>.<host><?:port> | ||
| */ | ||
| cloudDefaultPort?: string; |
There was a problem hiding this comment.
Naming is hard. I went with those, but I'm open to better suggestions (or better TSDoc)
|
|
||
| return { | ||
| cloudId: id, | ||
| deploymentId: parseDeploymentIdFromDeploymentUrl(this.config.deployment_url), |
There was a problem hiding this comment.
Added the deploymentId (which was only exposed on the server-side contract) while I was at it, given some plugins recoded their helper to access it.
|
Pinging @elastic/kibana-core (Team:Core) |
|
Moving into review as the current failures are unrelated to the PR's changes |
shahzad31
left a comment
There was a problem hiding this comment.
Synthetics changes LGTM !!
|
Pinging @elastic/fleet (Team:Fleet) |
|
Pinging @elastic/uptime (Team:uptime) |
ogupte
left a comment
There was a problem hiding this comment.
Observability onboarding changes LGTM. Thank you for this, it's so much better!
| * The full URL to the Kibana deployment. | ||
| */ | ||
| kibanaUrl?: string; |
There was a problem hiding this comment.
Just out of curiosity, is there a difference between this and server.publicBaseUrl? (Other than the fact that this will only be available in a cloud environment?)
There was a problem hiding this comment.
There is. server.publicBaseUrl is an arbitrary URL eventually set by the user, that is supposed to reflect the "public" way of accessing Kibana.
The url decrypted from the cloudId is
- only available on cloud (obviously)
- reflecting the "internal" way of accessing the deployment.
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
* main: (199 commits) [Lens] Add custom formatter within the Lens editor (elastic#158468) [Uptime] Hide app if no data is available (elastic#159118) [CodeEditor] Add grok highlighting (elastic#159334) Expose decoded cloudId components from the cloud plugin's contract (elastic#159442) [Profiling] Use collector and symbolizer integrations in the add data page (elastic#159481) [Infrastructure UI] Hosts View: Unified Search bar with auto-refresh enabled (elastic#157011) [APM] Add feature flag for not available apm schema (elastic#158911) [Lens] Remove deprecated componentWillReceiveProps usage (elastic#159502) [api-docs] 2023-06-13 Daily api_docs build (elastic#159536) [data views] Use versioned router for REST routes (elastic#158608) [maps] fix geo line source not loaded unless maps application is opened (elastic#159432) [Enterprise Search][Search application]Fix Create Api key url (elastic#159519) [Security Solution] Increase timeout for indexing hosts (elastic#159518) dashboard Reset button disable (elastic#159430) [Security Solution] Unskip Endpoint API tests after package fix (elastic#159484) [Synthetics] adjust alert timing (elastic#159511) [ResponseOps][rule registry] Remove usages of `refresh: true` (elastic#159252) Revert "Remove unused package (elastic#158597)" [Serverless] Adding config to disable authentication on task manager background worker utilization API (elastic#159505) Remove unused package (elastic#158597) ...
## Summary #159442 updated the decoding of the cloud id and added `elasticsearchUrl` & `kibanaUrl` to the `CloudStart` type, but it only set them on the `CloudSetup` result. This change will also add them to the `CloudStart` so they are available to code that is trying to read the values from `CloudStart` , mainly [serverless_search](https://github.com/elastic/kibana/blob/main/x-pack/plugins/serverless_search/public/application/components/overview.tsx#L49-L51) is what I'm concerned with.
…ng (#197) ## Summary - Extends `CloudNodePool.ParseCloudId` to extract per-service ports from the cloud ID, aligning with [how Kibana parses cloud IDs](elastic/kibana#159442). The format `host:port$esId:esPort$kbId:kbPort` is now fully supported, with port 443 as the default. - Adds a `CloudService` enum (`Elasticsearch`, `Kibana`) so the transport can target either service from the same cloud ID. - Adds new constructor overloads on `CloudNodePool`, `TransportConfiguration`, `TransportConfigurationDescriptor`, and `ElasticsearchConfiguration` that accept a `CloudService` parameter. - All existing constructors are preserved to avoid binary breaking changes. ## Test plan - [x] 17 new unit tests in `CloudNodePoolTests` covering: basic parsing, ES targeting, Kibana targeting, custom host port, per-service port overrides, default port (443) omission, error cases (missing Kibana UUID, empty cloud ID, etc.), and backward compatibility of old constructors. - [x] All tests pass on both `net10.0` and `net481`. - [x] Full existing test suite continues to pass (the one pre-existing `SerializesException` failure on `net481` is unrelated). Made with [Cursor](https://cursor.com) Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Fix #138813
cloudplugin's browser and server-side contractsdecodeCloudIdhelpers from the other plugins