-
Notifications
You must be signed in to change notification settings - Fork 713
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 <[email protected]>
Signed-off-by: Kartikay <[email protected]>
2c4a19b
to
09b3b07
Compare
Signed-off-by: Kartikay <[email protected]>
6e60bff
to
2db3496
Compare
Signed-off-by: Kartikay <[email protected]>
aaeaaa1
to
e8a3957
Compare
Signed-off-by: Kartikay <[email protected]>
Signed-off-by: Kartikay <[email protected]>
7f9949a
to
4edbcd2
Compare
Signed-off-by: Kartikay <[email protected]>
Signed-off-by: Kartikay <[email protected]>
9f75d4d
to
8e9e7c5
Compare
Signed-off-by: Kartikay <[email protected]>
Signed-off-by: Kartikay <[email protected]>
Signed-off-by: Kartikay <[email protected]>
Signed-off-by: Kartikay <[email protected]>
Signed-off-by: Kartikay <[email protected]>
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 <[email protected]>
Signed-off-by: Kartikay <[email protected]>
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 <[email protected]>
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 <[email protected]>
Awesome work @kartikaysaxena 🚀 ❤️ |
* initialise upgrade-agent Signed-off-by: Kartikay <[email protected]> * dockerfile revert Signed-off-by: Kartikay <[email protected]> * go.mod Signed-off-by: Kartikay <[email protected]> * litmus-portal to chaoscenter Signed-off-by: Kartikay <[email protected]> * dummy versions and log Signed-off-by: Kartikay <[email protected]> * CONTRIBUTING.md init Signed-off-by: Kartikay <[email protected]> * added checks while upgrading Signed-off-by: Kartikay <[email protected]> * transactions Signed-off-by: Kartikay <[email protected]> * transaction implemented in v3.4.0 Signed-off-by: Kartikay <[email protected]> * added upgrades for version 3.9.0 Signed-off-by: Kartikay <[email protected]> * nit: gofmt Signed-off-by: Kartikay <[email protected]> * Template for upgrades Signed-off-by: Kartikay <[email protected]> * refactoring and dumping dummy versions Signed-off-by: Kartikay <[email protected]> * gofmt Signed-off-by: Kartikay <[email protected]> * best practices Signed-off-by: Kartikay <[email protected]> * removed commented code Signed-off-by: Kartikay <[email protected]> * added flowchart Signed-off-by: Kartikay <[email protected]> * removed dummy version from map Signed-off-by: Kartikay <[email protected]> * refactor: better logs and comments Signed-off-by: Kartikay <[email protected]> --------- Signed-off-by: Kartikay <[email protected]> Signed-off-by: Kartikay <[email protected]> Signed-off-by: Kartikay <[email protected]> Co-authored-by: Saranya Jena <[email protected]> Co-authored-by: Kartikay <[email protected]> Signed-off-by: dusdjhyeon <[email protected]>
* initialise upgrade-agent Signed-off-by: Kartikay <[email protected]> * dockerfile revert Signed-off-by: Kartikay <[email protected]> * go.mod Signed-off-by: Kartikay <[email protected]> * litmus-portal to chaoscenter Signed-off-by: Kartikay <[email protected]> * dummy versions and log Signed-off-by: Kartikay <[email protected]> * CONTRIBUTING.md init Signed-off-by: Kartikay <[email protected]> * added checks while upgrading Signed-off-by: Kartikay <[email protected]> * transactions Signed-off-by: Kartikay <[email protected]> * transaction implemented in v3.4.0 Signed-off-by: Kartikay <[email protected]> * added upgrades for version 3.9.0 Signed-off-by: Kartikay <[email protected]> * nit: gofmt Signed-off-by: Kartikay <[email protected]> * Template for upgrades Signed-off-by: Kartikay <[email protected]> * refactoring and dumping dummy versions Signed-off-by: Kartikay <[email protected]> * gofmt Signed-off-by: Kartikay <[email protected]> * best practices Signed-off-by: Kartikay <[email protected]> * removed commented code Signed-off-by: Kartikay <[email protected]> * added flowchart Signed-off-by: Kartikay <[email protected]> * removed dummy version from map Signed-off-by: Kartikay <[email protected]> * refactor: better logs and comments Signed-off-by: Kartikay <[email protected]> --------- Signed-off-by: Kartikay <[email protected]> Signed-off-by: Kartikay <[email protected]> Signed-off-by: Kartikay <[email protected]> Co-authored-by: Saranya Jena <[email protected]> Co-authored-by: Kartikay <[email protected]> Signed-off-by: sagnik3788 <[email protected]>
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