elastic / fleet-server

The Fleet server allows managing a fleet of Elastic Agents.
Other
78 stars 79 forks source link

Support disabling Elasticsearch compatibility check running under the agent #3701

Open rdner opened 2 weeks ago

rdner commented 2 weeks ago

Describe the enhancement:

We should have a way of disabling the Elasticsearch compatibility check for testing purposes. There is a time period between minor releases when we need to run next minor version of the agent against a previous minor version of the stack.

Currently we have this error:

{
  "log.level": "info",
  "@timestamp": "2024-07-09T09:53:05.033Z",
  "log.origin": {
    "function": "github.com/elastic/elastic-agent/internal/pkg/agent/cmd.waitForFleetServer.func1",
    "file.name": "cmd/enroll_cmd.go",
    "file.line": 824
  },
  "message": "Fleet Server - Error - failed version compatibility check with elasticsearch (Agent: 8.16.0-SNAPSHOT, Elasticsearch: 8.15.0): unsupported version",
  "ecs.version": "1.6.0"
}

Which is coming from here https://github.com/elastic/fleet-server/blob/9cf540181f1ffa37d7dcbe28c7df592bd7d81ad8/internal/pkg/server/fleet.go#L445

The compatibility check is enforced only when Fleet Server is NOT running in the standalone mode and that's exactly how it's running under the agent:

https://github.com/elastic/fleet-server/blob/9cf540181f1ffa37d7dcbe28c7df592bd7d81ad8/internal/pkg/server/fleet.go#L61

https://github.com/elastic/fleet-server/blob/9cf540181f1ffa37d7dcbe28c7df592bd7d81ad8/internal/pkg/server/agent.go#L359

Describe a specific use case for the enhancement or feature:

Integration tests during the release cycle, when we still don't have a stack of the next minor but already have a snapshot of the agent in the next minor version.

Currently, we have to manually disable some tests for this period of time and then manually re-enable them.

cmacknz commented 2 weeks ago

This check was supposed to be unconditionally disabled between for snapshots, Fleet Server should tolerate an agent that is one minor version higher: https://github.com/elastic/fleet-server/pull/3039 and https://github.com/elastic/fleet-server/issues/2960

cmacknz commented 2 weeks ago

Ah this is for ES, we just need to do the same thing on that connection.