Skip to content
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

[Fleet] Support output and Fleet server proxies on serverless #175315

Merged

Conversation

jillguyonnet
Copy link
Contributor

@jillguyonnet jillguyonnet commented Jan 23, 2024

Closes #165672

Summary

This PR adds support for custom output and Fleet server hosts with proxies in serverless mode:

  • Proxies are re-enabled in serverless.
  • It is possible to add custom Fleet server hosts in serverless, with the constraint that the host URL must match the Elasticsearch URL of the default host.
  • New Elasticsearch outputs must also have the default host URL.

Testing

The below requirements should be tested in serverless mode for observability and security project types:

# elasticsearch
yarn es serverless --kill
# kibana: one of
yarn serverless-oblt
yarn serverless-security

⚠️ In addition, stateful mode should not be affected by any of these changes.

Config

In order to test this change, you will need the following configuration to mirror a serverless setup.

Create a serverless.dev.yml if you don't have one already and set a project id (this is required for Fleet's cloud.isServerlessEnabled to correctly be true):

xpack.cloud.serverless.project_id: test-123

In kibana.devl.yml, make sure the default Fleet server hosts and default output have the expected ids:

xpack.fleet.fleetServerHosts:
  - id: default-fleet-server
    name: Default Fleet server
    is_default: true
    host_urls: ['https://host.docker.internal:8220']
xpack.fleet.outputs:
  - id: es-default-output
    name: Default output
    type: elasticsearch
    is_default: true
    is_default_monitoring: true
    hosts: ['https://host.docker.internal:9200']

Requirements

  • User can create proxy configurations in the Fleet UI and API.
  • User can create new Fleet server host via the UI
    • The Fleet Server Hosts dropdown is disabled and set to the default host URL
  • User can create new Fleet server host via the API
    • The request should succeed if the host URL is set the the default one
    • Otherwise the request should fail
  • User can add a proxy config to the Fleet server host config
  • User can select a custom Fleet Server host configuration from the Agent policy settings page
  • User can create new Fleet Elasticsearch output via the UI
    • The Hosts dropdown is disabled and set to the default Elasticsearch URL
  • User can create new Fleet Elasticsearch output via the API
    • The request should succeed if the host URL is set the the default one
    • Otherwise the request should fail
  • User can add a proxy config to the Elasticsearch output
  • User can select a custom Elasticsearch output configuration from the Agent policy settings page
  • User can create a custom Logstash output with proxy
  • User can create a custom Kafka output with proxy

Checklist

Screenshots

Fleet settings (proxies available):

Screenshot 2024-02-02 at 17 21 05

Screenshot 2024-02-02 at 17 21 15

Adding and editing a Fleet server host:

Screenshot 2024-02-05 at 11 54 04

Screenshot 2024-02-02 at 17 22 00

Adding and editing an Elasticsearch output:

Screenshot 2024-02-02 at 17 22 23

Screenshot 2024-02-02 at 17 22 38

@jillguyonnet jillguyonnet self-assigned this Jan 23, 2024
@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • /oblt-deploy-serverless : Deploy a serverless Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@jillguyonnet jillguyonnet force-pushed the fleet/165672-serverless-proxies-support branch from a15b3ca to 3db1fa4 Compare January 29, 2024 10:31
@juliaElastic
Copy link
Contributor

juliaElastic commented Jan 29, 2024

Testing this locally, I started a security project. I am able to create proxy but can't assign it to the default fleet server host (API call fails), and I can't create another fleet server host.
image

Also when I try to create a new ES output with a proxy, can't save it as it says host url is required. The field looks populated and disabled, but fails the form validation.
image

@jillguyonnet
Copy link
Contributor Author

Thank you for testing @juliaElastic!

I have made some changes locally following @nchaulet's indications, I will check this before committing.

Also thanks for pointing out the different project types, I have only been using observability type so far. Correct me if I'm wrong: we should test this for security and observability types, correct? (as well as testing that there were no changes affecting stateful mode)

@juliaElastic
Copy link
Contributor

juliaElastic commented Jan 29, 2024

