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 basic serverless support for elasticsearch, beats index management #36587

Merged
merged 13 commits into from
Sep 20, 2023

Conversation

fearful-symmetry
Copy link
Contributor

@fearful-symmetry fearful-symmetry commented Sep 13, 2023

Proposed commit message

The tests that are a part of elastic/elastic-agent#3258 will pass with this PR.

There's a few parts to this PR:

  • Adds an IsServerless() method to the ES client
  • Changes the Ping() method in the ES client
  • Adds some checks to the index management setup process to bypass ILM setup under serverless
  • Adds some doc comments where needed
  • Changes a handful of ES interfaces to support the IsServerless() method

If there's anything weird in this PR, it's probably because I spent a day just sorting through ancient ILM code.

So, I'm not sure if we want to merge this without DSL support, or add DSL support in a follow-up PR, or merge elastic/elastic-agent#3258 before or after this PR. Currently open to suggestions.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

@fearful-symmetry fearful-symmetry requested a review from a team as a code owner September 13, 2023 20:39
@fearful-symmetry fearful-symmetry self-assigned this Sep 13, 2023
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Sep 13, 2023
@mergify
Copy link
Contributor

mergify bot commented Sep 13, 2023

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @fearful-symmetry? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

@elasticmachine
Copy link
Collaborator

elasticmachine commented Sep 13, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-09-20T16:36:30.074+0000

  • Duration: 101 min 21 sec

Test stats 🧪

Test Results
Failed 0
Passed 28277
Skipped 2013
Total 30290

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@fearful-symmetry fearful-symmetry requested a review from a team as a code owner September 13, 2023 21:31
@mergify
Copy link
Contributor

mergify bot commented Sep 13, 2023

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b serverless-aware upstream/serverless-aware
git merge upstream/main
git push upstream serverless-aware

Copy link
Contributor

@faec faec left a comment

Choose a reason for hiding this comment

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

Looks good as far as the code here (thank you for adding more docs!)... I don't have the context to say much about inter-repo order of operations for this feature but it looks to me like merging this one wouldn't break anything, so it's probably a reasonable incremental step?

if versionData.Version.BuildFlavor == "serverless" {
conn.isServerless = true
} else if versionData.Version.BuildFlavor == "default" {
conn.isServerless = false
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this ever actually change, or is this just defensive programming? If the latter can you add a comment saying something like "this should already be false but let's be extra careful"?

}
err = selCfg.SetChild("indices", -1, sub)
if err != nil {
return nil, fmt.Errorf("error setting child 'indicies': %w", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

typo (indicies)

Copy link
Member

@cmacknz cmacknz left a comment

Choose a reason for hiding this comment

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

A few suggestions to improve error text to use official names, otherwise looks good.

libbeat/cmd/instance/beat.go Outdated Show resolved Hide resolved
libbeat/dashboards/kibana_loader.go Outdated Show resolved Hide resolved
libbeat/dashboards/kibana_loader.go Outdated Show resolved Hide resolved
@fearful-symmetry fearful-symmetry merged commit bd088b8 into elastic:main Sep 20, 2023
114 checks passed
Scholar-Li pushed a commit to Scholar-Li/beats that referenced this pull request Feb 5, 2024
elastic#36587)

* make serverless integration tests run

* update deps

* linter, error handling

* still fixing error handling

* fixing old formatting verbs

* still finding format verbs

* add docs, fix typos

* Update libbeat/cmd/instance/beat.go

Co-authored-by: Craig MacKenzie <[email protected]>

* Update libbeat/dashboards/kibana_loader.go

Co-authored-by: Craig MacKenzie <[email protected]>

* Update libbeat/dashboards/kibana_loader.go

Co-authored-by: Craig MacKenzie <[email protected]>

---------

Co-authored-by: Craig MacKenzie <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants