mirror of https://github.com/fluxcd/flagger.git
fix: max weight for steps fixed
This commit is contained in:
parent
ab80bcde44
commit
0ccf97bec1
|
@ -29,7 +29,6 @@ canary:
|
|||
analysis:
|
||||
promotion:
|
||||
fullWeight: 1000
|
||||
maxWeight: 500
|
||||
stepWeights: [1, 10, 100, 800]
|
||||
```
|
||||
This configuration performs analysis starting from 1, going through `stepWeights` values till 800.
|
||||
|
|
|
@ -14,6 +14,18 @@ import (
|
|||
"github.com/weaveworks/flagger/pkg/router"
|
||||
)
|
||||
|
||||
func (c *Controller) maxWeight(canary *flaggerv1.Canary) int {
|
||||
var stepWeightsLen = len(canary.GetAnalysis().StepWeights)
|
||||
if stepWeightsLen > 0 {
|
||||
return canary.GetAnalysis().StepWeights[stepWeightsLen-1]
|
||||
}
|
||||
if cd.GetAnalysis().MaxWeight > 0 {
|
||||
maxWeight = cd.GetAnalysis().MaxWeight
|
||||
}
|
||||
// set max weight default value to 100%
|
||||
return 100
|
||||
}
|
||||
|
||||
func (c *Controller) fullWeight(canary *flaggerv1.Canary) int {
|
||||
if canary.GetAnalysis().FullWeight > 0 {
|
||||
return canary.GetAnalysis().FullWeight
|
||||
|
@ -200,10 +212,7 @@ func (c *Controller) advanceCanary(name string, namespace string) {
|
|||
return
|
||||
}
|
||||
|
||||
maxWeight := c.fullWeight(cd)
|
||||
if cd.GetAnalysis().MaxWeight > 0 {
|
||||
maxWeight = cd.GetAnalysis().MaxWeight
|
||||
}
|
||||
maxWeight := c.maxWeight(cd)
|
||||
|
||||
// check primary status
|
||||
if !cd.SkipAnalysis() {
|
||||
|
|
Loading…
Reference in New Issue