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

[8.11] [Fleet] Fix inability to upgrade agents from 8.10.4 -> 8.11 (#170974) #171039

Merged
merged 6 commits into from
Nov 12, 2023

Conversation

kpollich
Copy link
Member

Backport

This will backport the following commits from main to 8.11:

Questions ?

Please refer to the Backport tool documentation

…170974)

## Summary

Closes elastic#169825

This PR adds logic to Fleet's `/api/agents/available_versions` endpoint
that will ensure we periodically try to fetch from the live product
versions API at https://www.elastic.co/api/product_versions to make sure
we have eventual consistency in the list of available agent versions.

Currently, Kibana relies entirely on a static file generated at build
time from the above API. If the API isn't up-to-date with the latest
agent version (e.g. kibana completed its build before agent), then that
build of Kibana will never "see" the corresponding build of agent.

This API endpoint is cached for two hours to prevent overfetching from
this external API, and from constantly going out to disk to read from
the agent versions file.

## To do
- [x] Update unit tests
- [x] Consider airgapped environments

## On airgapped environments

In airgapped environments, we're going to try and fetch from the
`product_versions` API and that request is going to fail. What we've
seen happen in some environments is that these requests do not "fail
fast" and instead wait until a network timeout is reached.

I'd love to avoid that timeout case and somehow detect airgapped
environments and avoid calling this API at all. However, we don't have a
great deterministic way to know if someone is in an airgapped
environment. The best guess I think we can make is by checking whether
`xpack.fleet.registryUrl` is set to something other than
`https://epr.elastic.co`. Curious if anyone has thoughts on this.

## Screenshots

![image](https://github.com/elastic/kibana/assets/6766512/0906817c-0098-4b67-8791-d06730f450f6)

![image](https://github.com/elastic/kibana/assets/6766512/59e7c132-f568-470f-b48d-53761ddc2fde)

![image](https://github.com/elastic/kibana/assets/6766512/986372df-a90f-48c3-ae24-c3012e8f7730)

## To test

1. Set up Fleet Server + ES + Kibana
2. Spin up a Fleet Server running Agent v8.11.0
3. Enroll an agent running v8.10.4 (I used multipass)
4. Verify the agent can be upgraded from the UI

---------

Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit cd909f0)

# Conflicts:
#	x-pack/plugins/fleet/server/services/agents/versions.ts
@kpollich kpollich enabled auto-merge (squash) November 10, 2023 16:29
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Nov 10, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@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!)

@kpollich kpollich self-assigned this Nov 10, 2023
@kpollich
Copy link
Member Author

@elasticmachine merge upstream

@kpollich
Copy link
Member Author

@elasticmachine merge upstream

@kpollich
Copy link
Member Author

@elasticmachine merge upstream

@kpollich
Copy link
Member Author

@elasticmachine merge upstream

@kpollich
Copy link
Member Author

@elasticmachine merge upstream

@kpollich
Copy link
Member Author

buildkite test this

@kibana-ci
Copy link
Collaborator

kibana-ci commented Nov 12, 2023

💔 Build Failed

Failed CI Steps

Metrics [docs]

✅ unchanged

History

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

cc @kpollich

@kevinlog
Copy link
Contributor

@kpollich - apologies that this has been failing - you should be able to merge although the burn is failing. I will keep an eye on this too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants