-
Notifications
You must be signed in to change notification settings - Fork 70
feat: Support automated config migration for separate mapper config #3902
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
feat: Support automated config migration for separate mapper config #3902
Conversation
Signed-off-by: James Rhodes <[email protected]>
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
Robot Results
|
didier-wenzek
left a comment
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.
tedge-mapper migrate-config is nicely working, including for cloud profile.
It could be improved a bit to be more explicit when no config is to be migrated (because not set or already migrated).
crates/core/tedge_mapper/src/lib.rs
Outdated
| #[clap(hide = true)] | ||
| MigrateConfig { | ||
| cloud_name: CloudType, | ||
| }, |
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.
Why use a hidden command for this migration tool?
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.
At the moment, I didn't want to expose the details for undocumented features, particularly one where the user has nothing obvious to gain by using the feature
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.
Particularly with @albinsuresh's point about unifying directory structure between this and the mapper flow definitions in #3892 (comment), there's a chance we may need to slightly revise the structure, which is a good reason for people not to adopt this feature until we are happy it's stable.
Signed-off-by: James Rhodes <[email protected]>
Signed-off-by: James Rhodes <[email protected]>
06545ae to
1c97f70
Compare
didier-wenzek
left a comment
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.
The code is clear and the tests comprehensive. There are still some open UX questions, though.
I don't think we need to "Ensure there is a mechanism for changing the default mapper config location for new users" in this PR. We can make the new mapper schema the default, when the feature and the documentation will be complete.
I like that tedge connect displays the path to the mapper configuration file. This is not a problem to have a constant path when the config has not been migrated. This will even be handy to support users during the transition phase.
I noticed that now tedge config set remove unknown properties, while this was not the case before #3889. I'm okay with that, as I don't think it was a documented behavior, but it would be good to consider restoring the former behavior.
I believe this is the existing behaviour for |
Signed-off-by: James Rhodes <[email protected]>
f324ec4 to
ac295bd
Compare
didier-wenzek
left a comment
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.
From my point of view, this PR is ready to be merged, with one point still to be discussed as highlighted here #3902 (comment): do we have to revise the mapper config directory structure so we can add later other mapper related configs (flows, bridged topics)?
|
Just some remarks on the UX.
|
We could potentially do this, however it's also the case that this migration shouldn't change anything. If we did support relative paths in config files in the future then this could be a problematic assumption, but I don't see much
This is a good point, particularly since we only install tab-completions for
Particularly given the new default behaviour is currently set to only create separate mapper configs if no cloud configs exist in
Maybe. If we did this, I would like there to be a clear process through which we remove this file automatically, since leaving it around will mostly likely cause confusion. This is particularly true since we generally encapsulate all of the configuration files so the users generally never need touch them. |
If we do the service restarts as part of the "migration" then we can cleanly remove the backup after the service restarts and connection tests are deemed successful. |
Signed-off-by: James Rhodes <[email protected]>
…to easily retry Signed-off-by: James Rhodes <[email protected]>
Signed-off-by: James Rhodes <[email protected]>
Signed-off-by: James Rhodes <[email protected]>
Signed-off-by: James Rhodes <[email protected]>
Proposed changes
Add a migration tool for converting
tedge.tomlbased configs to separate mapper configs.To use the tool, runtedge-mapper migrate-config c8y(or with the cloud of your choosing).To use the tool, run
tedge config upgrade.TODO:
tedge connectsummary showing where the mapper is configuredtedge connectconfig summary showing the feature/temporarily hide it if notTypes of changes
Paste Link to the issue
Checklist
just prepare-devonce)just formatas mentioned in CODING_GUIDELINESjust checkas mentioned in CODING_GUIDELINESFurther comments