mirror of
https://github.com/fluxcd/flagger.git
synced 2026-04-15 06:57:34 +00:00
make MirrorWeight's type int, not float64
This commit is contained in:
@@ -325,7 +325,7 @@ spec:
|
||||
# enable traffic shadowing
|
||||
mirror: true
|
||||
# weight of the traffic mirrored to your canary (defaults to 100%)
|
||||
mirrorWeight: 100.0
|
||||
mirrorWeight: 100
|
||||
metrics:
|
||||
- name: request-success-rate
|
||||
thresholdRange:
|
||||
|
||||
@@ -278,7 +278,7 @@ Istio example:
|
||||
# Traffic shadowing (compatible with Istio only)
|
||||
mirror: true
|
||||
# Weight of the traffic mirrored to your canary (defaults to 100%)
|
||||
mirrorWeight: 100.0
|
||||
mirrorWeight: 100
|
||||
```
|
||||
|
||||
Mirroring rollout steps for service mesh:
|
||||
|
||||
@@ -179,9 +179,9 @@ type CanaryAnalysis struct {
|
||||
// +optional
|
||||
Mirror bool `json:"mirror,omitempty"`
|
||||
|
||||
// Percentage of the traffic to be mirrored in the range of [0.0, 100.0].
|
||||
// Percentage of the traffic to be mirrored in the range of [0, 100].
|
||||
// +optional
|
||||
MirrorWeight float64 `json:"mirrorWeight,omitempty"`
|
||||
MirrorWeight int `json:"mirrorWeight,omitempty"`
|
||||
|
||||
// Max traffic percentage routed to canary
|
||||
// +optional
|
||||
|
||||
+1
-1
@@ -306,7 +306,7 @@ func (ir *IstioRouter) SetRoutes(
|
||||
}
|
||||
|
||||
if mw := canary.GetAnalysis().MirrorWeight; mw > 0 {
|
||||
vsCopy.Spec.Http[0].MirrorPercentage = &istiov1alpha3.Percent{Value: mw}
|
||||
vsCopy.Spec.Http[0].MirrorPercentage = &istiov1alpha3.Percent{Value: float64(mw)}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ func TestIstioRouter_SetRoutes(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("mirror", func(t *testing.T) {
|
||||
for _, w := range []float64{0, 10, 50} {
|
||||
for _, w := range []int{0, 10, 50} {
|
||||
p, c := 100, 0
|
||||
|
||||
// set mirror weight
|
||||
@@ -157,7 +157,7 @@ func TestIstioRouter_SetRoutes(t *testing.T) {
|
||||
}
|
||||
|
||||
if w > 0 && assert.NotNil(t, mirrorWeight) {
|
||||
assert.Equal(t, w, mirrorWeight.Value)
|
||||
assert.Equal(t, w, int(mirrorWeight.Value))
|
||||
} else {
|
||||
assert.Nil(t, mirrorWeight)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user