Also thanks for pointing out the different project types, I have only been using observability type so far. Correct me if I'm wrong: we should test this for security and observability types, correct? (as well as testing that there were no changes affecting stateful mode)

Yes, security and observability project type have fleet enabled, the elasticsearch project type has fleet disabled.

@jillguyonnet
Copy link
Contributor Author

/ci

@juliaElastic
Copy link
Contributor

juliaElastic commented Jan 31, 2024

I'm testing with the latest changes, and still seeing a missing host url when trying to add a new elasticsearch output:
image

For the fleet server hosts, I can see the button now to add a new one, though it comes with an empty host url. Shouldn't it be pre-populated with the default url and not be changeable? I see there is a validation to prevent adding a different url when clicking on Continue.
Also I'm wondering if instead of reusing the Add Fleet Server flyout, we could add a simplified version, something like the Edit Fleet server flyout in create mode. Currently, there is a lot of options on the flyout that are not relevant for serverless (quickstart/advanced, enroll fleet server) and adding a proxy to a new host entry can't be done in one step.
image

image

@jillguyonnet
Copy link
Contributor Author

jillguyonnet commented Jan 31, 2024

@juliaElastic Thanks again for testing!

Regarding creating an output: does the default output in your setup have id es-default-output? I set the following in my kibana.dev.yml to make it work per the fleet controller config:

xpack.fleet.outputs:
  - id: es-default-output
    name: Default output
    type: elasticsearch
    is_default: true
    is_default_monitoring: true
    hosts: ['https://host.docker.internal:9200']

I guess the same question applies to the default Fleet server host:

xpack.fleet.fleetServerHosts:
  - id: default-fleet-server
    name: Default Fleet server
    is_default: true
    host_urls: ['https://host.docker.internal:8220']
If the ids are correct, can you please share your config?

I really like your suggestion about simplifying the flyout for creating a Fleet server, that's a great point 👍 Let me check it out, I don't think it would be very complicated.

@juliaElastic
Copy link
Contributor

Regarding creating an output: does the default output in your setup have id es-default-output?

My bad, I don't have these ids. I'll add to the preconfig locally and test again. Sorry for the false alarm.

@jillguyonnet
Copy link
Contributor Author

My bad, I don't have these ids. I'll add to the preconfig locally and test again. Sorry for the false alarm.

No worries, I understand these ids are fixed in serverless but please correct me if that's not the case. I will update the testing steps to make that clearer.

@@ -18,4 +18,23 @@ export default createTestConfig({
// include settings from project controller
// https://github.com/elastic/project-controller/blob/main/internal/project/security/config/elasticsearch.yml
esServerArgs: ['xpack.ml.nlp.enabled=false'],

// Required for Fleet setup.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would make sense to extract this to a Fleet-specific config file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, perhaps Fleet related tests could move to test_suites/fleet?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some thought, I added new config files for Fleet in the test_suites/observability/fleet and test_suites/security/fleet folders in order to preserve the existing structure by project type and avoid adding unnecessary config to other tests. I also added a paragraph in the README on how to run these. Let me know how that sounds.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh okay, I didn't realise it means the project type. I'm good with these changes 👍

@jillguyonnet
Copy link
Contributor Author

/ci

@nchaulet nchaulet self-requested a review January 31, 2024 20:59
@nchaulet
Copy link
Member

Just did some tests, and it seems to work well for output.

For the fleet server I think the idea of @juliaElastic to reuse the edit fleet server flyout to allow to add one will make sense (I think the flyout almost support it)

@nimarezainia
Copy link
Contributor

@nimarezainia Could you please give feedback on the flyouts? The latest screenshots are in the PR description.

@jillguyonnet thank you. Could we add a description why the user can't create a new fleet server - I think being descriptive is better here. So if I may suggest:

"You may create another Fleet Server definition reachable via a proxy. In context of the serverless project, Fleet Service is managed by Elastic. Creation of a new one is therefore not permitted."

@jillguyonnet
Copy link
Contributor Author

@elasticmachine merge upstream

@jillguyonnet
Copy link
Contributor Author

@jillguyonnet thank you. Could we add a description why the user can't create a new fleet server - I think being descriptive is better here. So if I may suggest:

"You may create another Fleet Server definition reachable via a proxy. In context of the serverless project, Fleet Service is managed by Elastic. Creation of a new one is therefore not permitted."

Thank you! I've updated the text and corresponding screenshot.

Copy link
Member

@azasypkin azasypkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change in test/plugin_functional/test_suites/core_plugins/rendering.ts, LGTM.

@jillguyonnet
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just tested the fleet server hosts flyout and it's working as expected. LGTM 🚀

Copy link
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
fleet 1.2MB 1.2MB +1.3KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
fleet 151.7KB 151.8KB +121.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @jillguyonnet

@jillguyonnet jillguyonnet merged commit 11fe56b into elastic:main Feb 5, 2024
23 checks passed
@jillguyonnet jillguyonnet deleted the fleet/165672-serverless-proxies-support branch February 5, 2024 15:00
@kibanamachine kibanamachine added v8.13.0 backport:skip This commit does not require backporting labels Feb 5, 2024
fkanout pushed a commit to fkanout/kibana that referenced this pull request Feb 7, 2024
…c#175315)

Closes elastic#165672

### Summary

This PR adds support for custom output and Fleet server hosts with
proxies in serverless mode:
- Proxies are re-enabled in serverless.
- It is possible to add custom Fleet server hosts in serverless, with
the constraint that the host URL must match the Elasticsearch URL of the
default host.
- New Elasticsearch outputs must also have the default host URL.

### Testing

The below requirements should be tested in serverless mode for
observability and security project types:
```sh
# elasticsearch
yarn es serverless --kill
# kibana: one of
yarn serverless-oblt
yarn serverless-security
```

⚠️ In addition, stateful mode should **not** be affected by any of these
changes.

#### Config

In order to test this change, you will need the following configuration
to mirror a serverless setup.

Create a `serverless.dev.yml` if you don't have one already and set a
project id (this is required for Fleet's `cloud.isServerlessEnabled` to
correctly be `true`):
```yaml
xpack.cloud.serverless.project_id: test-123
```

In `kibana.devl.yml`, make sure the default Fleet server hosts and
default output have the expected ids:
```yaml
xpack.fleet.fleetServerHosts:
  - id: default-fleet-server
    name: Default Fleet server
    is_default: true
    host_urls: ['https://host.docker.internal:8220']
xpack.fleet.outputs:
  - id: es-default-output
    name: Default output
    type: elasticsearch
    is_default: true
    is_default_monitoring: true
    hosts: ['https://host.docker.internal:9200']
```

#### Requirements

- [ ] User can create proxy configurations in the Fleet UI and API.
- [ ] User can create new Fleet server host via the UI
- The Fleet Server Hosts dropdown is disabled and set to the default
host URL
- [ ] User can create new Fleet server host via the API
- The request should succeed if the host URL is set the the default one
   - Otherwise the request should fail
- [ ] User can add a proxy config to the Fleet server host config
- [ ] User can select a custom Fleet Server host configuration from the
Agent policy settings page
- [ ] User can create new Fleet Elasticsearch output via the UI
- The Hosts dropdown is disabled and set to the default Elasticsearch
URL
- [ ] User can create new Fleet Elasticsearch output via the API
- The request should succeed if the host URL is set the the default one
   - Otherwise the request should fail
- [ ] User can add a proxy config to the Elasticsearch output
- [ ] User can select a custom Elasticsearch output configuration from
the Agent policy settings page
- [ ] User can create a custom Logstash output with proxy
- [ ] User can create a custom Kafka output with proxy

### Checklist

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### Screenshots

Fleet settings (proxies available):

![Screenshot 2024-02-02 at 17 21
05](https://github.com/elastic/kibana/assets/23701614/e94d3dfa-0467-48d0-9c99-c0288dfbba92)

![Screenshot 2024-02-02 at 17 21
15](https://github.com/elastic/kibana/assets/23701614/eb815d25-0e4c-497f-899a-036a89a0d126)

Adding and editing a Fleet server host:

![Screenshot 2024-02-05 at 11 54
04](https://github.com/elastic/kibana/assets/23701614/2ad713fd-7992-4285-8605-1841ab7f56ef)

![Screenshot 2024-02-02 at 17 22
00](https://github.com/elastic/kibana/assets/23701614/dae30411-b023-4a3c-bba2-427dd3b8cd2a)

Adding and editing an Elasticsearch output:

![Screenshot 2024-02-02 at 17 22
23](https://github.com/elastic/kibana/assets/23701614/cd6bdb90-d68a-4cf8-a1aa-34cf0eddc978)

![Screenshot 2024-02-02 at 17 22
38](https://github.com/elastic/kibana/assets/23701614/3a9c8f04-2586-4e3a-afd4-7a192245bc15)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
jillguyonnet added a commit that referenced this pull request Feb 12, 2024
## Summary

Closes #176352
Closes #176399

#175315 added the possibility to
configure new Fleet Server hosts in serverless, with the constraint that
the host URL must match the default URL. The API integration tests
written to test this have been flaky, probably due to request timeout
when fetching all Fleet Server hosts. This PR improves this by directly
retrieving the default Fleet Server host by id.

This fix has been tested using the Flaky Test Runner Pipeline, with 25
test runs for observability and security project types:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5140

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
…c#175315)

Closes elastic#165672

### Summary

This PR adds support for custom output and Fleet server hosts with
proxies in serverless mode:
- Proxies are re-enabled in serverless.
- It is possible to add custom Fleet server hosts in serverless, with
the constraint that the host URL must match the Elasticsearch URL of the
default host.
- New Elasticsearch outputs must also have the default host URL.

### Testing

The below requirements should be tested in serverless mode for
observability and security project types:
```sh
# elasticsearch
yarn es serverless --kill
# kibana: one of
yarn serverless-oblt
yarn serverless-security
```

⚠️ In addition, stateful mode should **not** be affected by any of these
changes.

#### Config

In order to test this change, you will need the following configuration
to mirror a serverless setup.

Create a `serverless.dev.yml` if you don't have one already and set a
project id (this is required for Fleet's `cloud.isServerlessEnabled` to
correctly be `true`):
```yaml
xpack.cloud.serverless.project_id: test-123
```

In `kibana.devl.yml`, make sure the default Fleet server hosts and
default output have the expected ids:
```yaml
xpack.fleet.fleetServerHosts:
  - id: default-fleet-server
    name: Default Fleet server
    is_default: true
    host_urls: ['https://host.docker.internal:8220']
xpack.fleet.outputs:
  - id: es-default-output
    name: Default output
    type: elasticsearch
    is_default: true
    is_default_monitoring: true
    hosts: ['https://host.docker.internal:9200']
```

#### Requirements

- [ ] User can create proxy configurations in the Fleet UI and API.
- [ ] User can create new Fleet server host via the UI
- The Fleet Server Hosts dropdown is disabled and set to the default
host URL
- [ ] User can create new Fleet server host via the API
- The request should succeed if the host URL is set the the default one
   - Otherwise the request should fail
- [ ] User can add a proxy config to the Fleet server host config
- [ ] User can select a custom Fleet Server host configuration from the
Agent policy settings page
- [ ] User can create new Fleet Elasticsearch output via the UI
- The Hosts dropdown is disabled and set to the default Elasticsearch
URL
- [ ] User can create new Fleet Elasticsearch output via the API
- The request should succeed if the host URL is set the the default one
   - Otherwise the request should fail
- [ ] User can add a proxy config to the Elasticsearch output
- [ ] User can select a custom Elasticsearch output configuration from
the Agent policy settings page
- [ ] User can create a custom Logstash output with proxy
- [ ] User can create a custom Kafka output with proxy

### Checklist

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### Screenshots

Fleet settings (proxies available):

![Screenshot 2024-02-02 at 17 21
05](https://github.com/elastic/kibana/assets/23701614/e94d3dfa-0467-48d0-9c99-c0288dfbba92)

![Screenshot 2024-02-02 at 17 21
15](https://github.com/elastic/kibana/assets/23701614/eb815d25-0e4c-497f-899a-036a89a0d126)

Adding and editing a Fleet server host:

![Screenshot 2024-02-05 at 11 54
04](https://github.com/elastic/kibana/assets/23701614/2ad713fd-7992-4285-8605-1841ab7f56ef)

![Screenshot 2024-02-02 at 17 22
00](https://github.com/elastic/kibana/assets/23701614/dae30411-b023-4a3c-bba2-427dd3b8cd2a)

Adding and editing an Elasticsearch output:

![Screenshot 2024-02-02 at 17 22
23](https://github.com/elastic/kibana/assets/23701614/cd6bdb90-d68a-4cf8-a1aa-34cf0eddc978)

![Screenshot 2024-02-02 at 17 22
38](https://github.com/elastic/kibana/assets/23701614/3a9c8f04-2586-4e3a-afd4-7a192245bc15)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
## Summary

Closes elastic#176352
Closes elastic#176399

elastic#175315 added the possibility to
configure new Fleet Server hosts in serverless, with the constraint that
the host URL must match the default URL. The API integration tests
written to test this have been flaky, probably due to request timeout
when fetching all Fleet Server hosts. This PR improves this by directly
retrieving the default Fleet Server host by id.

This fix has been tested using the Flaky Test Runner Pipeline, with 25
test runs for observability and security project types:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5140

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
…c#175315)

Closes elastic#165672

### Summary

This PR adds support for custom output and Fleet server hosts with
proxies in serverless mode:
- Proxies are re-enabled in serverless.
- It is possible to add custom Fleet server hosts in serverless, with
the constraint that the host URL must match the Elasticsearch URL of the
default host.
- New Elasticsearch outputs must also have the default host URL.

### Testing

The below requirements should be tested in serverless mode for
observability and security project types:
```sh
# elasticsearch
yarn es serverless --kill
# kibana: one of
yarn serverless-oblt
yarn serverless-security
```

⚠️ In addition, stateful mode should **not** be affected by any of these
changes.

#### Config

In order to test this change, you will need the following configuration
to mirror a serverless setup.

Create a `serverless.dev.yml` if you don't have one already and set a
project id (this is required for Fleet's `cloud.isServerlessEnabled` to
correctly be `true`):
```yaml
xpack.cloud.serverless.project_id: test-123
```

In `kibana.devl.yml`, make sure the default Fleet server hosts and
default output have the expected ids:
```yaml
xpack.fleet.fleetServerHosts:
  - id: default-fleet-server
    name: Default Fleet server
    is_default: true
    host_urls: ['https://host.docker.internal:8220']
xpack.fleet.outputs:
  - id: es-default-output
    name: Default output
    type: elasticsearch
    is_default: true
    is_default_monitoring: true
    hosts: ['https://host.docker.internal:9200']
```

#### Requirements

- [ ] User can create proxy configurations in the Fleet UI and API.
- [ ] User can create new Fleet server host via the UI
- The Fleet Server Hosts dropdown is disabled and set to the default
host URL
- [ ] User can create new Fleet server host via the API
- The request should succeed if the host URL is set the the default one
   - Otherwise the request should fail
- [ ] User can add a proxy config to the Fleet server host config
- [ ] User can select a custom Fleet Server host configuration from the
Agent policy settings page
- [ ] User can create new Fleet Elasticsearch output via the UI
- The Hosts dropdown is disabled and set to the default Elasticsearch
URL
- [ ] User can create new Fleet Elasticsearch output via the API
- The request should succeed if the host URL is set the the default one
   - Otherwise the request should fail
- [ ] User can add a proxy config to the Elasticsearch output
- [ ] User can select a custom Elasticsearch output configuration from
the Agent policy settings page
- [ ] User can create a custom Logstash output with proxy
- [ ] User can create a custom Kafka output with proxy

### Checklist

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### Screenshots

Fleet settings (proxies available):

![Screenshot 2024-02-02 at 17 21
05](https://github.com/elastic/kibana/assets/23701614/e94d3dfa-0467-48d0-9c99-c0288dfbba92)

![Screenshot 2024-02-02 at 17 21
15](https://github.com/elastic/kibana/assets/23701614/eb815d25-0e4c-497f-899a-036a89a0d126)

Adding and editing a Fleet server host:

![Screenshot 2024-02-05 at 11 54
04](https://github.com/elastic/kibana/assets/23701614/2ad713fd-7992-4285-8605-1841ab7f56ef)

![Screenshot 2024-02-02 at 17 22
00](https://github.com/elastic/kibana/assets/23701614/dae30411-b023-4a3c-bba2-427dd3b8cd2a)

Adding and editing an Elasticsearch output:

![Screenshot 2024-02-02 at 17 22
23](https://github.com/elastic/kibana/assets/23701614/cd6bdb90-d68a-4cf8-a1aa-34cf0eddc978)

![Screenshot 2024-02-02 at 17 22
38](https://github.com/elastic/kibana/assets/23701614/3a9c8f04-2586-4e3a-afd4-7a192245bc15)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
## Summary

Closes elastic#176352
Closes elastic#176399

elastic#175315 added the possibility to
configure new Fleet Server hosts in serverless, with the constraint that
the host URL must match the default URL. The API integration tests
written to test this have been flaky, probably due to request timeout
when fetching all Fleet Server hosts. This PR improves this by directly
retrieving the default Fleet Server host by id.

This fix has been tested using the Flaky Test Runner Pipeline, with 25
test runs for observability and security project types:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5140

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
jillguyonnet added a commit that referenced this pull request Feb 21, 2024
## Summary

Closes #176352
Closes #176399

#175315 added the possibility to
configure new Fleet Server hosts in serverless, with the constraint that
the host URL must match the default URL. The API integration tests
written to test this have been flaky, due to failure retrieving the
default Fleet Server host or default Elasticsearch output from saved
objects. This PR adds retry in the tests.

Note: I have tried adding retry logic in the API handlers but kept
hitting test flakiness.

This fix has been tested using the Flaky Test Runner Pipeline, with
48/49 test runs for observability and security project types:
🟢
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5218
🟢
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5222
🟢
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5225

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
fkanout pushed a commit to fkanout/kibana that referenced this pull request Mar 4, 2024
…c#175315)

Closes elastic#165672

### Summary

This PR adds support for custom output and Fleet server hosts with
proxies in serverless mode:
- Proxies are re-enabled in serverless.
- It is possible to add custom Fleet server hosts in serverless, with
the constraint that the host URL must match the Elasticsearch URL of the
default host.
- New Elasticsearch outputs must also have the default host URL.

### Testing

The below requirements should be tested in serverless mode for
observability and security project types:
```sh
# elasticsearch
yarn es serverless --kill
# kibana: one of
yarn serverless-oblt
yarn serverless-security
```

⚠️ In addition, stateful mode should **not** be affected by any of these
changes.

#### Config

In order to test this change, you will need the following configuration
to mirror a serverless setup.

Create a `serverless.dev.yml` if you don't have one already and set a
project id (this is required for Fleet's `cloud.isServerlessEnabled` to
correctly be `true`):
```yaml
xpack.cloud.serverless.project_id: test-123
```

In `kibana.devl.yml`, make sure the default Fleet server hosts and
default output have the expected ids:
```yaml
xpack.fleet.fleetServerHosts:
  - id: default-fleet-server
    name: Default Fleet server
    is_default: true
    host_urls: ['https://host.docker.internal:8220']
xpack.fleet.outputs:
  - id: es-default-output
    name: Default output
    type: elasticsearch
    is_default: true
    is_default_monitoring: true
    hosts: ['https://host.docker.internal:9200']
```

#### Requirements

- [ ] User can create proxy configurations in the Fleet UI and API.
- [ ] User can create new Fleet server host via the UI
- The Fleet Server Hosts dropdown is disabled and set to the default
host URL
- [ ] User can create new Fleet server host via the API
- The request should succeed if the host URL is set the the default one
   - Otherwise the request should fail
- [ ] User can add a proxy config to the Fleet server host config
- [ ] User can select a custom Fleet Server host configuration from the
Agent policy settings page
- [ ] User can create new Fleet Elasticsearch output via the UI
- The Hosts dropdown is disabled and set to the default Elasticsearch
URL
- [ ] User can create new Fleet Elasticsearch output via the API
- The request should succeed if the host URL is set the the default one
   - Otherwise the request should fail
- [ ] User can add a proxy config to the Elasticsearch output
- [ ] User can select a custom Elasticsearch output configuration from
the Agent policy settings page
- [ ] User can create a custom Logstash output with proxy
- [ ] User can create a custom Kafka output with proxy

### Checklist

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### Screenshots

Fleet settings (proxies available):

![Screenshot 2024-02-02 at 17 21
05](https://github.com/elastic/kibana/assets/23701614/e94d3dfa-0467-48d0-9c99-c0288dfbba92)

![Screenshot 2024-02-02 at 17 21
15](https://github.com/elastic/kibana/assets/23701614/eb815d25-0e4c-497f-899a-036a89a0d126)

Adding and editing a Fleet server host:

![Screenshot 2024-02-05 at 11 54
04](https://github.com/elastic/kibana/assets/23701614/2ad713fd-7992-4285-8605-1841ab7f56ef)

![Screenshot 2024-02-02 at 17 22
00](https://github.com/elastic/kibana/assets/23701614/dae30411-b023-4a3c-bba2-427dd3b8cd2a)

Adding and editing an Elasticsearch output:

![Screenshot 2024-02-02 at 17 22
23](https://github.com/elastic/kibana/assets/23701614/cd6bdb90-d68a-4cf8-a1aa-34cf0eddc978)

![Screenshot 2024-02-02 at 17 22
38](https://github.com/elastic/kibana/assets/23701614/3a9c8f04-2586-4e3a-afd4-7a192245bc15)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
fkanout pushed a commit to fkanout/kibana that referenced this pull request Mar 4, 2024
## Summary

Closes elastic#176352
Closes elastic#176399

elastic#175315 added the possibility to
configure new Fleet Server hosts in serverless, with the constraint that
the host URL must match the default URL. The API integration tests
written to test this have been flaky, probably due to request timeout
when fetching all Fleet Server hosts. This PR improves this by directly
retrieving the default Fleet Server host by id.

This fix has been tested using the Flaky Test Runner Pipeline, with 25
test runs for observability and security project types:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5140

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
fkanout pushed a commit to fkanout/kibana that referenced this pull request Mar 4, 2024
## Summary

Closes elastic#176352
Closes elastic#176399

elastic#175315 added the possibility to
configure new Fleet Server hosts in serverless, with the constraint that
the host URL must match the default URL. The API integration tests
written to test this have been flaky, due to failure retrieving the
default Fleet Server host or default Elasticsearch output from saved
objects. This PR adds retry in the tests.

Note: I have tried adding retry logic in the API handlers but kept
hitting test flakiness.

This fix has been tested using the Flaky Test Runner Pipeline, with
48/49 test runs for observability and security project types:
🟢
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5218
🟢
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5222
🟢
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5225

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
jillguyonnet added a commit to jillguyonnet/kibana that referenced this pull request Mar 12, 2024
## Summary

Closes elastic#176352
Closes elastic#176399

elastic#175315 added the possibility to
configure new Fleet Server hosts in serverless, with the constraint that
the host URL must match the default URL. The API integration tests
written to test this have been flaky, due to failure retrieving the
default Fleet Server host or default Elasticsearch output from saved
objects. This PR adds retry in the tests.

Note: I have tried adding retry logic in the API handlers but kept
hitting test flakiness.

This fix has been tested using the Flaky Test Runner Pipeline, with
48/49 test runs for observability and security project types:
🟢
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5218
🟢
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5222
🟢
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5225

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

(cherry picked from commit 83e64be)

# Conflicts:
#	x-pack/test_serverless/api_integration/test_suites/security/fleet/fleet.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.13 candidate backport:skip This commit does not require backporting release_note:enhancement Team:Fleet Team label for Observability Data Collection Fleet team v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet] Add support for output and Fleet Server proxies on Serverless