[Elastic Agent] Reload fleet.kibana.hosts from policy change#21599
[Elastic Agent] Reload fleet.kibana.hosts from policy change#21599blakerouse merged 5 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/ingest-management (Team:Ingest Management) |
michalpristas
left a comment
There was a problem hiding this comment.
Small things to look at but it looks good
| return nil | ||
| } | ||
| // only set protocol/hosts as that is all Fleet currently sends | ||
| h.config.Fleet.Kibana.Protocol = cfg.Fleet.Kibana.Protocol |
There was a problem hiding this comment.
in case client creation fails we will end up with updated values in memory which does not correspond to currently running client, we should probably do some rollback on error
There was a problem hiding this comment.
Good call, I have added in rollback of the previous values on failure.
| } | ||
|
|
||
| func (f *fleetGateway) SetClient(client clienter) { | ||
| f.client = client |
There was a problem hiding this comment.
maybe we should here and in acker make sure client is not change while performing execute/ack action.
at least it can be misleading e.g
- performin a call using client1 - fails
- client is updated
- reporting failure from step 1 but client.URI is different now
There was a problem hiding this comment.
Actually I think this flow is correct, because each action from Fleet is handled synchronously in the Agent. So when a policy change comes in with an updated hosts, they action will not be Ack'd until this code is able to re-connect back to Kibana using the new hosts information.
fleetapi.NewAuthWithConfig ensures that the created client can communicate with Kibana, so that means the Ack will not happen until the updated client is created and set.
…ci-build-label-support * upstream/master: (60 commits) Skip publisher flaky tests (elastic#21657) backport: add 7.10 branch (elastic#21635) [CI: Packaging] fix: push ubi8 images too (elastic#21621) Docker build resiliance with a retry (elastic#21587) Fix flaky FSWatch/FSScanner tests (elastic#21625) chore: add versions 7.1x (elastic#21670) [Elastic Agent] Reload fleet.kibana.hosts from policy change (elastic#21599) Fix cyberark/corepas pipeline (elastic#21643) Add openstack ssl provider in add_cloud_metadata (elastic#21590) Add fips_enabled into all aws filesets (elastic#21626) [Filebeat S3] Change log.file.path to be nested object (elastic#21624) [CI] Change notification channel (elastic#21559) Add `add_observer_metadata` `geo.name` to Quickstart (elastic#21501) [E2E Tests] fix: set versions ony for PRs (elastic#21608) Fix badger build in 386 (elastic#21613) docs: Update timestamp.asciidoc (elastic#20395) Remove nil-zero metrics and linux-exclusive metrics from Metricbeat (elastic#21457) [Metricbeat] Use timestamp from CloudWatch for events (elastic#21498) [Filebeat][S3 Input] Add support for FIPS endpoints (elastic#21585) [Ingest Manager] Use new form of fleet API paths (elastic#21478) ...
…012-2.0 * upstream/master: (110 commits) Skip publisher flaky tests (elastic#21657) backport: add 7.10 branch (elastic#21635) [CI: Packaging] fix: push ubi8 images too (elastic#21621) Docker build resiliance with a retry (elastic#21587) Fix flaky FSWatch/FSScanner tests (elastic#21625) chore: add versions 7.1x (elastic#21670) [Elastic Agent] Reload fleet.kibana.hosts from policy change (elastic#21599) Fix cyberark/corepas pipeline (elastic#21643) Add openstack ssl provider in add_cloud_metadata (elastic#21590) Add fips_enabled into all aws filesets (elastic#21626) [Filebeat S3] Change log.file.path to be nested object (elastic#21624) [CI] Change notification channel (elastic#21559) Add `add_observer_metadata` `geo.name` to Quickstart (elastic#21501) [E2E Tests] fix: set versions ony for PRs (elastic#21608) Fix badger build in 386 (elastic#21613) docs: Update timestamp.asciidoc (elastic#20395) Remove nil-zero metrics and linux-exclusive metrics from Metricbeat (elastic#21457) [Metricbeat] Use timestamp from CloudWatch for events (elastic#21498) [Filebeat][S3 Input] Add support for FIPS endpoints (elastic#21585) [Ingest Manager] Use new form of fleet API paths (elastic#21478) ...
What does this PR do?
When a policy change is sent to the Elastic Agent it will now read the
fleet.kibana.hostsvalues and if its different then the current running values it will re-create the Kibana client with the new hosts list and update thefleet.ymlto include the new information.Why is it important?
Allows an Agent to be updated with the new endpoints to contact back to Kibana, including multiple hosts.
Checklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration filesCHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.Related issues