-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Fleet] Initiate Fleet setup on boot #111858
Comments
Pinging @elastic/fleet (Team:Fleet) |
This is captured as part of our top-level package policy upgrade under the final "Automatic package upgrades" bullet point. The plan, for now, is to add a flag to integrations that denotes whether associated package policies should automatically be upgraded when the package is updated. This should eventually be replaced with a value that comes from the actual package spec instead, so that packages like APM can instruct Fleet to automatically upgrade policies instead of relying on user configuration. We can introduce a piece of reconfiguration for these existing "auto-update" packages that includes this flag, as well. We set these packages up here: kibana/x-pack/plugins/fleet/common/constants/epm.ts Lines 17 to 40 in ee7e832
and install them as part of our reconfiguration process here: kibana/x-pack/plugins/fleet/server/services/setup.ts Lines 79 to 91 in ee7e832
So, we could set a flag on some or all of these specific preconfigured packages, and if necessary another one to indicate that this piece of configuration is "frozen" and uneditable by the user. When the setup process saves these packages with these flags set, all should function as expected once the implementation specified in the above top-level issue is completed. |
One thing that has come up as part of moving the Fleet setup call to start on Kibana boot is the issue of multiple nodes running the setup concurrently. Today we have a naive guard that prevents this happening on a single node, but nothing that prevents it from happening concurrently on multiple nodes. My thinking is that by moving this to Kibana boot, it’s more likely that the multi-node scenario could happen during upgrades. Questions:
Given the above, I think this should be safe to run all nodes if we can make the agent policies and package policy IDs deterministic and ensure that the create calls use For Agent policies, we do require that preconfigured policies supply a
To make package policies deterministic, we can probably piggy back off the agent policy deterministic ID logic and simply append the |
Thanks, @joshdover for the thorough explanation of our idempotency issues around setup. It seems to me that you've captured every concern I might've had and provided a path forward.
I don't think there are any negative side effects in the case that we create two identical agent policies from preconfiguration. Outside of general confusion for the user, I don't think this would cause any breakdowns in Fleet's functionality.
It does sound safest to me if we fall back to |
Output can use uuidv5 if the user provide an id but we do not provide an id for the default output (it should not be hard to change that)
I think it could be an issue as agents could be enrolling based on
Yes I think it will make sense to seed an uuid v5 with the name also we enforce name to be unique. For the cloud preconfigured policy they provide an id, should we rather make the id field mandatory in the preconfiguration? (it's what I did for preconfigured output ) |
@kpollich @nchaulet thanks for the feedback. I've summarized the discussion in this comment on the dedicated issue that Kyle created: #118423 (comment) |
Originally contained a WIP version of test instructions. See finalized version below |
Here are the full docs, sorry for not surfacing these sooner: https://www.elastic.co/guide/en/kibana/7.16/upgrade-migrations.html#upgrade-migrations-rolling-back I think the key steps are:
So we don't want to restore the whole snapshot just the |
This definitely makes sense, but following these instructions requires this step number 5, which I don't think is possible in Cloud:
I followed the other steps (deleting the |
@EricDavisX - sharing the latest version of manual testing steps for testing our managed packages as they relate to Kibana's upgrade/downgrade process. I just ran through these myself in a local dev environment ping-ponging between 7.15 and 7.16 instances. Hopefully, you are the right person to tag regarding developing a more robust test plan here with our QAS folks? Let me know if I can clarify anything here! Managed Packages and Kibana Downgrades - Manual Test Instructions
We investigated creating some automated tests to cover this case in #118797, but encountered some difficulties that prevented us from making much progress. We're instead opting to document manual testing procedures for Kibana downgrades and how they interact with our various "managed" integrations in Fleet. Manual Testing ProcedureGoal: Ensure that managed packages that we consider as "default" or "auto update" packages are downgraded when Kibana is rolled back. These steps are written to be performed on self-hosted Kibana, as downgrading Kibana in cloud is not currently supported. List of packages under test:
Start up a 7.15 environmentStart up a fresh instance of Elasticsearch on a 7.15 snapshot as well as a fresh Kibana 7.15 instance. Ensure Fleet setup is completed by visiting the Fleet application Kibana and waiting for the loading indicator to disappear and for the Fleet UI to appear. Ensure Kibana is set up for on-disk backupsAdd an
Install additional managed packagesInstall the following non-default managed packages. We don't need to create package policies here, so navigating to the integration's
Confirm integration versions for managed packagesConfirm the versions of all managed packages. We'll reference these versions later when we upgrade and then eventually downgrade again.
Snapshot your Kibana dataRegister a repositoryVia the Follow the docs to create a snapshot of your instance via Kibana dev tools, e.g.
Upgrade to a 7.16 environmentStop your 7.15 environment, and run a 7.16 environment in its place. Ensure you provide the same configuration values for the Run Fleet setup againNavigate to Confirm integration versions for managed packagesYour integrations should have a few new versions in 7.16. These are called out in bold.
Elastic Agent, Endpoint, Fleet Server, and Synthetics should all have upgraded to new versions, while APM and System should remain on their existing version through the upgrade process. Roll back to 7.15Follow the rollback documentation to rollback to 7.15. The key steps of this process should be:
Confirm integration versions for managed packagesYour packages should have downgraded to the versions they were prior to upgrading to 7.16. Kibana should not have maintained the newer versions of any packages.
|
@kpollich thanks, you can reach out to me, sure. I am going to pass this on to @dikshachauhan-qasource and @sagarnagpal-qasource to review and submit a greater testing assessment to us as to what combinations are possible from your comment just above, #111858 (comment) |
Going to close this issue as the implementation work here is done. If needed, please open a new issue for testing or continue discussing right here. |
Hi @EricDavisX We have attempted it to validate as per steps mentioned and shared observations on related testing ticket : #120726 Thanks |
Blocked by:
kibana_system
user for setup & all package operations #111755In order to support smooth Stack upgrades, certain packages, if installed, need to be kept in sync with the Stack version. To accomplish this, the Fleet plugin should initiate its setup process when Kibana starts up rather than waiting for a user to visit the Fleet app in the UI.
Requirements:
start
method to initiate the [setup process] - [Fleet] Move Fleet Setup tostart
lifecycle #117552Upgrade any bundled / managed packages from disk (see [Fleet] Add support for bundling Stack-version aligned packages with Kibana #112095)Upgrade package policies for all packages aboveAdd a package specpackage_policy_upgrade_strategy
field for specifying a package policy upgrade strategyAdd support usingpackage_policy_upgrade_strategy
to decide when to attempt policy upgrades: [Change Proposal] Addpackage_policy_upgrade_strategy
field to support Fleet upgrade behavior package-spec#244Update managed packages to use new fieldAUTO_UPDATE_PACKAGES
as well as the existingDEFAULT_PACKAGES
core.status.set
APIRemove theThis was scrapped/setup
and/agents/setup
APIs ?Open questions
The text was updated successfully, but these errors were encountered: