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

Add checks for serverless support #150

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

fearful-symmetry
Copy link
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 rdner and faec and removed request for a team September 13, 2023 17:17
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

cc @fearful-symmetry

@fearful-symmetry fearful-symmetry merged commit dbdaf18 into elastic:main Sep 13, 2023
5 checks passed
// 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
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