Skip to content

Add checks for serverless support #150

Merged
fearful-symmetry merged 1 commit intoelastic:mainfrom
fearful-symmetry:serverless-kibana
Sep 13, 2023
Merged

Add checks for serverless support #150
fearful-symmetry merged 1 commit intoelastic:mainfrom
fearful-symmetry:serverless-kibana

Conversation

@fearful-symmetry
Copy link
Copy Markdown
Contributor

What does this PR do?

Part of https://github.com/elastic/ingest-dev/issues/2176
and needed by elastic/elastic-agent#3258

This adds a KibanaIsServerless() method to the kibana client, and also adds a header check to ImportMultiPartFormFile()`, as the underlying saved objects API requires a special header when used under serverless

Why is it important?

Needed for serverless support.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.md

@fearful-symmetry fearful-symmetry added the Team:Elastic-Agent Label for the Agent team label Sep 13, 2023
@fearful-symmetry fearful-symmetry self-assigned this Sep 13, 2023
@fearful-symmetry fearful-symmetry requested a review from a team as a code owner September 13, 2023 17:17
@fearful-symmetry fearful-symmetry requested review from faec and rdner and removed request for a team September 13, 2023 17:17
@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

cc @fearful-symmetry

@fearful-symmetry fearful-symmetry merged commit dbdaf18 into elastic:main Sep 13, 2023
// Right now we don't have an API to tell us if we're running against serverless or not, so this actual implementation is something of a hack.
// see https://github.com/elastic/kibana/pull/164850
func (client *Client) KibanaIsServerless() (bool, error) {
ret, _, err := client.Connection.Request("GET", "/api/saved_objects/_find", nil, nil, nil)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If Kibana changes this, which is entirely possible because saved objects are one of the major APIs, then this might give us the wrong result at some point. Hopefully we can catch that in the snapshot builds before release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team:Elastic-Agent Label for the Agent team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants