-
Notifications
You must be signed in to change notification settings - Fork 688
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
Revamped Upgrade Agent for Litmus 3.x.x #4740
Revamped Upgrade Agent for Litmus 3.x.x #4740
Conversation
Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com>
Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com>
Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com>
2c4a19b
to
09b3b07
Compare
Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com>
6e60bff
to
2db3496
Compare
Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com>
aaeaaa1
to
e8a3957
Compare
Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com>
Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com>
7f9949a
to
4edbcd2
Compare
Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com>
Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com>
9f75d4d
to
8e9e7c5
Compare
Signed-off-by: Kartikay <kartikay_2101ce32@iitp.ac.in>
Signed-off-by: Kartikay <kartikay_2101ce32@iitp.ac.in>
Signed-off-by: Kartikay <kartikay_2101ce32@iitp.ac.in>
Signed-off-by: Kartikay <kartikay_2101ce32@iitp.ac.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.
Please remove the commented code
Signed-off-by: Kartikay <kartikay_2101ce32@iitp.ac.in>
Signed-off-by: Kartikay <kartikay_2101ce32@iitp.ac.in>
NextVersion: "", | ||
VersionManager: v3_9_0.NewVersionManger(m.Logger, m.DBClient), | ||
}, | ||
"4.0.0-beta8": { |
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.
We can remove this for now
Signed-off-by: Kartikay <kartikay_2101ce32@iitp.ac.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.
Great work @kartikaysaxena 🚀 , This is a great feature addition and will help the users in seamless upgrade of chaos center.
1) If upgrade volume is huge, then transaction is not favorable. | ||
2) Split the upgrades into proprietary functions depending on their purpose and database/collection names. | ||
3) Use logging techniques as used in other versions to provide the user an insight of how the upgrades are being done. | ||
4) While using a transaction, make sure the session context is properly passed into the relevant mongo operations and related functions. |
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.
- Script should be written in a way that even if run twice, should not affect the already updated documents.
|
||
There are some other files not mentioned here. | ||
|
||
## **Upgrade to version 3.9.0** |
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.
## **Upgrade to version 3.9.0** | |
## **Example: Upgrade to version 3.9.0** |
Beta int | ||
} | ||
|
||
// Converts version from type string to type Version |
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.
Can you please add comment describing what this function will return for different inputs. For e.g 3.0.0-beta-10, 3.1.0, 3.1.1 etc
NextVersion: "3.7.0", | ||
VersionManager: nil, | ||
}, | ||
"3.7.7-beta8": { |
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.
All these old versions where no upgrades are available can be removed from this map
} | ||
} | ||
|
||
func arrayToVersion(versionArray []int) string { |
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.
Please add a comment to describe what this function does
|
||
func upgradeUsersCollection(logger *log.Logger, dbClient *mongo.Client, ctx context.Context) error { | ||
|
||
logVersion := log.Fields{ |
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.
Can you please follow this kind of logging here: https://github.com/litmuschaos/litmus/pull/4740/files#diff-c3dcc200129e5965fb7dc2655155eb285cfea424297940f911ffe1b6624b8316R62
|
||
environmentIDIndexExists := false | ||
|
||
logVersion := log.Fields{ |
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.
Can you please follow this kind of logging here: https://github.com/litmuschaos/litmus/pull/4740/files#diff-c3dcc200129e5965fb7dc2655155eb285cfea424297940f911ffe1b6624b8316R62
Please update in other places as well
|
||
defer session.EndSession(ctx) | ||
|
||
logVersion := log.Fields{ |
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.
Can you please follow this kind of logging here: https://github.com/litmuschaos/litmus/pull/4740/files#diff-c3dcc200129e5965fb7dc2655155eb285cfea424297940f911ffe1b6624b8316R62
Signed-off-by: Kartikay <kartikay_2101ce32@iitpac.in>
Awesome work @kartikaysaxena 🚀 ❤️ |
* initialise upgrade-agent Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com> * dockerfile revert Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com> * go.mod Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com> * litmus-portal to chaoscenter Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com> * dummy versions and log Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com> * CONTRIBUTING.md init Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com> * added checks while upgrading Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com> * transactions Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com> * transaction implemented in v3.4.0 Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com> * added upgrades for version 3.9.0 Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com> * nit: gofmt Signed-off-by: Kartikay <kartikay_2101ce32@iitp.ac.in> * Template for upgrades Signed-off-by: Kartikay <kartikay_2101ce32@iitp.ac.in> * refactoring and dumping dummy versions Signed-off-by: Kartikay <kartikay_2101ce32@iitp.ac.in> * gofmt Signed-off-by: Kartikay <kartikay_2101ce32@iitp.ac.in> * best practices Signed-off-by: Kartikay <kartikay_2101ce32@iitp.ac.in> * removed commented code Signed-off-by: Kartikay <kartikay_2101ce32@iitp.ac.in> * added flowchart Signed-off-by: Kartikay <kartikay_2101ce32@iitp.ac.in> * removed dummy version from map Signed-off-by: Kartikay <kartikay_2101ce32@iitp.ac.in> * refactor: better logs and comments Signed-off-by: Kartikay <kartikay_2101ce32@iitpac.in> --------- Signed-off-by: Kartikay <120778728+kartikaysaxena@users.noreply.github.com> Signed-off-by: Kartikay <kartikay_2101ce32@iitp.ac.in> Signed-off-by: Kartikay <kartikay_2101ce32@iitpac.in> Co-authored-by: Saranya Jena <saranya.jena@harness.io> Co-authored-by: Kartikay <kartikay_2101ce32@iitpac.in> Signed-off-by: dusdjhyeon <dusdj0813@gmail.com>
Proposed changes
Related #4632
Summarize your changes here to communicate with the maintainers and make sure to put the link of that issue
Types of changes
What types of changes does your code introduce to Litmus? Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Dependency
Special notes for your reviewer:
Revamped Litmus Upgrade Agent for Litmus 3.x.x