fix: Use actual weight from status field on rollout object#1937
fix: Use actual weight from status field on rollout object#1937alexmt merged 10 commits intoargoproj:masterfrom
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 <zachaller@hotmail.com>
| 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.
instead of n/a, can we set to equal to
roInfo.ActualWeight = roInfo.SetWeight
There was a problem hiding this comment.
also, can you verify if we can add a test for this use case?
There was a problem hiding this comment.
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.
…ailabe in status Signed-off-by: zachaller <zachaller@hotmail.com>
Signed-off-by: zachaller <zachaller@hotmail.com>
Signed-off-by: zachaller <zachaller@hotmail.com>
Signed-off-by: zachaller <zachaller@hotmail.com>
Signed-off-by: zachaller <zachaller@hotmail.com>
…tInfoWeights Signed-off-by: zachaller <zachaller@hotmail.com>
Signed-off-by: zachaller <zachaller@hotmail.com>
| } 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.
this looks good..what happens for bluegreen ? is there a different object with weight?
| 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.
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 <zachaller@hotmail.com>
Signed-off-by: zachaller <zachaller@hotmail.com>
|
Kudos, SonarCloud Quality Gate passed!
|
…1937) fix: Use actual weight from status field on rollout object (argoproj#1937) Signed-off-by: zachaller <zachaller@hotmail.com>
…1937) fix: Use actual weight from status field on rollout object (argoproj#1937) Signed-off-by: zachaller <zachaller@hotmail.com> Signed-off-by: Ravi Hari <ravireliable@gmail.com>
fix: Use actual weight from status field on rollout object (#1937) Signed-off-by: zachaller <zachaller@hotmail.com>
|
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 <zachaller@hotmail.com> * fix: missing lb event (argoproj#2021) * fix: turn missing load balancer log into an event Signed-off-by: zachaller <zachaller@hotmail.com> * consistent naming Signed-off-by: zachaller <zachaller@hotmail.com> * 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 <zachaller@hotmail.com> * fix: build/lint is broken due to dependencies changes (argoproj#1958) Signed-off-by: zachaller <zachaller@hotmail.com> * following github workflow error prompt to fix Signed-off-by: Travis Perdue <travis.perdue@rallyhealth.com> * go fmt Signed-off-by: Travis Perdue <travis.perdue@rallyhealth.com> * make go-mod-vendor Signed-off-by: Travis Perdue <travis.perdue@rallyhealth.com> * fix path Signed-off-by: Travis Perdue <travis.perdue@rallyhealth.com> Signed-off-by: zachaller <zachaller@hotmail.com> Signed-off-by: Travis Perdue <travis.perdue@rallyhealth.com> Co-authored-by: Zach Aller <zachaller@users.noreply.github.com> Co-authored-by: Travis Perdue <travis.perdue@rallyhealth.com>
…1937) fix: Use actual weight from status field on rollout object (argoproj#1937) Signed-off-by: zachaller <zachaller@hotmail.com> Signed-off-by: Juan Enciso <juan.enciso@gmail.com>








This fixes #1812 by pulling the actual weight from the status field instead
of the SetWeight.
Signed-off-by: zachaller zachaller@hotmail.com