-
Notifications
You must be signed in to change notification settings - Fork 867
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
fix: Use actual weight from status field on rollout object #1937
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1937 +/- ##
==========================================
+ Coverage 82.40% 82.42% +0.02%
==========================================
Files 119 119
Lines 16910 16913 +3
==========================================
+ Hits 13934 13940 +6
+ Misses 2285 2282 -3
Partials 691 691
Continue to review full report at Codecov.
|
This fixes argoproj#1812 by pulling the actual weight from the status field instead of the SetWeight. Signed-off-by: zachaller <[email protected]>
if ro.Status.Canary.Weights != nil { | ||
roInfo.ActualWeight = fmt.Sprintf("%d", ro.Status.Canary.Weights.Canary.Weight) | ||
} else { | ||
roInfo.ActualWeight = "n/a" |
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.
instead of n/a, can we set to equal to
roInfo.ActualWeight = roInfo.SetWeight
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.
also, can you verify if we can add a test for this use case?
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.
Yea I can set it back to
roInfo.ActualWeight = roInfo.SetWeight
I went back and for on that and n/a
the reason I went with n/a
was because I thought it was a bit strange from an end users perspective to have a slightly incorrect value and not knowing its incorrect vs 'n/a' however if you feel it should be n/a
I will set it to that.
As for testing I did spend a little time looking into it but found that there was zero tests for rollout_info.go and it seemed a bit odd to test it at the api level when it should really be tested at say the UI side. I did not look if there was UI tests framework so I will spend some time looking into seeing if there is UI testing framework in place that I can use.
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.
@harikrongali tests have been added
…ailabe in status Signed-off-by: zachaller <[email protected]>
Signed-off-by: zachaller <[email protected]>
Signed-off-by: zachaller <[email protected]>
Signed-off-by: zachaller <[email protected]>
Signed-off-by: zachaller <[email protected]>
…tInfoWeights Signed-off-by: zachaller <[email protected]>
Signed-off-by: zachaller <[email protected]>
@@ -65,7 +65,11 @@ func NewRolloutInfo( | |||
} | |||
} | |||
} else { | |||
roInfo.ActualWeight = roInfo.SetWeight | |||
if ro.Status.Canary.Weights != nil { | |||
roInfo.ActualWeight = fmt.Sprintf("%d", ro.Status.Canary.Weights.Canary.Weight) |
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.
this looks good..what happens for bluegreen ? is there a different object with weight?
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.
assert.Equal(t, rolloutObjs.Rollouts[4].Status.Canary.Weights.Canary.Weight, int32(actualWeightStringInt32)) | ||
|
||
//This test has a no canary weight object in the status field so we fall back to using SetWeight value | ||
roInfo = NewRolloutInfo(rolloutObjs.Rollouts[5], rolloutObjs.ReplicaSets, rolloutObjs.Pods, rolloutObjs.Experiments, rolloutObjs.AnalysisRuns, nil) |
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.
More as a suggestion but there is a more interesting pattern to use in tests when you want to validate 2 different scenarios like what you are doing. Instead of mixing the 2 scenarios in one single test case we can leverage testing.Run
to run nested executions making more evident what exactly your are testing. See this example.
Advantages are:
- Easier to understand what the test is doing
- Test description in plain english
- Better report when test fail
- Running tests in parallel
Signed-off-by: zachaller <[email protected]>
Signed-off-by: zachaller <[email protected]>
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
…1937) fix: Use actual weight from status field on rollout object (argoproj#1937) Signed-off-by: zachaller <[email protected]>
…1937) fix: Use actual weight from status field on rollout object (argoproj#1937) Signed-off-by: zachaller <[email protected]> Signed-off-by: Ravi Hari <[email protected]>
fix: Use actual weight from status field on rollout object (#1937) Signed-off-by: zachaller <[email protected]>
Why is it better to look at the status? Wouldn't it be potentially different (delayed) from desired replica count set in the spec? In cases when you come from the surge of traffic it would be higher when desired (in spec) is lower and after quick scaleup is in order. Status would lag behind? In this scenarios Canary might create not excessive or insufficient number of pods? |
* fix: Add pagination to FindLoadBalancerByDNSName (argoproj#1971) * fix: this close issue argoproj#1963 by adding pagination to FindLoadBalancerByDNSName This adds pagination to the FindLoadBalancerByDNSName function this should allow argo rollouts to work with any number of loadbalancers. Signed-off-by: zachaller <[email protected]> * fix: missing lb event (argoproj#2021) * fix: turn missing load balancer log into an event Signed-off-by: zachaller <[email protected]> * consistent naming Signed-off-by: zachaller <[email protected]> * fix: Use actual weight from status field on rollout object (argoproj#1937) fix: Use actual weight from status field on rollout object (argoproj#1937) Signed-off-by: zachaller <[email protected]> * fix: build/lint is broken due to dependencies changes (argoproj#1958) Signed-off-by: zachaller <[email protected]> * following github workflow error prompt to fix Signed-off-by: Travis Perdue <[email protected]> * go fmt Signed-off-by: Travis Perdue <[email protected]> * make go-mod-vendor Signed-off-by: Travis Perdue <[email protected]> * fix path Signed-off-by: Travis Perdue <[email protected]> Signed-off-by: zachaller <[email protected]> Signed-off-by: Travis Perdue <[email protected]> Co-authored-by: Zach Aller <[email protected]> Co-authored-by: Travis Perdue <[email protected]>
…1937) fix: Use actual weight from status field on rollout object (argoproj#1937) Signed-off-by: zachaller <[email protected]> Signed-off-by: Juan Enciso <[email protected]>
This fixes #1812 by pulling the actual weight from the status field instead
of the SetWeight.
Signed-off-by: zachaller [email protected]