Add publicBaseUrl to Elasticsearch config (#191837)

## Summary

This adds a publicBaseUrl to the Elasticsearch plugin config so users
can set a publicly accessible URL for Elasticsearch.

---------

Co-authored-by: Rudolf Meijering <skaapgif@gmail.com>
This commit is contained in:
Sander Philipse 2024-09-04 13:45:27 +02:00 committed by GitHub
parent 00230cfe0c
commit d21d3987e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 4 deletions

View file

@ -14,7 +14,7 @@ KBN_PATH_CONF=/home/kibana/config ./bin/kibana
--
The default host and port settings configure {kib} to run on `localhost:5601`. To change this behavior and allow remote users to connect, you'll need to update your `kibana.yml` file. You can also enable SSL and set a
variety of other options.
variety of other options.
Environment variables can be injected into configuration using `${MY_ENV_VAR}` syntax. By default, configuration validation
will fail if an environment variable used in the config file is not present when Kibana starts. This behavior can be changed by using a default value
@ -93,7 +93,7 @@ The maximum number of sockets that can be used for communications with {es}.
*Default: `Infinity`*
[[elasticsearch-maxResponseSize]] `elasticsearch.maxResponseSize`::
Either `false` or a `byteSize` value. When set, responses from {es} with a size higher than the defined limit will be rejected.
Either `false` or a `byteSize` value. When set, responses from {es} with a size higher than the defined limit will be rejected.
This is intended to be used as a circuit-breaker mechanism to avoid memory errors in case of unexpectedly high responses coming from {es}.
*Default: `false`*
@ -117,6 +117,9 @@ listed here must be on the same cluster. *Default: `[ "http://localhost:9200" ]`
To enable SSL/TLS for outbound connections to {es}, use the `https` protocol
in this setting.
[[elasticsearch-publicBaseUrl]] `elasticsearch.publicBaseUrl:`::
The URL through which Elasticsearch is publicly accessible, if any. This will be shown to users in Kibana when they need connection details for your Elasticsearch cluster.
[[elasticsearch-pingTimeout]] `elasticsearch.pingTimeout`::
Time in milliseconds to wait for {es} to respond to pings.
*Default: the value of the <<elasticsearch-requestTimeout, `elasticsearch.requestTimeout`>> setting*
@ -470,7 +473,7 @@ identifies this {kib} instance. *Default: `"your-hostname"`*
setting specifies the port to use. *Default: `5601`*
`server.protocol`::
experimental[] The http protocol to use, either `http1` or `http2`. Set to `http2` to enable `HTTP/2` support for the {kib} server.
experimental[] The http protocol to use, either `http1` or `http2`. Set to `http2` to enable `HTTP/2` support for the {kib} server.
*Default: `http1`*
+
NOTE: By default, enabling `http2` requires a valid `h2c` configuration, meaning that TLS must be enabled via <<server-ssl-enabled, `server.ssl.enabled`>>

View file

@ -190,6 +190,7 @@ export const configSchema = schema.object({
{ defaultValue: [] }
),
dnsCacheTtl: schema.duration({ defaultValue: 0, min: 0 }),
publicBaseUrl: schema.maybe(hostURISchema),
});
const deprecations: ConfigDeprecationProvider = () => [

View file

@ -90,6 +90,12 @@ export interface ElasticsearchServiceSetup {
*/
readonly config$: Observable<IElasticsearchConfig>;
};
/**
* The public base URL (if any) that should be used by end users to access the Elasticsearch cluster.
*/
readonly publicBaseUrl?: string;
}
/**

View file

@ -202,7 +202,7 @@ export class CloudPlugin implements Plugin<CloudSetup, CloudStart> {
organizationId,
instanceSizeMb: readInstanceSizeMb(),
deploymentId,
elasticsearchUrl: decodedId?.elasticsearchUrl,
elasticsearchUrl: core.elasticsearch.publicBaseUrl || decodedId?.elasticsearchUrl,
kibanaUrl: decodedId?.kibanaUrl,
cloudHost: decodedId?.host,
cloudDefaultPort: decodedId?.defaultPort,