-
Notifications
You must be signed in to change notification settings - Fork 11.6k
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
Alerting: Add clean_upgrade config and deprecate force_migration #78324
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution! I have reviewed the configuration docs updates and will let @brendamuir take a look at the alerting docs updates.
I made some suggestions. Please review before you accept to ensure I have not changed the technical meaning. Thanks!
3d0aa2c
to
6945331
Compare
Moved some of the prerequisite but out-of-scope code changes into #78369 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc changes look fine, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep the old flag around and introduce the new one. When Grafana 11 comes, then we can remove the old one - otherwise LGTM.
@gotjosh Added @brendamuir Added the docs section back in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I skimmed through it and overall LGTM, I'm not sure I follow all the pieces of the logic in migration/service.go
as I'm not very familiar with the current state of the migration.
I'd advise you seek a second approver to make sure the logic is sound.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. just a few minor comments.
Re deprecation vs removal: Personally, I am in favor of removing it at all.
- It is a transactional flag and is not supposed to be other than default. This flag is only used during upgrade, which is not something that happens regularly.
- Having the deprecated flag means that you have to support it anyway, and therefore there is a possibility of unexpected combinations (both true, one is true etc), which creates multiple upgrade paths and additional complexity in troubleshooting of potential problems.
- Deprecated is also strange because, afaiu, the entire migration package will be gone in G11... i.e. clean_upgrade and the upgrade section is also kinda "deprecated"
}, | ||
isMigrationRun: true, | ||
expected: true, | ||
expectedErr: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we still want to mark it as deprecated, then clean_upgrade needs its own set of tests when force is true and false. Same in service_test.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
force_migration and clean_upgrade have their own set of tests
@@ -279,7 +281,7 @@ func TestServiceRevert(t *testing.T) { | |||
} | |||
}) | |||
|
|||
t.Run("ForceMigration story", func(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we keep the "force" flag, then I would recommend adding a new set of tests and keeping existing ones untouched.
I think we can improve readability by branching Run by either UA.enabled or migrated flags, and extract logic into separate methods for both cases. This way the code flow will be much clearer to understand. |
b7a95ab
to
9358890
Compare
Agreed, improved the readability of the migration logic in base branch here: #78369 (comment). The change in this PR is now extremely simple and clear. |
Upgrading to UA and rolling back no longer deletes any data. Instead, we remove the force_migration in favour of a new config called clean_upgrade. If clean_upgrade is set to true when upgrading from legacy alerting to Unified Alerting, grafana will first delete all existing Unified Alerting resources, thus re-upgrading all organizations from scratch. If false or unset, organizations that have previously upgraded will not lose their existing Unified Alerting data when switching between legacy and Unified Alerting. Similar to force_migration, it should be kept false when not needed as it may cause unintended data-loss if left enabled.
Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
To be removed in v11
9358890
to
c2e6d17
Compare
Note: #78369 is a prerequisite for this PR.
What is this feature?
This change has two main components:
force_migration
config has been deprecated and no extra configuration is required to roll back to legacy anymore.force_migration
when rolling back. Instead, you set the newclean_upgrade
when upgrading (thoughforce_migration
will continue to work as-is for now):This config takes effect when upgrading from legacy->UA and, if enabled, will first revert all UA data before performing the upgrade from a clean slate.
Note: Similar to
force_migration
,clean_upgrade
should be kept false when not needed as it may cause unintended data-loss if left enabled.Why do we need this feature?
This is a general improvement and precursor to upcoming migration dry-run functionality.
Who is this feature for?
Users migrating from legacy alerting to Grafana Alerting (UA).
Please check that: